The Azure AI Agent SDK enables you to build AI-powered agents that can reason, use tools, and maintain conversational context. This document covers the foundational concepts you need to understand.
The unified platform for building, deploying, and managing AI applications on Azure.
Workspaces within Azure AI Foundry that contain all your AI resources.
<endpoint>;<subscription>;<resource-group>;<project-name>Large Language Models (LLMs) deployed in your Foundry project.
| Model | Best For |
|---|---|
| GPT-4o | Complex reasoning, multi-modal tasks |
| GPT-4o-mini | Cost-effective general tasks |
| GPT-4.1 | Latest capabilities, improved instruction following |
| GPT-4.1-mini | Balanced cost and performance |
Models are referenced by their deployment name, not the model name itself.
AI entities that combine a model with instructions and tools to accomplish tasks.
agent.id used to reference themConversation sessions that persist messages and context.
thread.idIndividual messages within a thread.
The execution of an agent against a thread.
queued → in_progress → completedfailed, cancelled, or requires_action statusCapabilities that agents can use during a run to perform actions beyond text generation.
Execute Python code in a sandboxed environment.
Search uploaded documents using vector embeddings.
Invoke custom-defined functions that you implement.
RAG over enterprise knowledge bases using Azure AI Search.
Call external REST APIs via OpenAPI specifications.
Web search grounding for up-to-date information.
The typical lifecycle of an agent interaction:
Create Agent → Create Thread → Add Message → Create Run → [Tool Calls] → Response → Cleanup
queued → in_progress → completed
↘ requires_action → (submit tool outputs) → in_progress
↘ failed
↘ cancelled
The SDK uses DefaultAzureCredential which automatically tries multiple authentication methods in order:
az login)from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
var credential = new DefaultAzureCredential();
For local development, authenticate via the Azure CLI:
az login
az account set --subscription <subscription-id>
For deployed applications, use Managed Identity — no secrets to manage:
The identity running the SDK must have the Azure AI User role (or higher) on the AI Foundry project resource.
az role assignment create \
--assignee <principal-id> \
--role "Azure AI User" \
--scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.MachineLearningServices/workspaces/<project>
One agent configured with several tools to handle diverse tasks. The agent decides which tool to use based on the user’s request.
Use when: You need a general-purpose assistant that can handle varied requests.
Multiple specialized agents, each with focused instructions and tools, coordinated by your application logic.
Use when: Different tasks require different expertise, models, or tool configurations.
Agents grounded in your data using File Search or Azure AI Search.
Use when: Agents need to answer questions based on your documents or knowledge bases.
Agents that call your custom functions to interact with databases, APIs, or business logic.
Use when: Agents need to take real-world actions (create tickets, query databases, send emails).
Stream agent responses token-by-token for responsive user interfaces.
Use when: Building interactive chat UIs where perceived latency matters.