Reasoning
Reasoning is an experimental feature that enables an Agent
to think through a problem step-by-step before jumping into a response. The Agent works through different ideas, validating and correcting as needed. Once it reaches a final answer, it will validate and provide a response. Let’s give it a try. Create a file reasoning_agent.py
Run the Reasoning Agent:
Agno Agents can leverage specialized reasoning models alongside the primary Agent model. These models are dedicated to reasoning rather than handling the main Agent tasks. Their responses are appended as messages to the Agent, integrating into the message history sent to the primary Agent model.
Currently, Groq and DeepSeek models are supported for external reasoning. Below is an example Agent
that uses a Groq
model for reasoning but uses the OpenAI
model for the main Agent
.
Run the Reasoning Agent:
How to use reasoning
To add reasoning, set reasoning=True
or set reasoning_model
to a supported reasoning model. If you do not set reasoning_model
, the primary Agent
model will be used for reasoning.
Reasoning with tools
You can also use tools with a reasoning agent. Lets create a finance agent that can reason.
Run the script to see the output.
More reasoning examples
Logical puzzles
Run the script to see the output.
Mathematical proofs
Run the script to see the output.
Scientific research
Run the script to see the output.
Ethical dilemma
Run the script to see the output.
Planning an itinerary
Run the script to see the output.
Creative writing
Run the script to see the output.
Developer Resources
- View Cookbook