Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
One change · claude-code

Get structured output from agents changed

agent-sdk/structured-outputs

Nearest release: v2.1.251, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+1added
Lines−8removed
From line 243 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits3to this page, all time

The whole hunk

from line 243, old and new numbered
/
lines
from line 243
243243 ```
244244</CodeGroup>
245245 
246**Benefits:**
247 
248* Full type inference (TypeScript) and type hints (Python)
249* Runtime validation with `safeParse()` or `model_validate()`
250* Better error messages
251* Composable, reusable schemas
252 
253246## Output format configuration
254247 
255248The `outputFormat` (TypeScript) or `output_format` (Python) option accepts an object with:
from line 383
390383| `success` | Output was generated and validated successfully |
391384| `error_max_structured_output_retries` | No valid output remained after multiple attempts (validation failures, or a model-fallback retraction with no successful retry) |
392385 
393A result can also end with subtype `success` but no `structured_output` value, for example when the run completes without the agent producing a structured output. Treat that case as a failure as well. The example below treats a result as successful only when the `subtype` is `success` and `structured_output` is present, and handles every other result as a failure:
386A result can also end with subtype `success` but no `structured_output` value, for example when the run completes without the agent producing a structured output. Treat that case as a failure as well. The troubleshooting entry [structured\_output is None but the result says success](/docs/en/agent-sdk/troubleshooting#structured_output-is-none-but-the-result-says-success) covers this case. The example below treats a result as successful only when the `subtype` is `success` and `structured_output` is present, and handles every other result as a failure:
394387 
395388<CodeGroup>
396389 ```typescript TypeScript theme={null}