structured output
Structured output is an AI response that is not free text but data in a predefined, fixed format, allowing another program to process it directly.
In plain terms
If you ask someone to tell you about their shopping yesterday, everyone phrases it differently. If, however, you hand them a form with fields for 'store name', 'date', and 'total amount', you always receive the data in the same format. Structured output gives this form to the language model.
This is necessary because the language model's response is often read not by a human but by another program, such as an invoicing system, calendar, or database. Programs cannot deal with sentences starting with 'Of course, here are the requested data!' They expect data in precisely defined fields of a specific type.
The plain answer is for humans, while structured output is for machines. This is what turns conversational AI into a reliable component that can be built into larger systems. Agents work in a similar way: when an agent uses a tool, it passes on, in a structured format, what it is requesting and with what data.
How it works
- The developer provides a schema, or an empty form: which fields should be present, whether number, text, date or list, and which are mandatory. This is most often a description in JSON format.
- The model receives the schema alongside the question and writes the answer accordingly.
- In stricter solutions, the system allows only continuations that fit the schema at every step while writing. Thus, the model cannot step outside the format, for example, it cannot omit a closing parenthesis.
- The receiving program checks the final answer against the schema and may request a new one if it is incorrect or incomplete.
- The data finally proceeds to the next step without human intervention: into a table, a database, or the next operation of an agent.
An everyday example
You photograph a restaurant bill with your phone, and the expense-tracking app automatically fills in the "location", "date", "amount", and "category" fields. Behind the scenes, a vision-capable language model may be working, extracting data from the photo, inferring the category based on content, and returning all this as structured output. This is why the app can immediately place everything in the correct category.
Who is affected
A common misconception
Limits and risks
- Correct formatting does not mean correct content: well-formatted data can still be a hallucination.
- If the schema makes a field mandatory, the model still writes something even if the source lacks such data, so it is advisable to allow the 'no data' option.
- An overly complex or poorly designed schema can reduce response quality, and not every provider supports all elements of schemas.
- If the response is cut off due to length limits, the data may be truncated and unusable, so the receiving program must handle this case.
Similar, but not the same
- JSON mode – JSON mode only promises that the response will be valid JSON; structured output also ensures it contains exactly the specified fields and data types.
- tool calling – In tool calling, the model requests the launch of an external function in structured form; in structured output, the final response itself is bound to a specific format.
- prompt writing – In a prompt, you simply ask the model to follow a format. In solutions with strict structured output, the system technically enforces this.
Related concepts
JSON schema, constrained decoding
JSON mode, tool calling, AI-agent, prompt, hallucination, data extraction
A brief history
Initially, developers could only ask the model to comply with the format in the prompt, which often resulted in incorrect output. In 2023, open-source tools (such as the grammars of llama.cpp and the Outlines library) already enforced the format during text generation. OpenAI introduced JSON mode in November 2023, and in August 2024, the Structured Outputs feature that guarantees adherence to the schema. Other major providers, such as Google and Anthropic, also offer similar solutions.
Where things stand
By the end of 2026, most large model providers and open-source runtime environments offer this as a basic feature. It has become a fundamental building block of agent-based systems and business automation.
Also known as
structured output · structured response · structured output · structured outputs
Sources
- OpenAI: Introducing Structured Outputs in the API (2024)
- JSON Schema – hivatalos oldal
- Wikipedia: JSON
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.