output_schema to constrain the agent’s final answer to a typed shape. The SDK validates the model’s output against the schema and returns a fully typed object.
Pydantic / Zod
Other schema sources
Both SDKs accept raw JSON Schema. Python additionally accepts dataclasses andTypedDict. TypeScript accepts any Standard Schema implementation (Valibot, ArkType, etc.).
Python
Without a schema
Omitoutput_schema and the agent returns a string in result.output.