Skip to main content
Browse LangChain Python integrations for Microsoft Foundry and Azure. For package selection, shared Azure setup, memory, vector stores, and hosted agents, see Azure AI integrations.
Recommended: Microsoft FoundryFor new LangChain, LangGraph, or Deep Agents applications centered on Microsoft Foundry, start with langchain-azure-ai. It adds Foundry project endpoints, Azure credential integration, Agent Service, hosting, tools, Content Safety, retrieval, and Azure observability.For direct Azure OpenAI v1 API model access, code that switches between OpenAI and Azure, traditional Azure OpenAI API versions, completion LLMs, or a smaller dependency surface, use the langchain-openai package.

Explore integrations

Chat models

Choose an integration to call chat models:
  • Microsoft Foundry (recommended): To call models in Microsoft Foundry, use AzureAIOpenAIApiChatModel from langchain-azure-ai. It handles project endpoint resolution and Microsoft Entra ID authentication through Azure credentials.
  • Azure OpenAI: Use ChatOpenAI from langchain-openai for direct v1 API calls or code shared between OpenAI and Azure. Use AzureChatOpenAI for traditional dated Azure OpenAI API versions.
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. Prefer AzureAIAnthropicChatModel from langchain-azure-ai for Foundry project endpoints and Microsoft Entra ID. You can also use ChatAnthropic from langchain-anthropic pointed at your Foundry Anthropic endpoint.

Microsoft Foundry

Use langchain-azure-ai to call models deployed in Microsoft Foundry through LangChain’s chat model interface.

Azure OpenAI (chat models)

Use langchain-openai to call Azure OpenAI models through LangChain’s chat model interface.

Call a model

Call a model deployed in your Foundry project. Install langchain-azure-ai and set AZURE_AI_PROJECT_ENDPOINT and AZURE_AI_MODEL_DEPLOYMENT_NAME. Configure Microsoft Entra ID authentication for your environment. On Azure, use a managed identity. For local development, you can sign in with az login.
For setup and usage examples, see Microsoft Foundry chat models.

LLMs

Azure OpenAI (text completions)

Call Azure OpenAI text-completion models through LangChain’s LLM interface.

Agents

Use an existing Foundry agent as a node in your LangGraph workflow. To host a new LangGraph agent on Microsoft Foundry, see Runtime.

Microsoft Foundry Agent Service

Use langchain-azure-ai to invoke Foundry Agent Service agents as nodes in a LangGraph workflow.

Use an existing Foundry agent

Install langchain-azure-ai and set AZURE_AI_PROJECT_ENDPOINT. Configure Microsoft Entra ID authentication for your environment. Replace my-echo-agent with your agent name.
For more on using Foundry agents in LangGraph, see Microsoft Foundry Agent Service.

Runtime

Microsoft Foundry hosted agents run your LangGraph code on managed infrastructure. Foundry manages compute, session lifecycles, and scaling. Responses hosting options can enable background execution, failure recovery after process interruptions, stream replay, and steering for new user input. These options are off by default. Expose your agent through OpenAI-compatible Responses endpoints or Invocations endpoints with custom JSON inputs and outputs. The LangGraph hosting adapters handle request conversion, response mapping, and streaming. Responses also provides managed conversation history. Hosted agents can call Foundry models and Toolbox tools with a dedicated Microsoft Entra agent identity. Foundry also supports RBAC, private networking, and Content Safety guardrails. Application Insights tracing helps investigate failures.

Microsoft Foundry hosted agents

Deploy LangGraph applications to Microsoft Foundry as hosted agents.

Azure Durable Task Scheduler

Add durable execution, retries, and crash recovery to LangGraph workflows.

Host a LangGraph agent

Run an existing compiled LangGraph graph locally with langchain-azure-ai[hosting]. From your configured project directory, point langgraph.json at the exported graph. Set the Foundry project endpoint and model deployment name, then start the Responses endpoint:
To deploy, use azd ai agent init to initialize a hosted-agent project with the same hosting entry point in azure.yaml, azd ai agent run to test locally, and azd deploy to deploy. Run azd provision first only when you need to create the Foundry project or other Azure resources:
For project configuration and deployment steps, see Microsoft Foundry hosted agents.

Tools

Azure AI services

Use Azure AI services for document analysis, image analysis, and speech processing.

Microsoft Foundry built-in tools

Use built-in tools for web search, file search, code execution, and image generation.

Microsoft Foundry Toolbox

Access built-in tools, tools from MCP servers, and skills through Microsoft Foundry Toolbox.

Azure Logic Apps

Let agents invoke Azure Logic Apps workflows as tools.

Middleware

Azure AI Content Safety

Apply Content Safety checks to agent inputs and outputs.

Sandboxes

Azure Container Apps dynamic sessions

Run Python code in ephemeral Azure Container Apps sessions.

Azure Container Apps sandboxes

Use langchain-azure-compute[sandboxes] to give Deep Agents stateful workspaces on Azure Container Apps.

Backends

Azure Blob Storage

Persist Deep Agents workspace files in Azure Blob Storage.

Retrievers

Azure AI Search

Retrieve documents from an existing Azure AI Search index.

Embedding models

Microsoft Foundry

Generate text embeddings with models deployed in Microsoft Foundry.

Azure OpenAI

Generate text embeddings with models deployed in Azure OpenAI.

Vector stores

Azure Cosmos DB for MongoDB vCore

Store embeddings and search documents in Azure Cosmos DB for MongoDB vCore.

Azure Cosmos DB for NoSQL

Store embeddings and search documents in Azure Cosmos DB for NoSQL.

Azure Database for PostgreSQL

Run vector search in Azure Database for PostgreSQL with DiskANN indexing.

Azure SQL Database

Store and query vector embeddings in Azure SQL Database.

pgvector

Store embeddings and search PostgreSQL data with the pgvector extension.

Azure AI Search

Store embeddings and run vector, hybrid, and semantic searches in Azure AI Search.

Chat message history

Azure Cosmos DB (chat message history)

Persist and retrieve conversation messages in Azure Cosmos DB.

Caches

Azure Cosmos DB (semantic cache)

Reuse cached model responses for semantically similar prompts with Azure Cosmos DB.

Document loaders

Azure Blob Storage

Load files from Azure Blob Storage as LangChain documents.