# Basic Reasoning (/examples/agents/reasoning/basic-reasoning)



Demonstrates basic reasoning with an explicit reasoning model.

```python title="basic_reasoning.py"
"""
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,
    )
```

<Note>
  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.
</Note>

<Note>
  OpenAI schedules `o3-mini` and `o4-mini` for shutdown on October 23, 2026. The [provider lifecycle notice](https://developers.openai.com/api/docs/deprecations) lists their replacements. Check the selected replacement's reasoning and service-tier support before changing the source model ID.
</Note>

## Run the Example [#run-the-example]

<Steps>
    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Install dependencies">
    ```bash
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeBlockTabs defaultValue="Mac/Linux">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Mac/Linux">
          Mac/Linux
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Windows">
          Windows
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Mac/Linux">
        ```bash
        export OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Windows">
        ```bash
        $Env:OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </Step>

  <Step title="Run the example">
    Save the code above as `basic_reasoning.py`, then run:

    ```bash
    python basic_reasoning.py
    ```
  </Step>
</Steps>

Full source: [cookbook/02\_agents/13\_reasoning/basic\_reasoning.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/02_agents/13_reasoning/basic_reasoning.py)
