Agents

Approvals

Ask a reviewer to approve one call or a whole plan, then spend the approval on the check.

A permission that requires approval answers allow_with_approval. The agent files an approval request for that exact call, a reviewer approves or denies it, and the agent passes the approval's id as approval on the next check. An agent can also file a plan: every step it means to take, for one review.

The agent files requests with its task token. The task must act for a person.

Request approval for one call#

POST/v1/auth/:app_id/agent/approvalsTask token
actionstringrequired
The action or permission slug.
resourcestring | object
The object, as on the check.
detailsobject
The exact call, such as the tool's arguments. Shown to reviewers. The approval then counts only for a check with the same details.
reasonstring
Why. Shown to reviewers after the agent's name.
contextobject
Attributes for conditions, as on the check.
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/agent/approvals \  -H "Authorization: Bearer $TASK_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "action": "refund",    "resource": "invoice:42",    "details": { "amount": 400 },    "reason": "Customer was charged twice"  }'

Scute first runs the check, then answers by what it says:

Check saysAnswer
allow_with_approval201 with the request: id, status: "pending", permission, resource, details, expires_at, say
allow200 with status: "not_needed" and the decision
allow_with_step_up200 with status: "verify_first": verify the person first
deny403 with not_permitted

A pending request expires after 72 hours.

Wait for the answer#

GET/v1/auth/:app_id/agent/approvals/:idTask token
{  "id": "REQUEST_ID",  "status": "approved",  "permission": "invoice:refund",  "resource": "invoice:42",  "details": { "amount": 400 },  "expires_at": "2026-11-19T11:05:00Z",  "say": "It's approved."}

status is pending, approved, denied, used, or another closed state. A denied request's say includes the reviewer's note.

Spend the approval#

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": 400 }, "approval": "REQUEST_ID" }'

An approval is spent once, by the person the task acts for, on the same permission, object and details, within 1 hour of being approved. A check that answers allow uses it up; it then reads used.

Approve a plan#

POST/v1/auth/:app_id/agent/plansTask token
stepsobject[]required
1 to 20 steps, each with action, resource, context and details.
reasonstring
Why. Shown to reviewers.

Scute checks every step now, without using anything up:

  • A step that would be denied fails the whole plan: 403 with step_not_permitted, naming the step.
  • A step that needs approval goes to the reviewer.
  • A step that needs verification is marked verify; the person verifies when the agent runs it.
  • When no step needs approval, the answer is 200 with status: "not_needed" and the steps.

Otherwise Scute answers 201 with the plan request, its steps (each with permission, resource, details and needs: approval, verify or none) and a say line.

GET/v1/auth/:app_id/agent/plans/:idTask token

The plan's status, with each step's used once it has been run.

Run an approved plan#

Pass the plan's id as plan on each step's check, with the step's exact resource and details. The step that matches supplies the approval. Plan steps are exact and used once; they never carry over through session trust.

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": 400 }, "plan": "PLAN_ID" }'

Who reviews#

Reviewers are the app's users whose roles grant the custom permission access_requests.review, or your backend with the app key. Nobody reviews their own request.

GET/v1/apps/:app_id/authz/requestsApp key

Lists requests. Query: status, user_id, agent (a slug), limit, before.

POST/v1/apps/:app_id/authz/requests/:id/approveApp key
POST/v1/apps/:app_id/authz/requests/:id/denyApp key

Both take note and optionally reviewer_id (the app user reviewing). A signed-in reviewer uses GET /v1/auth/:app_id/authz/me/reviews and POST /v1/auth/:app_id/authz/me/reviews/:id/approve or /deny with their session token.

Errors#

Statuserror_codeWhen
409needs_humanThe task acts for nobody
403not_permittedThe check denies the call
403step_not_permittedA plan step would be denied
422invalidNo action, or steps is not a list of 1 to 20
404not_foundThe approval or plan is not this task's