Official agent skill

Azure AI Projects Python SDK

by microsoft in microsoft/skills

Reference for building on Microsoft Foundry with the azure-ai-projects Python SDK: project clients, versioned agents, evaluations, connections, datasets and indexes.

OfficialMITAuto-check passedAI & LLM Engineering

Install Azure AI Projects Python SDK

skills CLI
$ npx skills add microsoft/skills --skill azure-ai-projects-py -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/skills azure-ai-projects-py --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/plugins/azure-sdk-python/skills/azure-ai-projects-py .claude/skills/azure-ai-projects-py && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
azure-ai-projects-py
GitHub stars
3.1k
Token cost
~2.8k tokens
SKILL.md length
517 words
Files
12 (incl. scripts, references)
Skills in repo
150
Repo updated
First seen
Licence
MIT

At a glance

Reference for building on Microsoft Foundry with the azure-ai-projects Python SDK: project clients, versioned agents, evaluations, connections, datasets and indexes.

  • Works in 2 steps: AIProjectClient (Native Foundry) → OpenAI-Compatible Client
  • Creating versioned agents with PromptAgentDefinition in a Foundry project
  • SKILL.md covers Installation, Environment Variables, Authentication & Lifecycle and Client Operations Overview, plus 13 more sections
  • Runs Python scripts from its folder; calls pip; reaches learn.microsoft.com; needs AZURE_TOKEN_CREDENTIALS

What it does

The agent learns to work with AIProjectClient from the azure-ai-projects package, the high-level Foundry SDK. Its operation groups cover agents (create, versions, threads, runs), connections, deployments, datasets, indexes, evaluations and red team operations, and a project can also hand back an OpenAI-compatible client. Low-level agent operations are sent to a separate azure-ai-agents-python skill.

Setup is pip install azure-ai-projects azure-identity plus the AZURE_AI_PROJECT_ENDPOINT and AZURE_AI_MODEL_DEPLOYMENT_NAME variables. Two rules apply to every sample: prefer DefaultAzureCredential over keys or connection strings, setting AZURE_TOKEN_CREDENTIALS=prod in production, and wrap each client in a context manager, sync or async, so connections are released. Reference files cover agents, tools, built-in and custom evaluators, async patterns and deployments, and scripts/run_batch_evaluation.py runs batch evaluations.

When your agent uses it

  • Creating versioned agents with PromptAgentDefinition in a Foundry project
  • Running or scripting evaluations against a Foundry project
  • Listing project connections, deployments, datasets or indexes from Python
  • Using the OpenAI-compatible client that a Foundry project provides

Example prompts

  • “Create a versioned agent in our Foundry project with PromptAgentDefinition and run one thread.”
  • “Write a script that runs a batch evaluation on our support dataset using built-in evaluators.”
  • “List the model deployments in our project and convert the client code to async.”

Requirements

  • Python with azure-ai-projects and azure-identity installed
  • A Microsoft Foundry project endpoint and model deployment name
  • Azure credentials that DefaultAzureCredential can use

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. AIProjectClient (Native Foundry)
  2. OpenAI-Compatible Client

What it can do on your machine

Read from SKILL.md and the folder at commit 3898ec8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • learn.microsoft.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • AZURE_TOKEN_CREDENTIALS

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Azure AI Projects Python SDK loads about 2.8k tokens when it runs, and up to ~29k if it reads all its reference files. Until then it costs about 104 tokens; SKILL.md has 517 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~104
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~29k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from microsoft/skills at commit 3898ec8, republished under its MIT licence (© microsoft). 517 words, ~2,764 tokens.

