Claude on AzureMicrosoft Foundry also offers access to all Anthropic Claude models, including Opus, Sonnet, and Haiku. Claude models are served through a dedicated Anthropic-native endpoint rather than the Azure OpenAI v1 API. Use
langchain-anthropic pointed at your Foundry Anthropic endpoint.Choose a package
langchain-azure-ai and langchain-openai are complementary rather than alternatives. langchain-azure-ai depends on langchain-openai, and its chat and embeddings classes subclass ChatOpenAI and OpenAIEmbeddings, so installing the Azure package does not remove the OpenAI package from your dependency chain.
Use the following table to pick a starting point:
Moving an existing
langchain-openai application to langchain-azure-ai is not a drop-in import change:
- Configuration differs.
azure_endpoint,azure_deployment,api_version, and token-provider arguments becomeproject_endpointorendpoint,model, andcredential. - Default behavior differs.
AzureAIOpenAIApiChatModeldefaults to the Responses API when it resolves a project endpoint. Setuse_responses_api=Falseto keep Chat Completions behavior. - No completion-LLM equivalent to
AzureOpenAIexists inlangchain-azure-ai. AzureChatOpenAIcarries Azure-specific response metadata and content-filter handling that the Foundry chat model does not reproduce.- Both packages follow the official OpenAI schemas, so non-standard fields returned by compatible providers such as DeepSeek or Mistral may not be preserved.
Chat models
Microsoft offers three main options for accessing chat models through Azure:- Microsoft Foundry (recommended for project-centric applications): Use
AzureAIOpenAIApiChatModelfromlangchain-azure-aiwith a Foundry project endpoint and Azure credentials. This package also integrates with Foundry agents, hosting, tools, Content Safety, retrieval, and observability. - Azure OpenAI: Use
ChatOpenAIfromlangchain-openaifor direct v1 API calls or code that switches between OpenAI and Azure. UseAzureChatOpenAIfor traditional Azure OpenAI API versions and existing applications. - Azure ML: Allows deployment and management of custom or fine-tuned open-source models with Azure Machine Learning.
Microsoft Foundry
Microsoft Foundry provides project-level access to models and Azure services. UseAzureAIOpenAIApiChatModel from langchain-azure-ai when your application uses a Foundry project, Azure credentials, or other Foundry capabilities.
Azure OpenAI
For direct Azure OpenAI access, create an Azure deployment and install thelangchain-openai package:
ChatOpenAI directly against your Azure endpoint—no api_version required:
- Entra ID (recommended)
- API key
AzureChatOpenAI:
Responses API
Azure OpenAI supports the Responses API, which provides stateful conversations, built-in tools (web search, file search, code interpreter), and structured reasoning summaries.ChatOpenAI automatically routes to the Responses API when you set the reasoning parameter, or you can opt in explicitly with use_responses_api=True:
- Entra ID (recommended)
- API key
LLMs
Microsoft offers two main options for accessing LLMs through Azure:- Azure OpenAI (recommended): Use Azure OpenAI text-completion deployments with
AzureOpenAIfromlangchain-openai. - Azure ML: Use custom or open-source models hosted on Azure Machine Learning online endpoints.
Azure OpenAI
See a usage example.- Entra ID (recommended)
- API key
Embedding models
Choose an embeddings integration based on how your application connects to Azure:- Microsoft Foundry (recommended for project-centric applications): Use
AzureAIOpenAIApiEmbeddingsModelfromlangchain-azure-aiwith Foundry project configuration and Azure credentials. - Azure OpenAI: Use
AzureOpenAIEmbeddingsfromlangchain-openaifor direct or traditional Azure OpenAI endpoints, existing applications, or a smaller dependency surface.
Microsoft Foundry
Installlangchain-azure-ai:
Foundry project configuration currently derives a direct
/openai/v1 endpoint because embeddings are not yet served through the project endpoint itself.Azure OpenAI
See a usage example.- Entra ID (recommended)
- API key
Middleware
Azure AI Content Safety middleware
Azure AI Content Safety provides guardrails you can apply to LangChain agents through middleware. The langchain-azure-ai package currently exports middleware for text moderation, image moderation, prompt injection detection, protected material detection, and groundedness evaluation.
Install the middleware package:
Document loaders
Azure Blob Storage
Azure Blob Storage is Microsoft’s object storage solution for the cloud. Blob Storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn’t adhere to a particular data model or definition, such as text or binary data.
Azure Blob Storage is designed for:
- Serving images or documents directly to a browser.
- Storing files for distributed access.
- Streaming video and audio.
- Writing to log files.
- Storing data for backup and restore, disaster recovery, and archiving.
- Storing data for analysis by an on-premises or Azure-hosted service.
Backends
Azure Blob Storage Backend
Azure Blob Storage is Microsoft’s object storage solution for the cloud.AzureBlobBackendimplements the Deep AgentsBackendProtocol, so a deep agent can persist its entire workspace (files, memories, and artifacts) in a blob container.
The
AzureBlobBackend is part of the langchain-azure-storage package, which is currently in Public Preview.deepagents extra (requires Python 3.11+):
DefaultAzureCredential and accepts a credential override.
For more information, see Backend integrations. See the package repository for full usage details and security guidance.
Memory
Azure cosmos DB chat message history
Azure Cosmos DB provides chat message history storage for conversational AI applications, enabling you to persist and retrieve conversation history with low latency and high availability.
AsyncCosmosDBChatMessageHistory from the same package.
Azure cosmos DB semantic cache
AzureCosmosDBNoSqlSemanticCache caches LLM responses in Azure Cosmos DB for NoSQL using vector similarity, returning cached results when a semantically similar prompt is seen again.
AsyncAzureCosmosDBNoSqlSemanticCache.
Vector stores
Azure cosmos DB
AI agents can rely on Azure Cosmos DB as a unified memory system solution, enjoying speed, scale, and simplicity. This service successfully enabled OpenAI’s ChatGPT service to scale dynamically with high reliability and low maintenance. Powered by an atom-record-sequence engine, it is the world’s first globally distributed NoSQL, relational, and vector database service that offers a serverless mode. Below are two available Azure Cosmos DB APIs that can provide vector store functionalities.Azure cosmos DB for MongoDB (vCore)
Azure Cosmos DB for MongoDB vCore makes it easy to create a database with full native MongoDB support. You can apply your MongoDB experience and continue to use your favorite MongoDB drivers, SDKs, and tools by pointing your application to the API for MongoDB vCore account’s connection string. Use vector search in Azure Cosmos DB for MongoDB vCore to seamlessly integrate your AI-based applications with your data that’s stored in Azure Cosmos DB.
Installation and setup
See detailed configuration instructions. We need to installlangchain-azure-ai and pymongo python packages.
Deploy Azure cosmos DB on Microsoft Azure
Azure Cosmos DB for MongoDB vCore provides developers with a fully managed MongoDB-compatible database service for building modern applications with a familiar architecture. With Cosmos DB for MongoDB vCore, developers can enjoy the benefits of native Azure integrations, low total cost of ownership (TCO), and the familiar vCore architecture when migrating existing applications or building new ones. Sign Up for free to get started today. See a usage example.Azure cosmos DB NoSQL
Azure Cosmos DB for NoSQL now offers vector indexing and search in preview. This feature is designed to handle high-dimensional vectors, enabling efficient and accurate vector search at any scale. You can now store vectors directly in the documents alongside your data. This means that each document in your database can contain not only traditional schema-free data, but also high-dimensional vectors as other properties of the documents. This colocation of data and vectors allows for efficient indexing and searching, as the vectors are stored in the same logical unit as the data they represent. This simplifies data management, AI application architectures, and the efficiency of vector-based operations.
Installation and setup
See detail configuration instructions. We need to installlangchain-azure-cosmosdb and azure-cosmos python packages.
Deploy Azure cosmos DB on Microsoft Azure
Azure Cosmos DB offers a solution for modern apps and intelligent workloads by being very responsive with dynamic and elastic autoscale. It is available in every Azure region and can automatically replicate data closer to users. It has SLA guaranteed low-latency and high availability. Sign Up for free to get started today. See a usage example.Azure Database for PostgreSQL
Azure Database for PostgreSQL - Flexible Server is a relational database service based on the open-source Postgres database engine. It’s a fully managed database-as-a-service that can handle mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.See set up instructions for Azure Database for PostgreSQL. Simply use the connection string from your Azure Portal. Since Azure Database for PostgreSQL is open-source Postgres, you can use the LangChain’s Postgres support to connect to Azure Database for PostgreSQL.
Azure SQL Database
Azure SQL Database is a robust service that combines scalability, security, and high availability, providing all the benefits of a modern database solution. It also provides a dedicated Vector data type & built-in functions that simplifies the storage and querying of vector embeddings directly within a relational database. This eliminates the need for separate vector databases and related integrations, increasing the security of your solutions while reducing the overall complexity.By leveraging your current SQL Server databases for vector search, you can enhance data capabilities while minimizing expenses and avoiding the challenges of transitioning to new systems.
Installation and setup
See detail configuration instructions. We need to install thelangchain-sqlserver python package.
Deploy Azure SQL DB on Microsoft Azure
Sign Up for free to get started today. See a usage example.Vector store
Azure Database for PostgreSQL
Azure Database for PostgreSQL - Flexible Server is a relational database service based on the open-source Postgres database engine. It’s a fully managed database-as-a-service that can handle mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.See set up instructions for Azure Database for PostgreSQL. You need to enable pgvector extension in your database to use Postgres as a vector store. Once you have the extension enabled, you can use the PGVector in LangChain to connect to Azure Database for PostgreSQL. See a usage example. Simply use the connection string from your Azure Portal.
Tools
Microsoft Foundry tools
Microsoft Foundry exposes LangChain service tools for Azure AI Content Understanding, Document Intelligence, Image Analysis, and Text Analytics for Health. Install the package with thetools extra:
Image generation tool
Microsoft Foundry Models has several models available in the catalog for image generation. See the Microsoft Foundry tools guide.Transcriptions tool
Microsoft Foundry Models has Whisper models available in the catalog for speech-to-text transcriptions. See the Microsoft Foundry tools guide.Code interpreter tool (server-side)
Run Python code server-side in a sandboxed container with the Code Interpreter tool. See the Microsoft Foundry tools guide.Web search tool (server-side)
Search the internet for current information and sources. See the Microsoft Foundry tools guide.File search tool (server-side)
Search vector stores for relevant document content. See the Microsoft Foundry tools guide.Image generation tool (server-side)
Generate or edit images using GPT image models server-side in Azure AI Foundry. See the Microsoft Foundry tools guide.MCP tool (server-side)
Access external Model Context Protocol (MCP) servers. See the Microsoft Foundry tools guide.Azure Container Apps Dynamic Sessions
We need to get thePOOL_MANAGEMENT_ENDPOINT environment variable from the Azure Container Apps service.
See the Azure dynamic sessions setup instructions.
We need to install a python package.
Azure Logic Apps
Trigger Azure Logic Apps workflows to automate business processes and integrations. Install the package with thetools extra:
Toolkits
Microsoft Foundry Project Toolbox
Load tools dynamically from an Azure AI Foundry Toolbox via the Model Context Protocol (MCP). Install the package with thetools extra:
Microsoft Foundry tools (formerly Azure AI Services)
Install the integration package:AzureAIServicesToolkit toolkit includes the following tools:
- Image Analysis: AzureAIImageAnalysisTool
- Document Intelligence: AzureAIDocumentIntelligenceTool
- Speech to Text: AzureAISpeechToTextTool
- Text to Speech: AzureAITextToSpeechTool
- Text Analytics for Health: AzureAITextAnalyticsHealthTool
Runtime
Microsoft Foundry hosted agents
Microsoft Foundry hosted agents run custom LangGraph code in a managed runtime. Use thelangchain_azure_ai.agents.hosting package to expose a compiled LangGraph graph while Foundry manages the runtime, sessions, scaling, identity, and protocol endpoints.
LangGraph hosting support requires
langchain-azure-ai[hosting]>=1.2.8.
See the complete run samples for the Responses protocol and Invocations protocol.
Use the configuration-driven runner
If your agent already runs with the LangGraph CLI, uselangchain_azure_ai.agents.hosting.run tool from the same project directory. The runner uses the existing langgraph.json configuration to load the compiled graph, so no code change is needed.
Set the Foundry project endpoint and model deployment name, then select the protocol when you start the host:
- Responses
- Invocations
codeConfiguration.entryPoint on the agent service in azure.yaml to the same runner and protocol. Keep the existing project path, runtime, and dependency resolution settings:
- Responses
- Invocations
Use the SDK host classes
Use the SDK host classes when you need to customize server construction, control the server lifecycle directly, or implement advanced hosting behavior such as custom routes or handlers:- Responses
- Invocations
azd ai agent init to initialize a hosted-agent project, azd ai agent run to test it locally, and azd deploy to deploy it. Run azd provision first only when you need to create the Foundry project or other Azure resources. You can also deploy with the Foundry Toolkit Visual Studio Code extension.
The Microsoft Learn guide includes complete examples for both protocols, conversation state, human-in-the-loop flows, testing, deployment, and troubleshooting.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

