VocalDocscontracts 1.65.0

Dry-run the Policies of an Agent version at one hook

POST /v1/agents/{agent_id}/versions/{version}/evaluate-policies

PropertyValue
Operationevaluate_agent_version_policies
GroupAgent versions
Scopepolicies: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, orchestration-layer.md 3.12).
Released in1.47.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Evaluates every Policy at one hook of the Agent version's resolved set (its pinned Policy versions and the Organization's active, enabled organization-scoped ones) against the synthetic context of the body, in the order and with the conflict resolution of orchestration-layer.md section 3.8, so an author can ask what happens at before_speak if the Agent says a sentence before a caller does (1.47.0). It writes nothing: no Call event, Audit event or Usage event.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the policies: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/evaluate-policies" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "hook": "on_call_start",
    "context": {}
  }'

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: AgentPoliciesEvaluateRequest.

FieldTypeRequiredDescription
contextPolicyContextInputyes
hookHookPointyes
tracebooleannoReturn each Policy's trace; false when omitted.

Responses

StatusContent typeShapeError codes
200application/jsonAgentPoliciesEvaluateResult
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 AgentPoliciesEvaluateResult.

FieldTypeRequiredDescription
actionsarray of PolicyActionyesThe matched actions that apply after conflict resolution, in evaluation order. A Policy that applies by failing closed has no parameters and is named in policies only.
agent_idAgentIdyes
elapsed_usnumberyesThe evaluation time in microseconds, as the engine measured it (a measurement of this run, never a budget).
engine_versionstringyes
hookHookPointyes
object"agent_policies_evaluation"yes
policiesarray of AgentPolicyEvaluationyesEvery Policy of the hook, at most 50 (a target), in evaluation order.
terminal_policy_idPolicyId or nullyesThe Policy whose terminal action won the hook, or null.
versionintegeryesThe Agent version.