Harness

Types and errors

Decision, Verdict, GuardResult, the engine decision, the objects human steps return, errors, and the endpoints the harness calls.

Field names below are the TypeScript ones. Python and Ruby use snake case where it differs (call_id, request_id).

Decision#

What one guard answers. See how a call is decided.

FieldTypeMeaning
kindproceed, transform, approve, verify, guide, redirect, denyThe decision
reasonstringA short code for logs and tests
messagestringWords for the model (guide, deny, redirect) or the person (verify, approve)
saystringA line for the person
argsobjecttransform: the arguments to run with
resultanyFrom an after-guard: what the model reads instead of the tool's result
verifyobjectmethod, methods, permission
approveobjectby (user or reviewer), requestId
redirectobjectto
engineobjectScute's engine decision behind it

Python: scute.harness.Decision (a dataclass; an unknown kind raises ValueError). Ruby: Scute::Harness::Decision.new(kind:, ...) (an unknown kind raises ArgumentError).

Verdict#

What run.check() returns.

FieldMeaning
kindThe final decision
decisionThe winning guard's decision, with guard set to its name
argsThe arguments to run with, transforms applied
messageFor the model, when the call does not run
sayFor the person, when there is something to tell them
resultsEvery guard's answer (GuardResult)
callIdThe tool call id
toolThe tool name

Python adds the property runs; Ruby adds runs?. Both are true for proceed and transform.

GuardResult#

FieldMeaning
guardThe guard's name
modeThe mode it ran in
decisionIts answer
errorWhat it threw, when it threw

Engine decision#

What POST /v1/auth/:app_id/agent/check returns, and what run.preview() returns.

FieldMeaning
decisionallow, deny, allow_with_step_up or allow_with_approval
allowedWhether it is a plain allow
reasonThe engine's reason code
permissionThe permission checked
rolesThe roles that granted it
conditionsConditions that applied
step_upmethod, ttl, authorizes_action
approvalpermission, resource
agentagent, task, chain, roles
explanationA sentence on why
sayA line for the person, when it is not a plain allow
dry_runtrue on a preview

Ruby preview returns it as an Authz::Decision.

Store#

MethodMeaning
get(key)The stored string, or null / None / nil
set(key, value, ttl)Store a JSON string; ttl in seconds, optional

TypeScript store methods return promises.

Verification#

Returned by startVerification, submitCode, verificationStatus: token, status (pending, completed, expired, denied, failed, cancelled), method, expires_at, remaining_attempts, error, say. Python and Ruby return it as a dict or hash with string keys.

Approval#

Returned by approvalStatus and filing: id (absent when nothing was filed), status (pending, approved, denied, cancelled, expired, used, not_needed, verify_first), details, permission, resource, expires_at, say.

Plan#

Returned by requestPlan and planStatus: id (absent when nothing needed approval), status (pending, approved, denied, cancelled, expired, used, not_needed), say, steps (each permission, resource, details, needs of none, approval or verify, and used).

Whoami#

See task tokens.

Errors#

LanguageErrorFields
TypeScriptScuteHarnessErrormessage, status, code, body (the API's answer)
Pythonscute.APIError (Scute answered with an error), scute.ConfigurationError, ValueErrorstatus, code, body on APIError
RubyScute::APIError, Scute::ConfigurationError, ArgumentErrorstatus, code, body on APIError

Codes the harness itself produces:

CodeStatusWhenPython / Ruby
no_credentials401A task has to be started or closed without SCUTE_SECRETConfigurationError when starting a task
task_closed409The run's task was closedAPIError with the same code
method_required422startVerification without any methodValueError / ArgumentError
no_challenge422submitCode, verificationStatus or completeVerification with no verification in progressValueError / ArgumentError
not_verified409completeVerification on a pending verification that is not doneAPIError with the same code

Codes from Scute that affect the run:

CodeStatusEffect
invalid_task_token401The token is missing, expired or revoked. Before expiry, or on a token run, the run closes.
outside_task403A verification named a permission the task does not cover
too_many_verifications429More than 5 verifications started by the task in an hour
invalid_method422Unknown verification method
step_not_permitted403A plan step the engine denies
not_permitted403An approval asked for a call the engine denies

Endpoints#

The harness calls these. Task endpoints use the app secret; agent endpoints use the task token as Authorization: Bearer.

EndpointCredentialUsed by
POST /v1/apps/:app_id/authz/agents/:agent/tasksApp secretStarting a task
POST /v1/apps/:app_id/authz/agents/:agent/tasks/:id/completeApp secretrun.complete()
POST /v1/apps/:app_id/authz/agents/:agent/tasks/:id/revokeApp secretrun.revoke()
GET /v1/auth/:app_id/agent/whoamiTask tokenrun.whoami(), allowedTools, prepareStep
POST /v1/auth/:app_id/agent/checkTask tokenpermissions, run.preview() (dry_run: true)
POST /v1/auth/:app_id/agent/sessionsTask tokenThe run's session
POST /v1/auth/:app_id/agent/sessions/:id/verifiedTask tokenrun.completeVerification(token)
POST /v1/auth/:app_id/agent/sessions/:id/endTask tokencomplete, revoke
POST /v1/auth/:app_id/agent/verificationsTask tokenrun.startVerification()
GET /v1/auth/:app_id/agent/verifications/:tokenTask tokenrun.verificationStatus()
POST /v1/auth/:app_id/agent/verifications/:token/codeTask tokenrun.submitCode()
POST /v1/auth/:app_id/agent/approvalsTask tokenReviewer requests
GET /v1/auth/:app_id/agent/approvals/:idTask tokenrun.approvalStatus()
POST /v1/auth/:app_id/agent/plansTask tokenrun.requestPlan()
GET /v1/auth/:app_id/agent/plans/:idTask tokenrun.planStatus()
POST /v1/auth/:app_id/agent/toolsTask tokenrun.reportTools()
POST /v1/auth/:app_id/agent/decoysTask tokendecoy
GET /v1/auth/:app_id/agent/properties/:nameTask tokenrun.property()
POST /v1/auth/:app_id/agent/properties/:name/signTask tokenrun.sign()

All requests and answers are JSON. The base URL is https://api.scute.io unless baseUrl (SCUTE_BASE_URL) says otherwise.