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}