Basic Reasoning Agent
Give an agent explicit planning and analysis tools during its ordinary tool loop.
ReasoningTools gives a tool-capable model explicit planning and analysis tools. The model chooses when to call them; this does not guarantee historical accuracy or replace source retrieval.
Add the following code to your Python file
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.reasoning import ReasoningTools
task = (
"Analyze the key factors that led to the signing of the Treaty of Versailles in 1919. "
"Discuss the political, economic, and social impacts of the treaty on Germany and how it "
"contributed to the onset of World War II. Provide a nuanced assessment that includes "
"multiple historical perspectives."
)
reasoning_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[ReasoningTools(add_instructions=True)],
markdown=True,
)
reasoning_agent.print_response(task, stream=True, show_full_reasoning=True)Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U openai agnoExport your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"Run Agent
python basic_cot.py