Skip to content

AI Glossary · Concepts

What is Structured Output?

Structured Output

Structured output constrains a language model's response to a specified format or schema, such as a JSON object with required fields. A matching structure helps software process the response; it does not establish that the values are correct.

Also known as: structured outputs

· Updated · Chain of Thought

AI Engineering

  • 1 explainer
  • 1 episode
  • 2 sources

Specify the shape you need

Anthropic’s documentation separates schema-constrained JSON responses from strict tool inputs. A structured answer and a tool request serve different purposes. Neither a well-shaped answer nor valid tool arguments prove that the task succeeded.

JSON Schema’s object reference distinguishes property definitions from required fields and rules for extra keys. Here is an illustrative schema for a fictional invoice extraction task, not a complete provider API request:

{
  "type": "object",
  "properties": {
    "currency": {"type": "string"},
    "amount": {"type": "number"}
  },
  "required": ["currency", "amount"],
  "additionalProperties": false
}

properties alone would not require either field. Here, required does, and additionalProperties: false rejects undeclared keys. A string is still allowed to contain an incorrect currency; this schema does not check the source document.

Validate values against the evidence

Invented source: an invoice states EUR 100. The object {"currency":"USD","amount":100} parses and satisfies the schema above, yet disagrees with the source. These hypothetical cases separate the checks:

CaseWhat to check
Missing currencyJSON may parse, but the required-field check fails.
USD 100Schema passes; the source comparison fails.
EUR 100Schema and this limited source comparison pass.

Keep syntax, schema and source-value errors separate when evaluating the system.

Handle incomplete and exceptional responses

Check the provider’s completion or stop status before treating the content as a completed object. The provider documentation lists refusals and token-limit interruptions among cases that may not match the requested schema. It also describes unsupported schema constraints and SDK transformations. Validate the actual response against your application contract; do not assume every JSON Schema feature is enforced during generation. Check the specific provider, model version and SDK you deploy.

Discussing tools for handling structured data inside an agent, Atindriyo Sanyal says, “tools that can help you parse JSON in a more deterministic manner.” (episode 11, 26:12).

The conversation concerns parsing and tool use, not a claim about a particular structured-output API. Instruction adherence covers following constraints, tool use covers calling application functions, and how AI agents use tools follows a model decision into an action.

Sources

  • Anthropic, Structured outputs — Distinguishes JSON outputs (the response format) from strict tool use (validated tool names and inputs), lists unsupported JSON Schema features and SDK schema transformations, and names refusal and max_tokens stops as cases where output may not match the schema; checked November 2, 2026.
  • JSON Schema: Objects — Explains properties, required fields and additionalProperties; declaring a property does not make it required; checked November 2, 2026.

Go deeper

From the conversation