Basic Reasoning
Run a separate native OpenAI reasoning stage before the main response and display available reasoning output.
Demonstrates basic reasoning with an explicit reasoning model.
"""
Basic Reasoning
=============================
Demonstrates basic reasoning with an explicit reasoning model.
"""
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
reasoning_agent = Agent(
name="Reasoning Agent",
model=OpenAIResponses(id="gpt-5.6"),
reasoning_model=OpenAIResponses(id="o3-mini"),
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
reasoning_agent.print_response(
"A bat and ball cost $1.10 total. The bat costs $1.00 more than the ball."
" How much does the ball cost?",
stream=True,
show_full_reasoning=True,
)An explicit reasoning_model runs as a separate, tool-free reasoning stage before the main model response. show_full_reasoning=True displays the reasoning data Agno receives; it cannot reveal a provider's private internal trace. Some adapters use the reasoning stage's answer text when separate reasoning content is unavailable. A failed reasoning stage can still be followed by a main-model answer, so a completed run alone does not prove the reasoning stage succeeded.
OpenAI schedules o3-mini and o4-mini for shutdown on October 23, 2026. The provider lifecycle notice lists their replacements. Check the selected replacement's reasoning and service-tier support before changing the source model ID.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openaiExport your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the code above as basic_reasoning.py, then run:
python basic_reasoning.pyFull source: cookbook/02_agents/13_reasoning/basic_reasoning.py