> ## 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 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

<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 models used by this example:

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

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

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

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