Install & Compatibility
Where this runs
tested against v1.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 38.75s
py 3.11
✕ build_error
✓ 39.03s
py 3.12
✕ build_error
✓ 31.68s
py 3.13
✕ build_error
✓ 30.95s
py 3.9
✕ build_error
✕ build_error
832MB installed
● package 832MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Agent
✓ from agent_framework import Agent
FoundryChatClient
✓ from agent_framework.foundry import FoundryChatClient
AzureOpenAIResponsesClient
✓ from agent_framework.azure import AzureOpenAIResponsesClient
AzureCliCredential
✓ from azure.identity import AzureCliCredential
✗ from agent_framework.azure import AzureCliCredential
AzureCliCredential is part of the 'azure-identity' package, not 'agent-framework.azure'.
This quickstart demonstrates how to create a simple AI agent using the Microsoft Agent Framework with Azure OpenAI. It requires `azure-identity` for authentication (e.g., via `az login`) and environment variables for Azure project endpoint and deployment name. All agent operations are asynchronous and must be run using `asyncio.run()`.
import asyncio
import os
from agent_framework.azure import AzureOpenAIResponsesClient
from azure.identity import AzureCliCredential
# from dotenv import load_dotenv # Uncomment and install if using .env file locally
async def main():
# Load environment variables from .env file if uncommented above
# load_dotenv()
# Ensure AZURE_AI_PROJECT_ENDPOINT and AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME are set
# and you are authenticated via Azure CLI (e.g., `az login`)
project_endpoint = os.environ.get("AZURE_AI_PROJECT_ENDPOINT", "https://your-project.services.ai.azure.com")
deployment_name = os.environ.get("AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME", "gpt-4o")
if not all([project_endpoint, deployment_name]):
print("Please set AZURE_AI_PROJECT_ENDPOINT and AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME environment variables.")
print("Ensure you have authenticated via Azure CLI (`az login`).")
return
# Create an Azure CLI credential for authentication
credential = AzureCliCredential()
# Initialize the Azure OpenAI Responses client
client = AzureOpenAIResponsesClient(
project_endpoint=project_endpoint,
deployment_name=deployment_name,
credential=credential,
)
# Create an agent with instructions
agent = client.as_agent(
name="HelloAgent",
instructions="You are a friendly assistant. Keep your answers brief.",
)
# Run the agent
print("Agent: Thinking...")
result = await agent.run("What is the capital of France?")
print(f"Agent: {result}")
# Example of streaming response (optional)
# print("\nAgent (streaming): Thinking...")
# async for token in agent.run("Tell me a short story about a brave knight.", stream=True):
# print(token, end="", flush=True)
# print()
if __name__ == "__main__":
asyncio.run(main())
Upgrade
Version history
1.8.1latest on PyPI · released Jun 9, 2026
Audit
Dependencies
azure-identityrequiredRequired for Azure authentication methods like AzureCliCredential, used by Azure-specific chat clients.
python-dotenvoptionalCommonly used for loading environment variables from .env files in local development. Not strictly required by the framework itself, but often seen in quickstarts.