Skip to content

Structured Outputs (Moved)

Structured output returns a typed object from the model. Pick the page for the shape you need:

  • Overview: what structured output is, which schema libraries work, provider support, and which page to read.
  • One-Shot Extraction: one prompt in, one typed object out. Use it when you do not need streaming or chat history.
  • Streaming UIs: useChat({ outputSchema }) fills a UI field by field with partial and final.
  • Multi-Turn Chat: each completed run adds a typed response to the message history. The data of its structured-output part has the type of your schema.
  • With Tools: use outputSchema with the agent loop, including server-tool approvals and client tools.

Need a coding agent in a sandbox that reads files and then returns a typed object? See Harness Agents.