Azure OpenAI o1
Configure an Agno agent to use Azure OpenAI's o1 model for reasoning tasks.
This example uses non-streaming output. Azure o1 does not stream; o3 streaming requires eligible access. See Azure reasoning support. Set the deployment variable to a deployment of the model used below.
Add the following code to your Python file
from agno.agent import Agent
from agno.models.azure.openai_chat import AzureOpenAI
agent = Agent(model=AzureOpenAI(id="o1"))
agent.print_response(
"Solve the trolley problem. Evaluate multiple ethical frameworks. "
"Include an ASCII diagram of your solution.",
stream=False,
)Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U openai agnoSet your Azure OpenAI credentials
export AZURE_OPENAI_API_KEY="xxx"
export AZURE_OPENAI_ENDPOINT="xxx"
export AZURE_OPENAI_DEPLOYMENT="xxx"Run Agent
python azure_openai.py