Usage
Basic Agent
Run an AzureOpenAI agent and print its response.
Code
from agno.agent import Agent, RunOutput # noqa
from agno.models.azure import AzureOpenAI
agent = Agent(model=AzureOpenAI(id="gpt-5.2"), markdown=True)
# Get the response in a variable
# run: RunOutput = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response on the terminal
agent.print_response("Share a 2 sentence horror story")Usage
Create or select a gpt-5.2 chat deployment. Set AZURE_OPENAI_DEPLOYMENT to its actual deployment name, and use the key and resource endpoint for that deployment. You may omit the deployment setting only when an existing deployment is named exactly like id. Keep id aligned with the deployed model family.
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet your API key
export AZURE_OPENAI_API_KEY=xxx
export AZURE_OPENAI_ENDPOINT=xxx
export AZURE_OPENAI_DEPLOYMENT="your_chat_deployment" # OptionalInstall dependencies
uv pip install -U openai agnoRun Agent
Save the code above as basic.py, then run:
python basic.py