Agent Completion output_schema: fail a CI build when it is invalid
Bind output_schema to a Sume Agent Completion and gate CI on the receipt: status completed, output present, output_error empty. Strict schema rules explained.

Bind a strict output_schema to an Agent Completion and your CI job can treat the receipt like a typed API response: pass only if status is completed, output is an object, and output_error is empty. A schema outside the strict subset is rejected before any run starts, so a bad schema fails the build in seconds instead of after a paid run. The contract is shared with Format and schedule runs.
What the docs say
The Agent Completions page lists output_schema and primary_output_key as optional fields and says the contract is the same as Action runs. The API-trigger page documents an output_schema shape of name, strict and schema, and the error output_schema_invalid with details.violations, each with a path, a rule and a message. Its example violation is required_completeness: every property must be listed in required, and optional values use a nullable type.
A schema that passes
The shape below follows the documented example: an object, additionalProperties: false, every property required, optional values nullable.
{
"instruction": "Write a one-line caption for the attached product shot.",
"generation_spend_cap_usd": 1,
"output_schema": {
"name": "ci/caption/v1",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["caption", "alt_text"],
"properties": {
"caption": {"type": "string"},
"alt_text": {"type": ["string", "null"]}
}
}
}
}The CI gate
The Structured output page explains the failure modes. A run can finish its work and still fail to project into your schema; then output is null and output_error says why. Depending on the surface, that run may read as completed or failed, so a gate that reads only status is not enough. Check all three, and log output_error when it is set.
| Check | Fails when | Likely cause |
|---|---|---|
HTTP 400 output_schema_invalid at create | Schema outside the strict subset | Optional property missing from required |
status is not completed | Run failed or was canceled | Read the receipt's error |
output is null | Projection did not produce an object | Schema asks for something the run never made |
output_error is set | Gate rejected the object | Read the message, fix schema or task |
Keep schemas honest
Require only what the task makes. The docs warn that a schema demanding a field the recipe never produces fails on the projection path every time, silently until you read output_error. Keep your own identifiers on your side keyed by run id or idempotency key, because the projection step does not see your input.
Pin the schema name with a version, as in ci/caption/v1, and change the name when you change the shape. The receipt echoes the name verbatim, which makes it a handy label in test output.
Use a dedicated CI key from the dashboard, with agent_completions:write and agent_completions:read, as described on Authentication.
Sources
Related posts
More in Developers
- Agent Completions 403 insufficient_scope: an older key needs replacing
POST /v1/agent/completions returns 403 insufficient_scope for a key that predates Agent Completions or a service-account key. How to tell which and replace it.
- Cancel an Agent Completion at a deadline: Python poll loop
A Python loop that starts a Sume Agent Completion, polls status_url until next_action stops saying poll_status, and cancels at a deadline.
- Lazy-load placeholder for an AI image: average color from Sume
Compute the average color of a generated image with Pillow, use it as the background of the image box and avoid a white flash while the real file loads.
- Prompt length limits across Firefly and Sume
Adobe Firefly now takes longer prompts for Image and Video on the web. Sume documents a 5000-character cap for music and no stated cap elsewhere.
Written by Sume