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

# Azure AI Foundry Reasoning Model DeepSeek

> Use DeepSeek-R1 on Azure AI Foundry as the reasoning model behind a GPT-4o agent.

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

Demonstrates this reasoning cookbook example.
"""

import os

from agno.agent import Agent
from agno.models.azure import AzureAIFoundry


# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
    agent = Agent(
        model=AzureAIFoundry(id="gpt-4o"),
        reasoning=True,
        reasoning_model=AzureAIFoundry(
            id="DeepSeek-R1",
            azure_endpoint=os.getenv("AZURE_ENDPOINT"),
            api_key=os.getenv("AZURE_API_KEY"),
        ),
    )

    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 aiohttp azure-ai-inference
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export AZURE_API_KEY="your_azure_api_key_here"
      export AZURE_ENDPOINT="your_azure_endpoint_here"
      ```

      ```bash Windows theme={null}
      $Env:AZURE_API_KEY="your_azure_api_key_here"
      $Env:AZURE_ENDPOINT="your_azure_endpoint_here"
      ```
    </CodeGroup>
  </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/azure\_ai\_foundry/reasoning\_model\_deepseek.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/models/azure_ai_foundry/reasoning_model_deepseek.py)
