Build AI Apps with Azure AI Projects SDK
Python SDK for Azure AI Foundry projects - agents, tools, threads, connections, deployments, and evaluation in one client.
Why it matters
Develop and deploy sophisticated AI applications on Microsoft Foundry using the Azure AI Projects Python SDK. Integrate various tools and manage AI project resources programmatically.
Outcomes
What it gets done
Programmatically create and manage AI agents with custom instructions and tools.
Integrate with external services like Azure AI Search and Bing using built-in connections.
Manage datasets, deployments, and run evaluations for AI models.
Build conversational AI experiences using threads, messages, and runs.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-azure-ai-projects-py | bash Overview
Azure AI Projects Python SDK (Foundry SDK)
A Python SDK for Microsoft Foundry AI projects, covering agents with tools, thread-based runs, connections, deployments, datasets/indexes, and evaluation. Use it for full Foundry-integrated projects needing connections, deployments, and evaluation, not for a standalone agent app better served by azure-ai-agents.
What it does
Azure AI Projects Python SDK (azure-ai-projects) builds AI applications on Microsoft Foundry, giving one client (AIProjectClient) access to seven operation areas - agents (CRUD, versions, threads, runs), connections, deployments, datasets, indexes, evaluations, and red-team operations. It offers two ways to call a deployed model: native Foundry operations through client.agents.create_agent(), or an OpenAI-compatible client obtained via client.get_openai_client() for standard chat.completions.create() calls. The full agent-conversation loop follows a thread/message/run pattern:
### 1. Create thread
thread = client.agents.threads.create()
### 2. Add message
client.agents.messages.create(
thread_id=thread.id,
role="user",
content="What's the weather like?",
)
### 3. Create and process run
run = client.agents.runs.create_and_process(
thread_id=thread.id,
agent_id=agent.id,
)
### 4. Get response
if run.status == "completed":
messages = client.agents.messages.list(thread_id=thread.id)
for msg in messages:
if msg.role == "assistant":
print(msg.content[0].text.value)
Agents can be given tools - CodeInterpreterTool, FileSearchTool for RAG over uploaded documents, BingGroundingTool, AzureAISearchTool, FunctionTool, OpenApiTool, McpTool for MCP servers, MemorySearchTool, and SharepointGroundingTool - and can be versioned via PromptAgentDefinition and create_version() for production deployment rather than left as a single mutable agent.
When to use - and when NOT to
Use this SDK for full Foundry-integrated projects that need connections, model deployments, datasets and indexes, and evaluation alongside agents - it explicitly contrasts itself with the lower-level azure-ai-agents SDK, which lacks versioning, connections, deployments, dataset/index management, and evaluation support and is meant for standalone agent apps instead. Use the async client (azure.ai.projects.aio, with async with) for real-time or concurrent workloads, and streaming rather than create_and_process when you need a real-time UX. It is not the right choice for a standalone agent that doesn't need Foundry's project-level features - connections, deployments, datasets, evaluation - use azure-ai-agents for that instead.
Inputs and outputs
Input is model deployment names, agent instructions and tools, thread messages, and evaluation datasets; output is created and versioned agents, thread runs with assistant messages, connection and deployment listings, dataset and index references, and evaluation runs scored against built-in criteria such as fluency and task adherence via the OpenAI-compatible client's evals.runs.create(). Memory stores can be created and attached to an agent's tool_resources for persistent conversation memory across runs.
Integrations
Authenticates via DefaultAzureCredential; integrates with Azure AI Search, Bing Grounding, SharePoint, and MCP servers as agent tools, and exposes a full OpenAI-compatible client for using standard OpenAI SDK calls against the same deployed model. The reference documentation covers all 373 SDK exports (v2.0.0b4), and a bundled scripts/run_batch_evaluation.py provides a CLI for batch evaluations.
Who it's for
Python developers building full Foundry-integrated AI applications - agents plus connections, deployments, datasets, indexes, and evaluation - who need the higher-level AIProjectClient rather than the standalone, lower-level azure-ai-agents SDK.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.