Structured Outputs
Making a model return data in a declared schema — JSON that validates against a Pydantic or Zod model — so downstream code consumes typed fields instead of parsing prose.
Production AI is a system: context, tools, permissions, traces, evals, and feedback loops around the model.
What it is
Structured outputs constrain a model's response to a schema you declare, usually expressed as JSON Schema via a Pydantic model in Python or a Zod schema in TypeScript. Providers support it natively — OpenAI's structured outputs constrain decoding to the schema; Anthropic reaches the same guarantee through tool-based extraction — and frameworks add validation with automatic retry on failure.
Why it matters
Extraction, classification, and routing decisions only compose into pipelines when their outputs are machine-readable contracts. Schema-validated output is the difference between a demo that regex-parses model text and a workflow that runs unattended.
How we build it
Response schemas are Pydantic models on the Python side and Zod schemas at the TypeScript edges. Output validators reject a bad response and re-prompt the model with the specific validation error, and eval suites assert schema validity as its own check, separate from content quality.
Related resources
The Python library for defining data schemas as typed models with runtime validation — the layer that turns model output from 'probably JSON' into objects your code can trust.
Every tool an agent uses comes with a precise, versioned form describing exactly what goes in and what comes out — so nothing changes shape quietly and breaks your workflows.
The mechanism by which a language model invokes external functions — APIs, databases, code execution, retrieval — and reads the results back to continue its work.
Short for 'evaluations' — the test cases and harness that measure whether an AI workflow is working, before and after every change.