🧩outputFormat Option
Also known as output_format, Agent SDK structured output, Claude Agent SDK outputFormat
The option that makes the agent end with JSON in a shape you pick.
Think of it like
It is like a form to fill in, not a blank page.
Example
Mia's agent searches the web for recipes. With outputFormat, each result comes back as an object with a title, a time and a list of steps.
Why it matters
Code can use typed data at once. Free text has to be parsed, and parsing breaks.
Definition
Example code
typescript
outputFormat: {
type: "json_schema",
schema: { type: "object", properties: { title: { type: "string" } } },
}Common mistake
Key takeaways
- 1Your JSON shape. A schema.
- 2Tools still allowed. On the way.
- 3Read structured_output. On success.