Agents

The decision rule

An agent's action is allowed only when the agent's roles, the person it acts for and the task all allow it.

Before each action the agent asks Scute with its task token. Scute allows the action only when all three hold:

  1. One of the agent's ceiling roles grants the permission (and that role's conditions on it hold).
  2. The person the task acts for is allowed it, by the full authorization engine: their roles, roles on the object, conditions, verification and approval.
  3. The task's actions and resources lists cover it.

The person's answer can add a step: allow_with_step_up (they verify first) or allow_with_approval (a reviewer approves first). Only allow means go ahead.

Check one action#

POST/v1/auth/:app_id/agent/checkTask token
actionstringrequired
The action (refund) or a full permission slug (invoice:refund).
resourcestring | object
The object: "invoice:42", "invoice", or { "type": "invoice", "key": "42", "attributes": {} }. Inline attributes only fill in attributes Scute does not store for that object; stored attributes win.
contextobject
Attributes for conditions. now, hour_utc and weekday_utc are always Scute's clock and are dropped if sent. context.target names who a requester only action is for.
detailsobject
The exact call, such as the tool's arguments. An approval filed with details only counts for a check with the same details.
challengestring
The token of a completed verification, to settle allow_with_step_up. See Verify the person.
approvalstring
The id of an approved request, to settle allow_with_approval. See Approvals.
planstring
The id of an approved plan. The plan step matching this exact call supplies the approval.
session_idstring
The conversation this call belongs to, for session trust.
dry_runboolean
What the check would answer now, without using anything up: no budgets or loops are counted and no proof is spent.
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/agent/check \  -H "Authorization: Bearer $TASK_TOKEN" \  -H "Content-Type: application/json" \  -d '{ "action": "refund", "resource": "invoice:42", "details": { "amount": 40 } }'
{  "decision": "allow_with_step_up",  "allowed": false,  "reason": "verification_required",  "permission": "invoice:refund",  "roles": ["customer"],  "step_up": { "method": "any", "authorizes_action": "invoice:refund" },  "agent": { "agent": "billing-assistant", "task": "4f1e...", "chain": ["billing-assistant"], "roles": ["billing_agent"] },  "explanation": "Billing assistant, acting for sam@example.com: ...",  "say": "Before I do that, I need to verify it's you."}
FieldMeaning
decisionallow, deny, allow_with_step_up or allow_with_approval
allowedtrue only for allow. Code that tests allowed never skips a verification.
reasonWhy. See the tables below.
step_upWhat verification is needed, when allow_with_step_up
approvalWhat approval is needed, when allow_with_approval
agentThe agent, task, chain and the agent roles that granted it
explanationA sentence for logs and people
sayA line the agent can speak or write to the person as is. Missing on a plain allow.

Every check is written to the app's decision log.

Deny reasons from the agent and task#

reasonMeaning
agent_suspendedThe agent is suspended
task_closedThe task is completed, revoked or expired
unknown_permissionNo such permission in the app's policy
permission_disabledThe permission is turned off for everyone
outside_taskThe task's actions or resources do not cover it
agent_roleNone of the agent's roles grant it
condition_failedThe agent's role grants it only under conditions that do not hold
person_inactiveThe person the task acts for is deactivated
needs_humanThe task acts for nobody, and the permission needs a person (see below)
budget_exceededThe agent went over its budget and was paused. See Safety rails.
loop_detectedLoop detection in enforce mode refused a repeat
target_requiredA requester only permission was called without saying who it is for

When the person's own check denies, the decision is the person's deny, with the agent added and the explanation prefixed with who is acting for whom.

Tasks that act for nobody#

An autonomous task (no acts_for) can use a permission only when the app marked it autonomous_allowed and it needs neither verification nor approval, and it is not requester_only. There is nobody to verify or ask. Anything else is denied with needs_human.

Check many actions#

POST/v1/auth/:app_id/agent/check-batchTask token
checksobject[]required
Up to 100 items of action, resource, context.
session_idstring
The conversation, for session trust.

Answers { "results": [...] } in the same order. Batch checks are for listing what the agent could do: they take no challenge or approval, and they do not count toward budgets or loops. More than 100 checks is a 422 with batch_too_large.

Errors#

Statuserror_codeWhen
401invalid_task_tokenToken missing, expired or revoked, or the person is banned or suspended
422invalidNo action, or checks is not a list