Code

cookbook/reasoning/models/azure_ai_foundry/reasoning_model_deepseek.py
import os

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

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,
)

Usage

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.

python3 -m venv .venv
source .venv/bin/activate
2

Set your API key

export AZURE_API_KEY=xxx
export AZURE_ENDPOINT=xxx
3

Install libraries

pip install -U azure-ai-inference agno
4

Run Agent

python cookbook/reasoning/models/azure_ai_foundry/reasoning_model_deepseek.py