Description
# Azure AI Projects client library for Python The AI Projects client library (in preview) is part of the Microsoft Foundry SDK, and provides easy access to resources in your Microsoft Foundry Project. Use it to: * **Create and run Agents** using methods on the `.agents` client property. * **Enhance Agents with specialized tools**: * Agent-to-Agent (A2A) (Preview) * Azure AI Search * Azure Functions * Bing Custom Search (Preview) * Bing Grounding * Browser Automation (Preview) * Code Interpreter * Computer Use (Preview) * File Search * Function Tool * Image Generation * Memory Search (Preview) * Microsoft Fabric (Preview) * Microsoft SharePoint (Preview) * Model Context Protocol (MCP) * OpenAPI * Web Search * Web Search (Preview) * **Get an OpenAI client** using `.get_openai_client()` method to run Responses, Conversations, Evaluations and Fine-Tuning operations with your Agent. * **Manage memory stores (preview)** for Agent conversations, using `.beta.memory_stores` operations. * **Explore additional evaluation tools (some in preview)** to assess the performance of your generative AI application, using `.evaluation_rules`, `.beta.evaluation_taxonomies`, `.beta.evaluators`, `.beta.insights`, and `.beta.schedules` operations. * **Run Red Team scans (preview)** to identify risks associated with your generative AI application, using `.beta.red_teams` operations. * **Fine tune** AI Models on your data. * **Enumerate AI Models** deployed to your Foundry Project using `.deployments` operations. * **Enumerate connected Azure resources** in your Foundry project using `.connections` operations. * **Upload documents and create Datasets** to reference them using `.datasets` operations. * **Create and enumerate Search Indexes** using `.indexes` operations. The client library uses version `v1` of the Microsoft Foundry [data plane REST APIs](https://aka.ms/azsdk/azure-ai-projects-v2/api-reference-v1). [Product documentation](https://aka.ms/azsdk/azure-ai-projects-v2/product-doc) | [Samples][samples] | [API reference](https://aka.ms/azsdk/azure-ai-projects-v2/python/api-reference) | [Package (PyPI)](https://aka.ms/azsdk/azure-ai-projects-v2/python/package) | [SDK source code](https://aka.ms/azsdk/azure-ai-projects-v2/python/code) | [Release history](https://aka.ms/azsdk/azure-ai-projects-v2/python/release-history) ## Reporting issues To report an issue with the client library, or request additional features, please open a [GitHub issue here](https://github.com/Azure/azure-sdk-for-python/issues). Mention the package name "azure-ai-projects" in the title or content. ## Getting started ### Prerequisite * Python 3.9 or later. * An [Azure subscription][azure_sub]. * A [project in Microsoft Foundry](https://learn.microsoft.com/azure/foundry/how-to/create-projects). * A Foundry project endpoint URL of the form `https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name`. It can be found in your Microsoft Foundry Project home page. Below we will assume the environment variable `FOUNDRY_PROJECT_ENDPOINT` was defined to hold this value. * To authenticate using API key, you will need the "Project API key" as shown in your Microsoft Foundry Project home page. * To authenticate using Entra ID, your application needs an object that implements the [TokenCredential](https://learn.microsoft.com/python/api/azure-core/azure.core.credentials.tokencredential) interface. Code samples here use [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential). To get that working, you will need: * An appropriate role assignment. See [Role-based access control in Microsoft Foundry portal](https://learn.microsoft.com/azure/foundry/concepts/rbac-foundry). Role assignment can be done via the "Access Control (IAM)" tab of your Azure AI Project resource in the Azure portal. * [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed. * You are logged into your Azure account by running `az login`. ### Install the package ```bash pip install azure-ai-projects ``` Verify that you have version 2.0.0 or above installed by running: ```bash pip show azure-ai-projects ``` ## Key concepts ### Create and authenticate the client with Entra ID Entra ID is the only authentication method supported at the moment by the client. To construct a synchronous client using a context manager: ```python import os from azure.ai.projects import AIProjectClient from azure.identity import DefaultAzureCredential with ( DefaultAzureCredential() as credential, AIProjectClient(endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], credential=credential) as project_client, ): ``` To construct an asynchronous client, install the additional package [aiohttp](https://pypi.org/project/aiohttp/): ```bash pip install aiohttp ``` and run: ```python import os import asyncio from azure.ai.projects.aio import AIProjectClient
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 2.1.0 | Imported from PyPI (2.1.0) | Low | 4/21/2026 |
