Dry-run the composed request of an Agent version
POST /v1/agents/{agent_id}/versions/{version}/render
| Property | Value |
|---|---|
| Operation | render_agent_version_prompt |
| Group | Agent versions |
| Scope | prompts:read |
| Route class | read |
| 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, prompt-manager.md section 7). |
| Released in | 1.55.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Composes the request the Agent version sends for one model request, in the order of agent-runtime.md section 3.2: the platform base it tracks or pins, the Organization layer it receives, its Agent layer (its template or its inline instructions), then the synthetic directive and context entries of the body, and answers every section with its token estimate, the stable prefix, the names of missing values and the lint cross-checks of its publish (1.55.0). It writes nothing: no Call, Audit or Usage event.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the prompts:read 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/render" \
-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/render`, {
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/render",
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: AgentPromptRenderRequest.
| Field | Type | Required | Description |
|---|---|---|---|
call | PromptRenderCallInput | no | |
constants | map of PromptConstantValue | no | Organization constants for this render; those of the Organization layer the render resolves when omitted. display_name is the Organization name. |
context | array of PromptContextEntryInput | no | |
directive | string | no | A synthetic directive slot, as rewrite_instruction would set it. |
retrieval | map of boolean | no | Whether each Knowledge binding returned passages for this request, by handle: true renders the first branch of its retrieval slot, false or absent the second. |
slots | map of PromptSlotValue | no | Synthetic slot values; an unset slot renders empty or its default(). |
state | string | no | The active state, the state root. |
time_now | RequestTimestamp | no | The time.now root; the request instant when omitted. |
variables | map of VariableValue | no | Synthetic values of the declared variables. A value of an undeclared name is variable_unknown, of the wrong type variable_type; an optional variable without a value renders empty and is named in missing_values. |
variant | PromptVariantKey | no | The variant to compose; the model family of the version's primary model when omitted, which is default until the llm descriptors name their model family. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | PromptRenderResult | |
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 PromptRenderResult.
| Field | Type | Required | Description |
|---|---|---|---|
lint | array of PromptLintFinding | yes | The lint findings of what was rendered: the stored findings of a version, those of the draft, and for an Agent version the cross-checks of its publish. |
missing_values | array of PromptValuePath | yes | The paths that rendered empty for want of a value, such as variables.clinician_name (missing_value); names only, never a value. |
object | "prompt_render" | yes | |
sections | array of PromptRenderSection | yes | In composition order. |
stable_prefix_tokens | integer | yes | The tokens before the first per-Call or per-Turn value, which a Provider that caches prompts may reuse between requests (prompt-manager.md section 4). |
total_tokens | integer | yes | |
variant | PromptVariantKey | yes |