Run conversation tests against an Agent version
POST /v1/agents/{agent_id}/versions/{version}/tests
| Property | Value |
|---|---|
| Operation | run_agent_version_tests |
| Group | Agent versions |
| Scope | prompts:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited agent.version.test (mutation) |
| Released in | 1.55.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Runs the scripted scenarios of a suite of the Agent, or inline tests, against the Agent version as test Calls with purpose: "evaluation" on the headless Engine, each repeated as asked, as an agent.conversation_test job, and answers 202 with the run queued, its job_id and its Location (1.55.0). Nothing is judged by a model: an expectation is met or not by the recorded facts. A retired version is 409 agent_version_unavailable. Until a dedicated evaluation quota exists the Calls count against the daily allowance of test Calls (429 test_daily_cap_reached); from 1.63.0 they count against both, the evaluation quota refusing with 429 evaluation_quota_reached. Until the headless Engine runs evaluation Calls the request is refused with 422 capability_not_available and the detail evaluation_engine_not_available. The report is never a publish gate in 1.55.0; from 1.63.0 a run of a suite that defines a gate carries its outcome (gate), which an activation of the version reads once the owner of the Agent names the suite.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the prompts: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/tests" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/agents/agt_.../versions/1/tests`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
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/tests",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={},
)
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: ConversationTestRunRequest.
| Field | Type | Required | Description |
|---|---|---|---|
repetitions | integer | no | The suite's repetitions, or 5 for inline tests, when omitted. |
suite_id | PromptEvalSuiteId | no | Runs the scripted scenarios of this suite of the Agent. |
tests | array of ConversationTestInput | no |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
202 | application/json | ConversationTestRun | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | prompt_eval_suite_archived, agent_version_unavailable, idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed, capability_not_available |
429 | application/json | ErrorEnvelope | test_daily_cap_reached, evaluation_quota_reached, rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 202 answer
The shape is ConversationTestRun.
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | AgentId | yes | |
agent_version | integer | yes | |
cost_lines | array of PromptEvalCostLine | yes | |
created_at | Timestamp | yes | |
created_by | ActorRef | yes | |
error_code | string or null | yes | |
finished_at | Timestamp or null | yes | |
gate | PromptEvalGateOutcome or null | no | How the run fares against its suite's publish gate (1.63.0), once completed; null for inline tests, for a suite with no gate and before completion. Absent from an api before 1.63.0. |
id | PromptEvalRunId | yes | |
job_id | JobId | yes | The agent.conversation_test job that runs it. |
object | "conversation_test_run" | yes | |
repetitions | integer | yes | |
started_at | Timestamp or null | yes | |
status | PromptEvalRunStatus | yes | |
suite_id | PromptEvalSuiteId or null | yes | Null for inline tests. |
summary | ConversationTestSummary or null | yes | Null until completed. |
tests | array of ConversationTestReport | yes | One report per test, in the order of the suite or the request; empty until run. |