Azure OpenAI Separate Reasoning Model

Use distinct Azure deployments for a native reasoning stage and a GPT-4.1 response.

Create GPT-4.1 and GPT-5.2 deployments in the same Azure OpenAI resource, then set their distinct deployment names below. id identifies the model for Agno; azure_deployment selects the Azure deployment. GPT-4.1 is the response model, not the native reasoner.

Add the following code to your Python file

azure_openai.py
import os

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

agent = Agent(
    model=AzureOpenAI(id="gpt-4.1", azure_deployment=os.environ["AZURE_RESPONSE_DEPLOYMENT"]),
    reasoning_model=AzureOpenAI(id="gpt-5.2", azure_deployment=os.environ["AZURE_REASONING_DEPLOYMENT"], reasoning_effort="medium")
)
agent.print_response(
    "Solve the trolley problem. Evaluate multiple ethical frameworks. "
    "Include an ASCII diagram of your solution.",
    stream=True,
)

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U openai agno

Set your Azure OpenAI credentials

  export AZURE_OPENAI_API_KEY="xxx"
  export AZURE_OPENAI_ENDPOINT="xxx"
  export AZURE_RESPONSE_DEPLOYMENT="your-gpt-4-1-deployment"
  export AZURE_REASONING_DEPLOYMENT="your-gpt-5-2-deployment"

Run Agent

python azure_openai.py