Download SKILL.mdSave it as .claude/skills/azure-ai-projects-py/SKILL.md (or your agent's skills folder). This skill also uses 11 other files; get the full folder from GitHub.
name
azure-ai-projects-py
description
Build AI applications using the Azure AI Projects Python SDK (azure-ai-projects). Use when working with Foundry project clients, creating versioned agents with PromptAgentDefinition, running evaluations, managing connections/deployments/datasets/indexes, or using OpenAI-compatible clients. This is the high-level Foundry SDK - for low-level agent operations, use azure-ai-agents-python skill.
license
MIT
metadata.author
Microsoft
metadata.version
1.0.0
metadata.package
azure-ai-projects

Azure AI Projects Python SDK (Foundry SDK)

Build AI applications on Microsoft Foundry using the azure-ai-projects SDK.

Installation

bash
pip install azure-ai-projects azure-identity

Environment Variables

bash
AZURE_AI_PROJECT_ENDPOINT="https://<resource>.services.ai.azure.com/api/projects/<project>"  # Required for all auth methods
AZURE_AI_MODEL_DEPLOYMENT_NAME="gpt-4o-mini"  # Required for all auth methods
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production

Authentication & Lifecycle

🔑 Two rules apply to every code sample below:

  1. Prefer DefaultAzureCredential. It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation.
    • Local dev: DefaultAzureCredential works as-is.
    • Production: set AZURE_TOKEN_CREDENTIALS=prod (or AZURE_TOKEN_CREDENTIALS=<specific_credential>) to constrain the credential chain to production-safe credentials.
  2. Wrap every client in a context manager so HTTP transports, sockets, and token caches are released deterministically:
    • Sync: with <Client>(...) as client:
    • Async: async with <Client>(...) as client: and async with DefaultAzureCredential() as credential: (from azure.identity.aio)

Snippets may abbreviate this setup, but production code should always follow both rules.

python
import os
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
from azure.ai.projects import AIProjectClient

# Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
credential = DefaultAzureCredential()
# Or use a specific credential directly in production:
# See https://learn.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python#credential-classes
# credential = ManagedIdentityCredential()
with AIProjectClient(
    endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
    credential=credential,
) as client:
    deployments = list(client.deployments.list())

Client Operations Overview

OperationAccessPurpose
client.agents.agents.*Agent CRUD, versions, threads, runs
client.connections.connections.*List/get project connections
client.deployments.deployments.*List model deployments
client.datasets.datasets.*Dataset management
client.indexes.indexes.*Index management
client.evaluations.evaluations.*Run evaluations
client.red_teams.red_teams.*Red team operations

Two Client Approaches

1. AIProjectClient (Native Foundry)
python
from azure.ai.projects import AIProjectClient

with AIProjectClient(
    endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
    credential=DefaultAzureCredential(),
) as client:
    # Use Foundry-native operations
    agent = client.agents.create_agent(
        model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
        name="my-agent",
        instructions="You are helpful.",
    )
2. OpenAI-Compatible Client
python
# Get OpenAI-compatible client from project
openai_client = client.get_openai_client()

# Use standard OpenAI API
response = openai_client.chat.completions.create(
    model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
    messages=[{"role": "user", "content": "Hello!"}],
)

Agent Operations

Create Agent (Basic)
python
agent = client.agents.create_agent(
    model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
    name="my-agent",
    instructions="You are a helpful assistant.",
)
Create Agent with Tools
python
from azure.ai.agents.models import CodeInterpreterTool, FileSearchTool

agent = client.agents.create_agent(
    model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
    name="tool-agent",
    instructions="You can execute code and search files.",
    tools=[CodeInterpreterTool(), FileSearchTool()],
)
Versioned Agents with PromptAgentDefinition
python
from azure.ai.projects.models import PromptAgentDefinition

# Create a versioned agent
agent_version = client.agents.create_version(
    agent_name="customer-support-agent",
    definition=PromptAgentDefinition(
        model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
        instructions="You are a customer support specialist.",
        tools=[],  # Add tools as needed
    ),
    version_label="v1.0",
)

See references/agents.md for detailed agent patterns.

Tools Overview

ToolClassUse Case
Code InterpreterCodeInterpreterToolExecute Python, generate files
File SearchFileSearchToolRAG over uploaded documents
Bing GroundingBingGroundingToolWeb search (requires connection)
Azure AI SearchAzureAISearchToolSearch your indexes
Function CallingFunctionToolCall your Python functions
OpenAPIOpenApiToolCall REST APIs
MCPMcpToolModel Context Protocol servers
Memory SearchMemorySearchToolSearch agent memory stores
SharePointSharepointGroundingToolSearch SharePoint content

See references/tools.md for all tool patterns.

Thread and Message Flow

python
# 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)

Connections

python
# List all connections
connections = client.connections.list()
for conn in connections:
    print(f"{conn.name}: {conn.connection_type}")

# Get specific connection
connection = client.connections.get(connection_name="my-search-connection")

See references/connections.md for connection patterns.

Deployments

python
# List available model deployments
deployments = client.deployments.list()
for deployment in deployments:
    print(f"{deployment.name}: {deployment.model}")

See references/deployments.md for deployment patterns.

Datasets and Indexes

python
# List datasets
datasets = client.datasets.list()

# List indexes
indexes = client.indexes.list()

See references/datasets-indexes.md for data operations.

Evaluation

python
# Using OpenAI client for evals
openai_client = client.get_openai_client()

# Create evaluation with built-in evaluators
eval_run = openai_client.evals.runs.create(
    eval_id="my-eval",
    name="quality-check",
    data_source={
        "type": "custom",
        "item_references": [{"item_id": "test-1"}],
    },
    testing_criteria=[
        {"type": "fluency"},
        {"type": "task_adherence"},
    ],
)

See references/evaluation.md for evaluation patterns.

Async Client

python
from azure.ai.projects.aio import AIProjectClient

async with AIProjectClient(
    endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
    credential=DefaultAzureCredential(),
) as client:
    agent = await client.agents.create_agent(...)
    # ... async operations

See references/async-patterns.md for async patterns.

Memory Stores

python
# Create memory store for agent
memory_store = client.agents.create_memory_store(
    name="conversation-memory",
)

# Attach to agent for persistent memory
agent = client.agents.create_agent(
    model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
    name="memory-agent",
    tools=[MemorySearchTool()],
    tool_resources={"memory": {"store_ids": [memory_store.id]}},
)
Show full SKILL.md (207 more words)Show less

Best Practices

  1. Pick sync OR async and stay consistent. Do not mix azure.ai.projects sync clients with azure.ai.projects.aio async clients in the same call path. Choose one mode per module.
  2. Always use context managers for clients and async credentials. Wrap every client in with AIProjectClient(...) as client: (sync) or async with AIProjectClient(...) as client: (async). For async DefaultAzureCredential from azure.identity.aio, also use async with credential: so tokens and transports are cleaned up.
  3. Clean up agents when done: client.agents.delete_agent(agent.id)
  4. Use create_and_process for simple runs, streaming for real-time UX
  5. Use versioned agents for production deployments
  6. Prefer connections for external service integration (AI Search, Bing, etc.)

SDK Comparison

Featureazure-ai-projectsazure-ai-agents
LevelHigh-level (Foundry)Low-level (Agents)
ClientAIProjectClientAgentsClient
Versioningcreate_version()Not available
ConnectionsYesNo
DeploymentsYesNo
Datasets/IndexesYesNo
EvaluationVia OpenAI clientNo
When to useFull Foundry integrationStandalone agent apps

Reference Files

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 11 other files (scripts, references) in .github/plugins/azure-sdk-python/skills/azure-ai-projects-py of microsoft/skills.

  • SKILL.md
  • references/agents.md
  • references/api-reference.md
  • references/async-patterns.md
  • references/built-in-evaluators.md
  • references/connections.md
  • references/custom-evaluators.md
  • references/datasets-indexes.md
  • references/deployments.md
  • references/evaluation.md
  • references/tools.md
  • scripts/run_batch_evaluation.py

Open the folder on GitHubat commit 3898ec8

Compare with similar skills

Azure AI Projects Python SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Azure AI Projects Python SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Azure AI Projects Python SDK this skillmicrosoft/skills3.1k—~2.8kAutomated safety check: PassMIT
Azure Openai To Responsesmicrosoft/ai-agents-for-beginners77k—~6kAutomated safety check: NotesMIT
Azure Openai To Responsesmicrosoft/ai-agents-for-beginners77k—~6kAutomated safety check: NotesMIT
Sap Cloud SDK AI Pythonsecondsky/sap-skills462—~3.8kAutomated safety check: PassGPL-3.0
Azure Openai To Responsesmicrosoft/ai-agents-for-beginners77k—~6.5kAutomated safety check: NotesMIT
Azure Openai To Responsesmicrosoft/ai-agents-for-beginners77k—~7kAutomated safety check: NotesMIT

Similar skills

  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Migrate Python apps from Azure OpenAI Chat Completions to the Responses API.

    77k GitHub stars~6k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes
  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Shift Python apps dem from Azure OpenAI Chat Completions go Responses API.

    77k GitHub stars~6k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes
  • Sap Cloud SDK AI Python

    secondsky/sap-skills

    Integrates the SAP Cloud SDK for AI for Python (sap-ai-sdk-gen, formerly generative-ai-hub-sdk) into Python applications.

    462 GitHub stars~3.8k tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check passed
  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Migrasi aplikasi Python dari Azure OpenAI Chat Completions ke Responses API.

    77k GitHub stars~6.5k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes
  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Ilipat ang mga Python app mula sa Azure OpenAI Chat Completions papuntang Responses API.

    77k GitHub stars~7k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes
  • Agent Framework Azure AI Py

    aiskillstore/marketplace

    Build persistent agents on Azure AI Foundry using the Microsoft Agent Framework Python SDK.

    430 GitHub starsUsed in 4 repos~2.6k tokens
    AI & LLM EngineeringAuto-check passed

More from microsoft/skills

All 150 skills in this repo
  • Official

    Covers producer, consumer, and checkpoint-store setup for Azure Event Hubs streaming in Python, with Entra ID auth and partition targeting.

    3.1k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Official

    Builds podcast-style audio narration from text with Azure OpenAI's GPT Realtime Mini over WebSocket, from a Python FastAPI backend to a React player.

    3.1k GitHub starsUsed in 1 repo~947 tokens
    Auto-check passed
  • Frontend UI Dark TS

    microsoft/skills

    Official

    Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations.

    3.1k GitHub starsUsed in 5 repos~3.6k tokens
    Auto-check passed
  • Pydantic Models Py

    microsoft/skills

    Official

    Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants.

    3.1k GitHub starsUsed in 5 repos~496 tokens
    Auto-check passed
  • Skill Creator

    microsoft/skills

    Official

    Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services.

    3.1k GitHub starsUsed in 5 repos~17k tokens
    Auto-check passed
  • Official

    Python guidance for the Azure AI Search SDK covering vector, hybrid and semantic search, index management and indexers, with Entra ID authentication preferred over keys.

    3.1k GitHub stars~4.4k tokensUpdated today
    Auto-check passed

Questions about Azure AI Projects Python SDK

What does Azure AI Projects Python SDK do?

Reference for building on Microsoft Foundry with the azure-ai-projects Python SDK: project clients, versioned agents, evaluations, connections, datasets and indexes. The agent learns to work with AIProjectClient from the azure-ai-projects package, the high-level Foundry SDK. Its operation groups cover agents (create, versions, threads, runs), connections, deployments, datasets, indexes, evaluations and red team operations, and a project can also hand back an OpenAI-compatible client.

When should I use Azure AI Projects Python SDK?

Azure AI Projects Python SDK fits situations like: creating versioned agents with PromptAgentDefinition in a Foundry project; running or scripting evaluations against a Foundry project; listing project connections, deployments, datasets or indexes from Python; using the OpenAI-compatible client that a Foundry project provides.

How do I install Azure AI Projects Python SDK in Claude Code?

Run `npx skills add microsoft/skills --skill azure-ai-projects-py -a claude-code`. Or copy the skill folder (.github/plugins/azure-sdk-python/skills/azure-ai-projects-py in microsoft/skills) into .claude/skills/azure-ai-projects-py in your project. Claude Code loads it when a task matches its description.

How do I install Azure AI Projects Python SDK in Codex?

Run `npx skills add microsoft/skills --skill azure-ai-projects-py -a codex`. Or copy the skill folder (.github/plugins/azure-sdk-python/skills/azure-ai-projects-py in microsoft/skills) into .agents/skills/azure-ai-projects-py in your project. Codex loads it when a task matches its description.

Can I use Azure AI Projects Python SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/skills --skill azure-ai-projects-py -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/azure-ai-projects-py, .gemini/skills/azure-ai-projects-py, .github/skills/azure-ai-projects-py and .opencode/skills/azure-ai-projects-py in your project.

What does Azure AI Projects Python SDK need to run?

Going by SKILL.md and its folder, Azure AI Projects Python SDK needs Python for the scripts in its folder, the command-line tools its instructions call (pip) and credentials named AZURE_TOKEN_CREDENTIALS. Our summary lists: Python with azure-ai-projects and azure-identity installed; A Microsoft Foundry project endpoint and model deployment name; Azure credentials that DefaultAzureCredential can use.

Does Azure AI Projects Python SDK access the network?

SKILL.md names 1 domain. In commands or code: learn.microsoft.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Azure AI Projects Python SDK safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Azure AI Projects Python SDK use?

Azure AI Projects Python SDK is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Azure AI Projects Python SDK use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 26k tokens, read only when the agent opens those files.

What are the alternatives to Azure AI Projects Python SDK?

Skills that share tags, products or a category with Azure AI Projects Python SDK: Azure Openai To Responses (microsoft/ai-agents-for-beginners, 77k stars), Azure Openai To Responses (microsoft/ai-agents-for-beginners, 77k stars), Sap Cloud SDK AI Python (secondsky/sap-skills, 462 stars) and Azure Openai To Responses (microsoft/ai-agents-for-beginners, 77k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Azure AI Projects Python SDK?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/skills, which has 3,094 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on October 9, 2026.

Source: microsoft/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.