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

# Ollama Reasoning Model DeepSeek

> Pair a local Llama 3.2 agent with DeepSeek-R1 on Ollama as its reasoning model.

```python reasoning_model_deepseek.py theme={null}
"""
Reasoning Model Deepseek
========================

Demonstrates this reasoning cookbook example.
"""

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


# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
    agent = Agent(
        model=Ollama(id="llama3.2:latest"),
        reasoning_model=Ollama(id="deepseek-r1:14b", options={"num_predict": 4096}),
    )
    agent.print_response(
        "Solve the trolley problem. Evaluate multiple ethical frameworks. "
        "Include an ASCII diagram of your solution.",
        stream=True,
    )


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run_example()
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno ollama
```

**2. Prepare Ollama**

Install and start Ollama, then pull the models used by this example:

```bash theme={null}
ollama pull deepseek-r1:14b
ollama pull llama3.2:latest
```

**3. Run the example**

Save the code above as `reasoning_model_deepseek.py`, then run:

```bash theme={null}
python reasoning_model_deepseek.py
```

Full source: [cookbook/10\_reasoning/models/ollama/reasoning\_model\_deepseek.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/10_reasoning/models/ollama/reasoning_model_deepseek.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.