VocalDocscontracts 1.65.0

Dry-run an Agent version's machine over scripted events

POST /v1/agents/{agent_id}/versions/{version}/machine/dry-run

PropertyValue
Operationdry_run_agent_version_machine
GroupAgent versions
Scopeagents:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditNot audited: A dry run: it changes no state and reads no Call content, so it writes no Audit event (ADR 0012, statecharts-and-squads.md 9.3).
Released in1.58.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Runs the TypeScript interpreter over the version's compiled machine, the implicit machine for a version without one, and the scripted events of the body, and answers each step's value, effects, records, guard outcomes and state hook dispatches with the final value (1.58.0). Guards are evaluated by the rules engine against each step's context; no Policy is evaluated, so a veto is scripted. It writes nothing: no Call event, Audit event or Usage event. A body whose events the version cannot take is 422 validation_failed, and from 1.60.0 so is a version whose machine is a Workflow, with the detail machine_is_workflow (MachineDryRunIssueCode): its dry run is test_workflow.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the agents:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/agents/agt_.../versions/1/machine/dry-run" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "type": "decision.verdict"
      }
    ]
  }'

Parameters

NameInTypeRequiredDescription
agent_idpathAgentIdyesThe id of an Agent: agt_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
versionpathintegeryesA version number, from 1.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: MachineDryRunRequest.

FieldTypeRequiredDescription
eventsarray of MachineDryRunEventInputyes
slotsmap of anynoSlot values at the start, over the declared defaults.
variablesmap of CallEventValuenoThe variables root at the start; the declared defaults when omitted.

Responses

StatusContent typeShapeError codes
200application/jsonMachineDryRunResult
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is MachineDryRunResult.

FieldTypeRequiredDescription
agent_idAgentIdyes
agent_versionintegeryes
finalMachineStateyes
object"machine_dry_run"yes
sourceone of "implicit", "authored"yes
stepsarray of MachineDryRunStepyes