Structured Output
Constraining an AI model to return responses in a specific format — JSON, XML, or a predefined schema — making outputs reliably parseable by downstream systems.
Structured output is constraining a model to return machine-readable data — JSON, XML, a predefined schema — instead of freeform prose. It's the difference between an impressive demo and a working integration.
Models are trained to produce plausible text, not valid data structures. Ask for JSON and you'll usually get something close. "Usually" and "close" are what break production pipelines. A missing comma or a hallucinated field is just as fatal as a 500 error. In practice, "mostly works" is the same as "doesn't work."
Modern providers enforce structure at the generation layer. OpenAI's Structured Outputs use constrained decoding to guarantee schema compliance. Anthropic and others expose similar guarantees through tool use and function calling, where the schema is the contract. Libraries like Instructor add a validation layer on top, returning typed objects rather than raw strings.
For any machine intelligence feature that writes to a downstream system — CRM updates, database writes, workflow triggers, report generation — structured output is not optional. It's what makes guardrails enforceable and prompt engineering testable. Without it, you're shipping a system whose correctness you cannot verify programmatically. That's a bad place to be.