Run a decision corpus against the pinned Provider
POST /v1/agents/{agent_id}/decision-corpora/{corpus_id}/runs
| Property | Value |
|---|---|
| Operation | create_decision_run |
| Group | Decision corpora |
| Scope | agents:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited decision_run.create (mutation) |
| Released in | 1.58.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Sends the corpus to the Provider and model version the Agent's active version pins for the corpus's question set, as a decision.run job, and answers 202 with the run queued, its job_id and its Location (1.58.0). A run while another is queued or running answers 409 decision_run_in_progress; an Agent whose active version has no lane or not this set is decision_run_no_lane; an empty corpus is decision_corpus_empty. Metered as decision_request like any decision request, on the run (usage, 1.59.0) since a run has no Call and writes no Usage event; the job emits job.succeeded or job.failed, and the run, completed or failed, decision_run.completed (1.59.0 states the failed one).
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_.../decision-corpora/dcp_.../runs" \
-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_.../decision-corpora/dcp_.../runs`, {
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_.../decision-corpora/dcp_.../runs",
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. |
corpus_id | path | DecisionCorpusId | yes | The id of a decision corpus: dcp_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
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: DecisionRunRequest.
| Field | Type | Required | Description |
|---|---|---|---|
precision_target | number | no | The precision a proposed threshold must meet, 0.9 when omitted (a target). |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
202 | application/json | DecisionRun | |
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 | decision_corpus_archived, decision_run_in_progress, 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 202 answer
The shape is DecisionRun.
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | AgentId | yes | |
agent_version | integer | yes | The active version whose chain ran. |
cases | integer | yes | The cases sent. |
completed_at | Timestamp or null | yes | |
corpus_id | DecisionCorpusId | yes | |
corpus_version | integer | yes | |
created_at | Timestamp | yes | |
created_by | ActorRef | yes | |
error_code | string or null | yes | Why a failed run failed, such as provider_unavailable; null otherwise. |
id | DecisionRunId | yes | |
job_id | JobId | yes | |
model_version | string | yes | |
object | "decision_run" | yes | |
precision_target | number | yes | The precision a proposed threshold must meet, 0.9 when omitted (a target). |
provider | ProviderId | yes | |
question_set | QuestionSetKey | yes | |
results | array of DecisionQuestionResult | yes | Per question, once completed; empty before. |
status | DecisionRunStatus | yes | |
usage | DecisionRunUsage or null | no | What the run used (1.59.0), once its result landed, completed or failed; null while it is queued or running. Absent from an api before 1.59.0, which a reader treats as null. |