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

# Ollama Demo DeepSeek R1

> Ask a local DeepSeek-R1 model to write Python for quadratic equations and explain its reasoning.

```python demo_deepseek_r1.py theme={null}
"""
Ollama Demo Deepseek R1
=======================

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

from agno.agent import Agent, RunOutput  # noqa
from agno.models.ollama import Ollama

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

agent = Agent(model=Ollama(id="deepseek-r1:14b"), markdown=True)

# Print the response in the terminal
agent.print_response(
    "Write me python code to solve quadratic equations. Explain your reasoning."
)

# ---------------------------------------------------------------------------
# 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 deepseek-r1:14b
    ```
  </Step>

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

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

Full source: [cookbook/90\_models/ollama/chat/demo\_deepseek\_r1.py](https://github.com/agno-agi/agno/blob/main/cookbook/90_models/ollama/chat/demo_deepseek_r1.py)
