← All notes

Set an output type when you need structured agent results

Answer: By default, agents produce plain text outputs. Use the output_type parameter for a particular type. Structured output asks models to adhere to a supplied JSON Schema.

Why it matters

By default, agents produce plain text outputs. Structured output is a feature supported by some model providers. You can use the output_type parameter.

A common choice is to use Pydantic objects. Models generate responses which adhere to a supplied JSON Schema. Dataclasses, lists, and TypedDict can also be wrapped.

When you pass an output_type, that tells the model to use structured outputs. You should therefore test the use of structured output. Specifying a JSON schema can introduce unknown effects on model task performance.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK agents.md (MIT); Inspect AI structured output docs (MIT). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK agents.md (MIT); Inspect AI structured output docs (MIT). Text was condensed and changed from the originals.

Cite this

Permanent ID: iil:note:q9qsann5

iinventedlight. 2026. "Set an output type when you need structured agent results." iinventedlight Library, iil:note:q9qsann5, version of 2026-11-22. https://iinventedlight.com/library/notes/agents-sdk-output-types/. License: CC-BY-4.0.

@misc{iil_note_q9qsann5,
  author = {{iinventedlight}},
  title = {{Set an output type when you need structured agent results}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-22},
  url = {https://iinventedlight.com/library/notes/agents-sdk-output-types/},
  note = {Permanent ID iil:note:q9qsann5. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/agents-sdk-output-types.md.