Dry-run the Policies of an Agent version at one hook
POST /v1/agents/{agent_id}/versions/{version}/evaluate-policies
| Property | Value |
|---|---|
| Operation | evaluate_agent_version_policies |
| Group | Agent versions |
| Scope | policies:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Not 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 in | 1.47.0 |
| Phase 0 host | Served (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": {}
}'const response = await fetch(`${process.env.VOCAL_API}/v1/agents/agt_.../versions/1/evaluate-policies`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"hook": "on_call_start",
"context": {}
}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/agents/agt_.../versions/1/evaluate-policies",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"hook": "on_call_start",
"context": {},
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | AgentId | yes | The id of an Agent: agt_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
version | path | integer | yes | A version number, from 1. |
idempotency-key | header | string | no | A 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.
| Field | Type | Required | Description |
|---|---|---|---|
context | PolicyContextInput | yes | |
hook | HookPoint | yes | |
trace | boolean | no | Return each Policy's trace; false when omitted. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | AgentPoliciesEvaluateResult | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is AgentPoliciesEvaluateResult.
| Field | Type | Required | Description |
|---|---|---|---|
actions | array of PolicyAction | yes | The 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_id | AgentId | yes | |
elapsed_us | number | yes | The evaluation time in microseconds, as the engine measured it (a measurement of this run, never a budget). |
engine_version | string | yes | |
hook | HookPoint | yes | |
object | "agent_policies_evaluation" | yes | |
policies | array of AgentPolicyEvaluation | yes | Every Policy of the hook, at most 50 (a target), in evaluation order. |
terminal_policy_id | PolicyId or null | yes | The Policy whose terminal action won the hook, or null. |
version | integer | yes | The Agent version. |