answer you read from changes becomes a JSON object that conforms to it.
With the SDK schema, the SDK derives the JSON Schema and parses the final answer for you. Rules:
- A
completedsession whose answer is missing or doesn’t match raisesAnswerValidationErrorwith the raw payload attached. - The raw wire value always stays on
final_changes/finalChanges, next to the parsed answer. - Passing both a schema and an
agent.answer_formatoverride is rejected: they set the same field. - Runs that end without reaching
completed(anidlesession that hasn’t answered, a failed one) skip validation; the answer passes through as-is,None/undefinedwhen absent.
See it in action
Describe the data you want and the shape you want it in; the agent browses and hands back exactly that.Chaining agents
With a typed answer, an agent behaves like any other function: call it, get data back, build on it. Here one agent gathers sources and others read them in parallel:Next steps
Configure an agent
Set
answer_format on the agent itself.Parallelize work with subagents
Fan work out, then merge typed answers.