reasoning=True makes the agent reason through the task before returning its response.
1
Add the following code to your Python file
basic_cot.py
2
Set up your virtual environment
3
Install dependencies
4
Export your OpenAI API key
5
Run Agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Equip agents with chain-of-thought reasoning capabilities.
reasoning=True makes the agent reason through the task before returning its response.
Add the following code to your Python file
from agno.agent import Agent
from agno.models.openai import OpenAIChat
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"),
reasoning=True, # The Agent will be able to reason.
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/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U openai agno
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run Agent
python basic_cot.py
Was this page helpful?