Every Scute call a run makes after the task starts uses the task token as Authorization: Bearer. What a task is and what Scute records for it is described under Agents. This page covers the harness side.
Where the token comes from#
| Run created with | Token |
|---|---|
| SCUTE_SECRET set (or secret passed) | The run mints a task on first use with the options you gave (actsFor, task, requester, parent) and keeps the token in its state |
| token | The run uses that token as is and never mints |
Without either, the first call that needs a token fails: TypeScript throws ScuteHarnessError with code no_credentials (401); Python raises ConfigurationError; Ruby raises Scute::ConfigurationError. Inside a guard, that counts as deny.
The token never goes into the model's context, onDecision events or verdicts.
Run an agent without the secret#
Keep SCUTE_SECRET on your backend. The backend mints the task and hands the token to the agent process, which runs with SCUTE_APP_ID and the token.
// backend, with SCUTE_SECRETconst backend = createHarness({ agent: "support-bot" });const token = await backend.run({ actsFor: user.scuteId, task: { actions: ["invoice:read"] } }).token();// agent process, without SCUTE_SECRETconst harness = createHarness({ agent: "support-bot", guards: [guards.permissions()] });const run = harness.run({ id: conversationId, token });On a token run:
- Run state is keyed by a hash of the token, so two tokens never share state.
- Hourly budgets are counted for the person the task acts for, read from whoami, or per task when it acts for nobody.
- run.taskId() reads the task id from whoami.
- Verification, approvals, plans, properties and checks all work with the token alone.
- Closing the task needs the secret. See runs.
Expiry and revocation#
- A minted token within 5 seconds of its expiry is replaced by a new task on the next call. A token you passed in is never replaced.
- 401 invalid_task_token before the expiry (the task was revoked or completed, or the agent was suspended) closes the run for good. On a token run, any invalid_task_token closes it.
- An engine answer with reason task_closed or budget_exceeded closes the run too.
Sub-agents#
Pass the parent run when an orchestrator starts a sub-agent. The child's task is minted with parent_task_id set to the parent's task, so Scute records the chain and the child cannot outlive the parent.
const child = researcher.run({ id: `${run.id}:research`, actsFor: user.scuteId, parent: run });Ask what the task allows#
const me = await run.whoami();GET /v1/auth/:app_id/agent/whoami, cached per run. Fields:
| Field | Meaning |
|---|---|
| agent, task | The agent slug and task id |
| acts_for | The app user the task acts for, or null |
| chain | The delegation chain |
| agent_roles | The agent's roles |
| permissions | What the task may do now, app-wide |
| ceiling | The most the task could ever do: the agent's roles and the task's list |
| conditional | Permissions allowed only under conditions, with the conditions |
| step_up | Permissions that need the person to verify |
| approval | Permissions that need a reviewer |
| actions, resources | The task's own limits, or null for none |
| expires_at, expires_in | When the task ends |
| warnings | expires_soon with under five minutes left |
run.allowedTools() and run.prepareStep use ceiling to hide tools the task can never use.