Azure AI Foundry Reasoning Model DeepSeek

Historical Foundry DeepSeek-R1 recipe with a current Azure OpenAI reasoning alternative.

reasoning_model_deepseek.py
"""
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-5.6-luna"),
        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 a current alternative

The archived program uses DeepSeek-R1 on Foundry, which Microsoft retired on August 13, 2026. Its azure-ai-inference SDK was retired on August 26, 2026. A new integration needs a current model and adapter.

This alternative uses two Azure OpenAI deployments and Agno's native reasoning support. Deploy GPT-5.2 for reasoning and GPT-5.6 Luna for the final answer in the same resource, using Azure deployment setup. Save this as azure_reasoning.py and replace the two deployment-name placeholders:

azure_reasoning.py
import asyncio

from agno.agent import Agent
from agno.models.azure.openai_chat import AzureOpenAI


async def main() -> None:
    agent = Agent(
        model=AzureOpenAI(
            id="gpt-5.6-luna",
            azure_deployment="your-answer-deployment",
        ),
        reasoning_model=AzureOpenAI(
            id="gpt-5.2",
            azure_deployment="your-reasoning-deployment",
        ),
    )
    await agent.aprint_response(
        "What is 25 * 37? Explain your answer.",
        stream=True,
        stream_events=True,
        show_full_reasoning=True,
    )


if __name__ == "__main__":
    asyncio.run(main())

Install uv pip install "agno[openai]" in an activated Python environment, then configure the Azure resource:

export AZURE_OPENAI_API_KEY="your_resource_key"
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"

Run python azure_reasoning.py. Both model calls now use Azure; no native OpenAI API key is needed for this replacement. The underlying id identifies the model for Agno's reasoning detector, while azure_deployment selects your resource's deployment. This is a different provider/model composition from the preserved DeepSeek example.

An explicit reasoning_model runs as a separate, tool-free reasoning stage before the main model response. show_full_reasoning=True displays the reasoning data Agno receives; it cannot reveal a provider's private internal trace. Some adapters use the reasoning stage's answer text when separate reasoning content is unavailable. A failed reasoning stage can still be followed by a main-model answer, so a completed run alone does not prove the reasoning stage succeeded.

Full source: cookbook/10_reasoning/models/azure_ai_foundry/reasoning_model_deepseek.py