Agent guide
An agent run is a plan of registered tool calls executed under explicit budgets. The first pass is synchronous; the response tells you whether the run completed, paused for approval, or failed.
Definitions and versions
An agent cannot exist without an executable version, and its declared capabilities are checked rather than inferred from a prompt.
The agent record belongs to an organisation. A run requires that the agent exists, belongs to the org passed in, is active, and that the caller holds the agents.execute entitlement plus membership.
Starting a run
Budgets are declared by the caller but capped by the platform.
await callFunction("startAgentRun", {
orgId: "o_01J8Z3K4",
agentId: "a_01J8Z3K9",
input: { objective: "Summarise this month's usage", params: {} },
plan: [{ toolId: "usage.summary", input: { orgId: "o_01J8Z3K4" } }],
limits: { maxSteps: 8, maxWallClockMs: 120_000, maxToolCalls: 8 },
});
// → { runId, status: "completed" | "paused" | "failed", phase, pendingApproval? }| Limit | Default | Ceiling |
|---|---|---|
| Plan steps | 20 | 200 |
| maxWallClockMs | 60,000 | 600,000 |
| maxToolCalls | 20 | 200 |
The tool registry
Boot fails on a duplicate tool id, a definition without an executor, or an executor without a definition.
| Tool | Entitlement | Approval | Timeout | Input |
|---|---|---|---|---|
| usage.summary | None (org membership) | Not required | 5 s | { orgId, period? } |
| org.members.list | organization.members | Required | 10 s | { orgId, status?, pageSize?, cursor? } |
Platform ceilings are 30 seconds and two attempts per tool. A tool output that fails its declared schema fails the step and the run with AGENT_EXECUTION_FAILED — it is never repaired.
Approvals
A tool that requires approval pauses the run instead of executing.
- Request
- The run returns status paused, phase AWAITING_APPROVAL and a pendingApproval { approvalId, stepIndex }.
- Decision
- approveAgentRunStep records the decision with the deciding uid, then continues or fails the run. The decision is audited.
- Expiry
- expireWorkflowApprovals sweeps every five minutes and closes expired approvals as timed_out with a TIMED_OUT or AGENT_TIMEOUT code, an audit event and a notification to the requester.
Failure codes
| Code | Cause |
|---|---|
| AGENT_PERMISSION_DENIED | Org mismatch, inactive agent, or a tool the caller may not use. |
| ENTITLEMENT_DENIED | The organisation lacks agents.execute. |
| DOCUMENT_INVALID | Plan exceeds limits, approvals cap exceeded, or the agent does not exist. |
| AGENT_EXECUTION_FAILED | A step failed, or a tool output failed its schema. |
| AGENT_TIMEOUT | Wall-clock budget exhausted. |
| APP_CHECK_FAILED | Attestation missing or invalid while enforcement is on. |
Cancellation
cancelAgentRun stops a run that has not reached a terminal state. Steps already executed remain in the run record; the cancellation itself is recorded with its actor.
Inspect a run in the workspace
The agents surface shows run state, step history and pending approvals with the same codes listed here.