# Repository Briefing: langchain-ai/langchain-azure
> Source: https://repoforai.com/repo/langchain-ai/langchain-azure (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/langchain-ai/langchain-azure
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Jupyter Notebook
- **License**: MIT
- **Engineering Health**: A+ (93/100 · Maintenance 35/35 · Adoption 18/25 · Releases 20/20 · License 20/20)
- **Latest Release**: libs/sqlserver/v1.1.0 (2026-12-02) — https://github.com/langchain-ai/langchain-azure/releases
- **Review Snapshot**: 2026-11-30 (Note: libs/sqlserver/v1.1.0 on 2026-12-02 shipped after this review; verify latest release notes)
- **Deployment / Stack Signals**: MCP, API
- **Momentum**: 148 ★ total (+0 24h / +0 7d) · 104 forks
- **When to Use**: Best for: Teams already using LangChain or LangGraph that want to add Foundry inference, managed agent nodes, or Azure-backed graph state and execution without moving every component at once. Skip if: You need fully offline inference, want to avoid Azure service dependencies, or only need a thin client for one Foundry endpoint.

## Overview
```text
### Architecture & Core Mechanics
This is a Python integration monorepo, not a standalone agent runner. Under `libs/`, `langchain-azure-ai` bridges LangChain and LangGraph to Foundry SDK clients, while sibling packages cover compute, Cosmos DB, Dynamic Sessions, SQL Server, PostgreSQL, and Azure Storage. The model adapter can be instantiated directly as `AzureAIOpenAIApiChatModel` or selected through the `azure_ai` provider in `init_chat_model`.

There are two distinct boundaries for agent execution. `AgentServiceFactory.create_prompt_agent_node()` exposes a Foundry-managed prompt agent as one node in a graph with the required `AgentServiceAgentState` fields; the surrounding graph does not have to be hosted on Foundry. Alternatively, Foundry can host the whole graph through its hosted-agent interfaces. `langchain_azure_compute.graph` is a separate execution integration backed by Azure Durable Task Scheduler.

### Key Capabilities & Differentiators
`AzureAIOpenAIApiChatModel` uses OpenAI-compatible Foundry endpoints, with `use_responses_api` selecting Responses or Chat Completions where the model and endpoint support the chosen API. The model name identifies a deployment, not a bundled model. The AI package also integrates Foundry tools, Content Safety middleware, and Azure AI Search as a vector-store backend.

For state, Foundry-hosted agents can use `FoundryCheckpointSaver` with Foundry State Store, while Cosmos DB offers both a LangGraph checkpointer and a separate long-term memory store. For execution, the Durable Task Scheduler integration supports compiled LangGraph workflows and LangChain agents with per-step and per-tool fault isolation, automatic worker failover, and durable `interrupt()` / `resume()` waits. Checkpoint storage and execution recovery are separate design decisions.

### Trade-offs & Limitations
For a service that only calls a Foundry model, the direct Foundry SDK is the simpler option: there is no graph or adapter layer to maintain. For an existing LangGraph application, the repository provides a way to adopt Azure integrations selectively. Calling a managed agent as a node is a smaller migration than moving the entire runtime. This is also the replacement path for Azure adapters in `langchain-community`, but migrations should verify authentication and behavior for the adapters actually in use.

Portability decreases as the application takes dependencies on Foundry hosting, Azure-backed state, or Durable Task Scheduler. Running the graph in your own environment gives you control over the application process, not independence from remote inference or storage. The SDK is MIT-licensed; service charges and terms, endpoint quotas, identity roles, and data retention remain Azure deployment concerns.

### Hardware & Deployment Guide
For a local model integration, install `langchain-azure-ai` with pip, configure a Foundry project endpoint and model deployment, and use `az login` with `DefaultAzureCredential` for local Entra ID authentication. The project-endpoint example requires the Azure AI Developer role; the key-auth example uses `endpoint` rather than `project_endpoint`. Prompt-agent tracing with `create_prompt_agent(..., trace=True)` requires the `opentelemetry` extra.

Local development still calls Azure over the network; this is not an offline inference stack. For managed hosting, start with `samples/hosting/langgraph-hosted-agents/`, which covers prerequisites, local runs, and deployment. In the `libs/azure-ai` release line, v1.3.1 fixed credential-based `AzureSearch.from_texts` without a key, v1.4.0 documented the Responses and Invocations hosting interfaces, and v1.4.1 disabled model response storage in hosted-agent samples. Treat the last change as sample behavior, not a global retention policy.
```

## Key Capabilities
```text
- Model interface: AzureAIOpenAIApiChatModel supports Responses API and Chat Completions on compatible Foundry endpoints.
- Managed agent composition: AgentServiceFactory exposes a Foundry prompt agent as a LangGraph node with an AgentServiceAgentState-compatible schema.
- Graph hosting: Foundry samples cover Responses and Invocations interfaces and show how to run an existing graph unchanged.
- State and memory: Foundry State Store and Cosmos DB back graph checkpoints; Cosmos DB also offers a separate long-term memory store.
- Durable execution: Azure Durable Task Scheduler backs step and tool fault isolation, worker failover, and durable interrupt/resume waits.
- Search and safety: langchain-azure-ai includes Azure AI Search vector-store integration, Foundry tools, and Content Safety middleware.
```

## Quick Start / Clone
```bash
pip install -U langchain-azure-ai
```
