Skip to main content
By default the agent’s answer is free-form text. Give it a schema and the 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 completed session whose answer is missing or doesn’t match raises AnswerValidationError with 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_format override is rejected: they set the same field.
  • Runs that end without reaching completed (an idle session that hasn’t answered, a failed one) skip validation; the answer passes through as-is, None / undefined when 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:
Parallel sessions count against your concurrency quota.

Next steps

Configure an agent

Set answer_format on the agent itself.

Parallelize work with subagents

Fan work out, then merge typed answers.
Last modified on September 11, 2026