> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ollama Reasoning Agent

> Enable reasoning on a local gpt-oss 120B agent and display the thinking steps.

```python reasoning_agent.py theme={null}
"""
Ollama Reasoning Agent
======================

Cookbook example for `ollama/chat/reasoning_agent.py`.
"""

from agno.agent import Agent
from agno.models.ollama import Ollama

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

reasoning_agent = Agent(
    model=Ollama(id="gpt-oss:120b"),
    reasoning=True,
    debug_mode=True,
)

reasoning_agent.print_response(
    "How many r are in the word 'strawberry'?", show_reasoning=True
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno ollama
    ```
  </Step>

  <Step title="Prepare Ollama">
    Install and start Ollama, then pull the model used by this example:

    ```bash theme={null}
    ollama pull gpt-oss:120b
    ```
  </Step>

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

    ```bash theme={null}
    python reasoning_agent.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/ollama/chat/reasoning\_agent.py](https://github.com/agno-agi/agno/blob/main/cookbook/90_models/ollama/chat/reasoning_agent.py)
