This page works best after Examples: Sessions. Start there if you have not already seen the basic create/turn/result flow.
Basic extraction
Provide anoutput_schema and the agent will extract validated JSON after the agentic loop completes.
- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
- Rust
Next step
Schema from file
The CLI can load a schema from a JSON file instead of inline.name, strict, compat, and format fields.
Retries
When validation fails, the agent retries the extraction turn with error feedback. The default is 2 retries (3 total attempts).- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
- Rust
Compatibility mode
Schemas are normalized across providers. Thecompat setting controls how unsupported JSON Schema features are handled during provider-specific lowering.
| Mode | Behavior |
|---|---|
lossy | Best-effort lowering; unsupported features are dropped with warnings |
strict | Reject schemas with unsupported features for the target provider |
schema_warnings. The same schema works with Anthropic, OpenAI, and Gemini — provider-specific lowering is handled transparently.
Read the result
The structured output appears in the response alongside the raw text.- CLI
- JSON-RPC
- REST
- MCP
- Python
- TypeScript
- Rust
