Ruby SDK

Agents

Register the agents you build, start and end their tasks, suspend them, and read a task's signed delegation, with the secret key.

scute.agents manages the app's agents with the secret key. An agent has an owner and roles (its ceiling). Each job runs as a task with a short-lived task token. Scute::Harness starts and ends tasks for you (see Harness); use scute.agents to register agents and to manage tasks from your backend. For the concepts, see AI agents.

scute = Scute::Client.newscute.agents.create(slug: "support-bot", owner_user_id: owner_id, name: "Support bot", roles: ["support_agent"])task = scute.agents.start_task("support-bot", acts_for: user_id, actions: %w[invoice:read invoice:refund], ttl: 900)task["token"]  # returned once; hand it to the agent, never to the model

Register and manage#

MethodRequest
listGET /v1/apps/:app_id/authz/agents (returns an Array)
get(slug)GET .../agents/:slug
create(slug:, owner_user_id:, name: nil, description: nil, roles: nil, team_role: nil, settings: nil)POST .../agents
update(slug, **attrs)PATCH .../agents/:slug
delete(slug)DELETE .../agents/:slug
suspend(slug)POST .../agents/:slug/suspend
resume(slug)POST .../agents/:slug/resume
slugStringrequired
The agent's id in the app. Scute::Harness.new(agent:) takes this.
owner_user_idStringrequired
A person who can reach the app's workspace, answerable for the agent.
rolesArray
Role slugs from your policy. The agent can never do more than these allow.
settingsHash
Agent settings, for example { budget: { max_actions: 2, window_minutes: 1440 } }. An agent over its budget is suspended.

suspend is the kill switch: every open task ends at once. resume reactivates the agent.

Tasks#

MethodRequest
tasks(slug, status: nil)GET .../agents/:slug/tasks (returns an Array; status: "open" for live tasks)
start_task(slug, acts_for: nil, actions: nil, resources: nil, requester: nil, ttl: nil, ref: nil, parent_task_id: nil)POST .../agents/:slug/tasks
complete_task(slug, id)POST .../agents/:slug/tasks/:id/complete
revoke_task(slug, id)POST .../agents/:slug/tasks/:id/revoke
assertion(slug, id)GET .../agents/:slug/tasks/:id/assertion
acts_forString
The app user the agent works for. Omit for an agent working on its own.
actionsArray
Permissions the task may use, for example %w[invoice:read invoice:refund].
resourcesArray
Objects the task is limited to.
requesterHash
Who asked, for example a helpdesk caller: email:, phone:, app_user_id:, name:.
ttlInteger
Task lifetime in seconds. Sent as ttl_seconds.
refString
Your own reference, for example a ticket id.
parent_task_idString
The task that started this one.

start_task returns the task with id, expires_at, acts_for and token. The token is in this answer only.

Every tool call made with the token is checked against three things: the agent's roles, the person it acts for, and the task's actions and resources.

Delegation assertion#

assertion(slug, id) returns the delegation as a signed JWT in assertion: sub is the person, act is the agent chain (RFC 8693), for example { "sub" => "agent:support-bot" }. It is signed with the app's keys at /v1/auth/:app_id/.well-known/jwks.json.

jwt = scute.agents.assertion("support-bot", task["id"])["assertion"]