reasoning=True
.
When an Agent with reasoning=True
is given a task, a separate “Reasoning Agent” first solves the problem using chain-of-thought. At each step, it calls tools to gather information, validate results, and iterate until it reaches a final answer. Once the Reasoning Agent has a final answer, it hands the results back to the original Agent to validate and provide a response.
reasoning=True
or set the reasoning_model
to a model that supports structured outputs. If you do not set reasoning_model
, the primary Agent
model will be used for reasoning.
reasoning_model
must be able to handle structured outputs, this includes models like gpt-4o and claude-3-7-sonnet that support structured outputs natively or gemini models that support structured outputs using JSON mode.
reasoning_model
to a model that supports native Reasoning like o3-mini or deepseek-r1, the reasoning model will be used to reason and the primary Agent
model will be used to respond. See Reasoning Models + Response Models for more information.