Skip to main content

langchain-azure-ai

This package integrates Microsoft Foundry with LangChain, LangGraph, and Deep Agents. For setup and examples, see the Microsoft Foundry development guide.

Start here

I want to... Start with
Call Microsoft Foundry models from LangChain, LangGraph, or Deep Agents Model quick start and development guide
Ask typed questions with the Decisions API Decisions quick start (experimental)
Host an existing compiled graph on Azure LangGraph-to-Foundry migration guide, hosting guide, and configuration-driven sample
Find deployable examples of hosted-agent features Hosted-agent sample chooser
Branch, rewind, or regenerate from a completed response Branching sample
Access agents on Microsoft Foundry Agent Service Agent Service quick start
Apply guardrails or use Foundry tools Content Safety and Microsoft Foundry Tools
Trace graph, model, and tool calls Application Insights tracing
Persist graph state FoundryCheckpointSaver backed by Foundry State Store or Azure Cosmos DB checkpointer
Store long-term memory across threads Foundry Memory (experimental) or Azure Cosmos DB store

Installation

pip install -U langchain-azure-ai

For using tools, including Azure AI Document Intelligence, Azure AI Text Analytics for Health, or Azure LogicApps, please install the extras tools:

pip install -U langchain-azure-ai[tools]

For using tracing capabilities with OpenTelemetry, you need to add the extras opentelemetry:

pip install -U langchain-azure-ai[opentelemetry]

For hosting LangGraph agents with the Responses or Invocations protocol, install the hosting extra:

pip install -U langchain-azure-ai[hosting]

If you are transitioning from Microsoft Foundry classic and you need access to deprecated classes, use [v1] extra.

pip install -U langchain-azure-ai[v1]

Quick Start with langchain-azure-ai

The langchain-azure-ai package connects LangChain, LangGraph, and Deep Agents applications to Microsoft Foundry models, agents, tools, and services.

This package includes:

For more details and tutorials, see the Microsoft Foundry development guide.

Calling Microsoft Foundry models

Prefer Microsoft Entra ID authentication with DefaultAzureCredential. For local development, sign in with az login.

Responses API

Call a Microsoft Foundry model using the Responses API:

from azure.identity import DefaultAzureCredential
from langchain_azure_ai.chat_models import AzureAIOpenAIApiChatModel
from langchain_core.messages import HumanMessage, SystemMessage

model = AzureAIOpenAIApiChatModel(
    endpoint="https://{your-resource-name}.services.ai.azure.com/openai/v1",
    credential=DefaultAzureCredential(),
    model="gpt-5",  # your model deployment name
    use_responses_api=True,
    store=False,  # Disable model-side response storage.
)

messages = [
    SystemMessage(
      content="Translate the following from English into Italian"
    ),
    HumanMessage(content="hi!"),
]

model.invoke(messages).pretty_print()
================================== Ai Message ==================================
Ciao!

You can also use built-in tools with the Responses API:

from langchain_azure_ai.tools.builtin import ImageGenerationTool

model_with_image_gen = model.bind_tools([ImageGenerationTool(model="gpt-image-1.5", size="1024x1024")])
result = model_with_image_gen.invoke(
    "Generate an image based on the following description: A futuristic cityscape at sunset with flying cars and neon lights."
)

Chat Completions API

Call an OpenAI-compatible Foundry model using the Chat Completions API:

from langchain_azure_ai.chat_models import AzureAIOpenAIApiChatModel

model = AzureAIOpenAIApiChatModel(
    endpoint="https://{your-resource-name}.services.ai.azure.com/openai/v1",
    # With DefaultAzureCredential(), explicitly set use_responses_api=False.
    credential="your-api-key",
    model="Mistral-Large-3",  # your model deployment name
)

model.invoke("Translate 'hi!' from English into Italian.").pretty_print()

Anthropic Messages API

Use AzureAIAnthropicChatModel to call Claude models deployed in Microsoft Foundry through the /anthropic endpoint with Microsoft Entra ID or API key authentication:

from azure.identity import DefaultAzureCredential
from langchain_azure_ai.chat_models import AzureAIAnthropicChatModel

model = AzureAIAnthropicChatModel(
    endpoint="https://{your-resource-name}.services.ai.azure.com",
    credential=DefaultAzureCredential(),
    model="claude-sonnet-4-20250514",  # your Claude deployment name
)

model.invoke("Translate 'hi!' from English into Italian.").pretty_print()

You can also pass project_endpoint instead of endpoint to resolve the resource URL automatically.

Decisions API (experimental)

Use AzureAIOpenAIApiDecisions to ask typed questions about a state. Requires langchain-azure-ai>=1.4.0 and a model deployment that supports the Decisions API.

from azure.identity import DefaultAzureCredential
from langchain_azure_ai.decisions import AzureAIOpenAIApiDecisions, Noul

decisions = AzureAIOpenAIApiDecisions(
    endpoint="https://{your-resource-name}.services.ai.azure.com/openai/v1",
    credential=DefaultAzureCredential(),
    model="your-decisions-deployment",  # your Decisions model deployment name
)

answer = decisions.invoke({
    "state": "Please refund the duplicate charge.",
    "questions": {"refund": Noul(instructions="Is a refund requested?")},
})
print(answer.nouls["refund"].noul)  # probability that a refund is requested

For API concepts and prerequisites, see the Azure OpenAI Decisions API documentation.

Embeddings

Generate embeddings for search and retrieval using an embedding model deployment:

from azure.identity import DefaultAzureCredential
from langchain_azure_ai.embeddings import AzureAIOpenAIApiEmbeddingsModel

embeddings = AzureAIOpenAIApiEmbeddingsModel(
    endpoint="https://{your-resource-name}.services.ai.azure.com/openai/v1",
    credential=DefaultAzureCredential(),
    model="text-embedding-3-small",  # your embedding model deployment name
)

query_vector = embeddings.embed_query("What is Microsoft Foundry?")
document_vectors = embeddings.embed_documents(
    ["Microsoft Foundry helps you build AI applications."]
)

Accessing agents on Microsoft Foundry Agent Service

Create a managed Foundry agent and add it as a LangGraph node.

For local development, install the package and sign in:

pip install -U langchain-azure-ai
az login

Using create_prompt_agent(..., trace=True) also requires the opentelemetry extra.

Set your project endpoint and model deployment name. This creates a version of my-echo-agent in your project:

from azure.identity import DefaultAzureCredential
from langchain_core.messages import HumanMessage
from langgraph.graph import END, START, StateGraph
from langchain_azure_ai.agents import AgentServiceAgentState, AgentServiceFactory
from langchain_azure_ai.utils.agents import pretty_print

factory = AgentServiceFactory(
    project_endpoint="https://{your-resource-name}.services.ai.azure.com/api/projects/{your-project}",
    credential=DefaultAzureCredential()
)

echo_node = factory.create_prompt_agent_node(
    name="my-echo-agent",
    model="gpt-4.1",  # your model deployment name
    instructions="Always reply with the opposite of what the user says.",
)

Agent Service nodes run in Microsoft Foundry but can be added to any graph:

graph = StateGraph(AgentServiceAgentState)
graph.add_node("expert_node", echo_node)
graph.add_edge(START, "expert_node")
graph.add_edge("expert_node", END)

Use the graph as usual:

agent = graph.compile()
messages = [HumanMessage(content="I'm a genius and I love programming!")]
response = agent.invoke({"messages": messages})

pretty_print(response)
================================ Human Message =================================

I'm a genius and I love programming!
================================== Ai Message ==================================
Name: my-echo-agent

You're not a genius and you don't love programming!

Applying Content Safety guardrails via middleware

Pass Content Safety middleware to LangChain's create_agent or Deep Agents' create_deep_agent. This example uses create_agent:

from langchain.agents import create_agent
from langchain_azure_ai.agents.middleware import AzureContentSafetyPolicyMiddleware

agent = create_agent(
    model=model,
    middleware=[
        AzureContentSafetyPolicyMiddleware(
            policy_id="your-guardrail-id",
            endpoint="https://your-resource.cognitiveservices.azure.com",
        )
    ],
)

This preview integration requires azure-ai-contentsafety>=1.1.0b1. It submits agent and model input/output and tool arguments/results to the service; the guardrail policy controls each intervention point. The same text may be checked at both agent and model boundaries. A blocked policy verdict raises ContentSafetyViolationError; allowed transformations are applied, and non-blocking findings are available via get_content_safety_annotations. Agent/model hooks screen text; tool hooks screen JSON-encoded arguments and results. See the runnable example.

Hosting LangGraph agents on Microsoft Foundry

These hosts accept compiled LangGraph graphs, including those returned by LangChain's create_agent and Deep Agents' create_deep_agent. For a complete Deep Agents example, see the Deep Agents hosting sample.

Responses protocol

Already have a compiled LangGraph graph? Keep its implementation, model, and tools. Point langgraph.json at its exported graph, as shown in the Responses run-entrypoint sample, then launch it from the directory containing that configuration:

pip install -U "langchain-azure-ai[hosting]"
python -m langchain_azure_ai.agents.hosting.run --protocol responses

You can also host the graph directly from Python, as shown below:

from langchain_azure_ai.agents.hosting import ResponsesHostServer

graph = build_my_graph()  # returns a compiled LangGraph graph

if __name__ == "__main__":
    ResponsesHostServer(graph).run()

ResponsesHostServer serves the OpenAI Responses-style /responses endpoint. The graph's input state must include a messages field. It supports JSON and streaming responses, background execution, conversation steering, and human-in-the-loop interrupts.

Conversation steering (steerable_conversations=True) and crash recovery (resilient_background=True) are experimental and emit feature-level ExperimentalWarning warnings when enabled.

For current feature support and configuration combinations, see the Responses hosting overview.

The Responses host uses one conversation-state source per graph. The policy depends on whether the hosted graph has a LangGraph checkpointer:

Graph configuration Conversation source Graph input on later turns
Graph compiled with a checkpointer LangGraph checkpoint state keyed by the conversation/thread ID and, when available, the platform-provided user partition key Current request input only
Graph without a checkpointer Responses transcript history from the underlying response provider Prior Responses history plus current input

Checkpointed multi-turn conversations use an explicit conversation.id or run with steerable_conversations=True. Both modes are linear and preserve the latest LangGraph checkpoint for subsequent turns.

[Experimental] Response branching: Enable enable_response_branching=True with a history-preserving checkpointer to branch from a completed response using previous_response_id. Enabling it emits an ExperimentalWarning. See the branching sample for branching, rewind, regeneration, and setup requirements.

Invocations protocol

Use InvocationsHostServer to serve your graph through the /invocations endpoint:

from langchain_azure_ai.agents.hosting import InvocationsHostServer

graph = build_my_graph()  # returns a compiled LangGraph graph

if __name__ == "__main__":
    InvocationsHostServer(graph).run()

To launch with langgraph.json, use --protocol invocations.

InvocationsHostServer also supports background execution, conversation steering, and human-in-the-loop interrupts. Enable resilient_background=True for durable background turns, or steerable_conversations=True to let a new turn supersede an active turn in the same agent_session_id. Resilient background execution requires a LangGraph checkpointer; use a durable checkpointer for hosted production deployments.

Steering and durable background recovery are experimental and emit feature-level ExperimentalWarning warnings when enabled.

See the Invocations hosting overview for configuration, request formats, polling, cancellation, and interrupt handling, and the Invocations run-entrypoint sample for setup and deployment.

Persisting graph state

Use FoundryCheckpointSaver to persist LangGraph runtime state, including checkpoints and pending writes, in Foundry State Store so a hosted graph can resume across turns and container restarts. It is an async-only checkpointer, separate from the Responses transcript store. Compile the graph with the saver and keep its async context open for the host's lifetime:

from langchain_azure_ai.agents.hosting import (
  FoundryCheckpointSaver,
  ResponsesHostServer,
)


async def main() -> None:
  async with FoundryCheckpointSaver() as checkpointer:
    graph = builder.compile(checkpointer=checkpointer)
    await ResponsesHostServer(graph).run_async()

Locally, FoundryCheckpointSaver uses files under ~/.agentserver/state_stores. Set AGENTSERVER_STATE_ROOT to choose another state root. Reuse that directory and the same conversation/thread ID across local restarts. These files stay on the local machine.

Foundry-hosted agents use Foundry State Store with container protocol 2.0.0, which supplies the hosted request context. See storage choices for the separate roles of graph checkpoints, conversation references, and response storage.

For an end-to-end example that selects an in-memory saver locally and FoundryCheckpointSaver when hosted, see the workflow sample. If you want database-backed checkpoints, use the async CosmosDBSaver in the Cosmos DB hosting guidance. Both hosts invoke graphs asynchronously, so CosmosDBSaverSync is not compatible. Cross-thread long-term memory is a separate concern; use a Foundry Memory store or a LangGraph store rather than a checkpointer for that purpose.

Storing long-term memory with Foundry Memory

Use AzureAIMemoryMiddleware (experimental) to extract memories from agent turns into an existing Microsoft Foundry Memory store and expose a matching retrieval tool to the agent:

from azure.identity import DefaultAzureCredential
from langchain.agents import create_agent
from langchain.chat_models import init_chat_model
from langchain_azure_ai.agents.middleware import AzureAIMemoryMiddleware

memory_middleware = AzureAIMemoryMiddleware(
    project_endpoint="https://{your-resource-name}.services.ai.azure.com/api/projects/{your-project}",
    credential=DefaultAzureCredential(),
    store_name="my-memory-store",
    scope="user:123",
    roles=["user", "assistant"],
)

agent = create_agent(
    model=init_chat_model("azure_ai:gpt-5"),
    tools=[memory_middleware.get_retriever_tool()],
    middleware=[memory_middleware],
)

To query a Foundry Memory store directly as a LangChain retriever, use AzureAIMemoryRetriever (experimental) standalone or obtain a history-bound retriever from AzureAIMemoryChatMessageHistory:

from azure.identity import DefaultAzureCredential
from langchain_azure_ai.retrievers import AzureAIMemoryRetriever

retriever = AzureAIMemoryRetriever(
    project_endpoint="https://{your-resource-name}.services.ai.azure.com/api/projects/{your-project}",
    credential=DefaultAzureCredential(),
    store_name="my-memory-store",
    scope="user:123",
    k=5,
)
docs = retriever.invoke("What are my preferences?")

Create the memory store in your Foundry project before use. See the Foundry Memory sample for an end-to-end multi-session example.

Tracing with Azure Application Insights

To trace your LangChain, LangGraph, or Deep Agents applications with Azure Application Insights, first install the OpenTelemetry extras:

pip install -U langchain-azure-ai[opentelemetry]

Then enable auto tracing in your application. Every BaseCallbackManager and LangGraph callback manager created after this call will automatically include the Azure tracer:

from langchain_azure_ai.callbacks.tracers import enable_auto_tracing

enable_auto_tracing(
    connection_string="<your-application-insights-connection-string>",
    auto_configure_azure_monitor=True,
    enable_content_recording=False,      # set to True to capture message payloads
    provider_name="azure.ai.openai",
    trace_all_langgraph_nodes=True,
)

For a complete end-to-end example, see samples/enable_auto_tracing_appinsights.py.

Using Microsoft Foundry Tools

Use AzureAIProjectToolbox (experimental) to load tools and skills from a managed Microsoft Foundry Toolbox over MCP. Install langchain-mcp-adapters before use:

pip install -U langchain-mcp-adapters
from langchain_azure_ai.tools import AzureAIProjectToolbox

toolbox = AzureAIProjectToolbox(
    project_endpoint="https://{your-resource-name}.services.ai.azure.com/api/projects/{your-project}",
    toolbox_name="my-toolbox",
)
tools = await toolbox.get_tools()

You can also pin a specific toolbox_version, inspect approval requirements with get_tools_requiring_approval(), and load toolbox skills or resources with get_skills() / aget_skills() and get_resources() / aget_resources(). See the Foundry Toolbox sample.

Use tools from Azure AI services as LangChain tools via AzureAIServicesToolkit. Available tools include Azure AI Content Understanding, Document Intelligence, Image Analysis, Text Analytics for Health, and more.

Azure AI Content Understanding is also available as a document loader via AzureAIContentUnderstandingLoader. See the Content Understanding loader notebook for a full walkthrough.

Changelog

  • 1.4.1:

    • [NEW] We added AzureAIMicrosoftDecisionsClassifier for compatible Microsoft Decision deployments on Foundry's System One API, supporting Noul, Choice, and Score questions, Foundry project or direct resource endpoints, API key or Microsoft Entra ID authentication, and synchronous or asynchronous calls. #1386
    • We renamed AzureAIOpenAIApiDecisions to AzureAIOpenAIApiDecisionsClassifier to align with OpenAIClassifier and AzureAIMicrosoftDecisionsClassifier. AzureAIOpenAIApiDecisions remains an alias at both existing import paths, and LangChain serialization keeps the original class ID so existing serialized Runnables remain loadable with either name in allowed_objects. #1392
    • We fixed create_prompt_agent() to preserve internal v2 agent conversation fields when a custom state_schema is supplied, keeping declared field annotations intact so tool outputs, MCP approvals, and multi-turn conversations work without subclassing AgentServiceAgentState. #1401 Thanks to @hyeonsang010716.
    • We fixed AzureContentModerationMiddleware and AzureProtectedMaterialMiddleware to split text longer than 10,000 characters into overlapping chunks and aggregate results across chunks instead of truncating at 10,000 characters. Long inputs now make one sequential service request per chunk, and null codeCitations is normalized to []. #1387 Thanks to @hyeonsang010716.
    • We fixed AzureContentModerationForImagesMiddleware to send image URLs using blob_url (blobUrl) instead of the invalid ImageData(url=...) argument. #1396 Thanks to @hyeonsang010716.
    • We fixed AzureContentModerationForImagesMiddleware to screen standard image blocks and Responses input_image blocks in addition to image_url blocks, skip image blocks without extractable data or URL (including null image_url), and screen each distinct image field when a block carries multiple sources. #1395 Thanks to @hyeonsang010716.
    • We fixed AzureAIOpenTelemetryTracer to end and export text_completion spans for text completion LLMs that return Generation objects without a message attribute. #1385 Thanks to @hyeonsang010716.
    • We updated model, hosting, Anthropic, Toolbox, Memory, and Microsoft Foundry documentation and fixed broken links and demo notebooks. #1384 #1397 #1399 #1400
  • 1.4.0:

    • [NEW, Experimental] We added AzureAIOpenAIApiDecisions for Azure OpenAI Decisions API integrations, including Foundry project endpoints and API key or Microsoft Entra ID authentication. #1343

    • We promoted InvocationsHostServer and ResponsesHostServer out of experimental status without changing their public interfaces. Conversation steering, resilient background execution, and response branching remain experimental and emit ExperimentalWarning when enabled. #1373

    • [Breaking change]: We tightened v2 agent MCP approval validation. Use boolean decisions, objects with a boolean approve and optional string reason, or the strings "true" and "false". Other values, including previously accepted shortcuts such as "yes" and "deny", now raise validation errors instead of being converted to approval decisions. #1337 Thanks to @hyeonsang010716.

      Migration tip: Replace Command(resume="yes") with Command(resume=True) and Command(resume="deny") with Command(resume=False). To include a reason, use Command(resume={"approve": False, "reason": "..."}). For approval ToolMessage content, use "true" / "false" or a JSON string such as '{"approve": false, "reason": "..."}'.

    • We fixed v2 agent input and output schemas to respect LangChain middleware annotations. Compatibility note: Private fields, including jump_to, are now ignored in input and omitted from invoke() results, so callers relying on their previous exposure must update their code. These fields remain available to middleware and checkpointers, and stream_mode="values" still includes the full state. #1372 Thanks to @hyeonsang010716.

    • We fixed v2 agents to execute every parallel function call, present every MCP approval request, and submit all corresponding outputs in order for both regular invocation and message streaming. #1345 Thanks to @hyeonsang010716.

    • We fixed AzurePromptShieldMiddleware to screen tool results before the agent model sees them, with the configured error, replace, or continue behavior. #1377 Thanks to @hyeonsang010716.

    • We fixed AzureAIMemoryMiddleware to track processed messages per thread, send each new turn without a checkpointer, and recover queued or failed updates still present in checkpointed messages after recreation. Initial history sends only the latest turn, and summarization messages are excluded. #1347 Thanks to @hyeonsang010716.

    • We made ResponsesHostServer reject resilient_background=True without a LangGraph checkpointer at construction, including when an existing app is supplied. #1351

    • We deferred optional tracing imports in v1 and v2 AgentServiceFactory until create_prompt_agent(trace=True), so disabling tracing no longer requires the opentelemetry extra. Requests with tracing enabled validate these dependencies before creating a remote agent. #1349

    • We expanded the Invocations and Responses hosting references and added a guide for deploying LangGraph as a Foundry hosted agent. #1333 #1334 #1268

  • 1.3.1:

    • We added a hosting telemetry flag that records whether response branching is enabled. #1307
    • We fixed AzureSearch.add_texts() and aadd_texts() to upload texts supplied as generators or other one-shot iterables instead of silently returning no results. #1330 Thanks to @hyeonsang010716.
    • We fixed AzureSearch.from_embeddings() and afrom_embeddings() to accept constructor options without forwarding them to document uploads, while preserving supplied document keys. #1328 Thanks to @hyeonsang010716.
    • We fixed Azure Search authentication to use a supplied token credential or the default Azure credential when the API key is empty or omitted. Nonempty API keys retain precedence. #1327 Thanks to @hyeonsang010716.
    • We fixed Azure Search custom field names to resolve when each store is constructed, so AZURESEARCH_FIELDS_* settings work after import and remain consistent across synchronous and asynchronous operations. #918 Thanks to @cr-sbarbouche.
    • We fixed Azure Search retriever filtering so search_kwargs={"filter": ...} no longer returns unfiltered results or raises TypeError. For 1.3.0 and earlier, use search_kwargs={"filters": ...} as a workaround. Passing both names now raises ValueError. #1303 Thanks to @hyeonsang010716.
    • We fixed asynchronous Azure Search MMR searches to return an empty list when no documents match. #817 Thanks to @0xDevNinja.
    • We fixed AzureAIChatCompletionsModel to send zero-valued settings such as temperature=0 and seed=0, and to let per-call options override model defaults without duplicate-keyword errors. #1269 Thanks to @pcbeingused333.
    • We fixed AzureAIImageAnalysisTool construction and visual-feature handling, included caption and denseCaptions in its output, and surfaced service failures instead of returning an empty result. #1302 Thanks to @hyeonsang010716.
    • We fixed AzureAIOpenTelemetryTracer to use the retriever's run or class name for retriever spans when no serialized name is available. #1321 Thanks to @hyeonsang010716.
    • We improved documentation for SDK setup, Agent Service, durable state, and hosting. #1299 #1308 #1309 #1315 #1329
  • 1.3.0:

    • [NEW, Experimental] We introduced opt-in response branching through ResponsesHostServer(graph, enable_response_branching=True). Requests with previous_response_id start from the completed parent's exact saved checkpoint, creating independent siblings without advancing the shared conversation head. This requires a retained parent, a history-preserving async checkpointer, steering disabled, and no externally supplied app; paused-parent branching is not supported. See the design document for usage scenarios and implementation gaps. #1263 #1260 #1288
    • [NEW] We added toolbox_version to AzureAIProjectToolbox to select a specific toolbox version. Omitting it or setting it to None keeps the default toolbox endpoint. #1294
    • [Breaking] We made ResponsesHostServer reject store=False with HTTP 400 before streaming or graph execution when a LangGraph checkpointer is configured. Clients must omit store or set store=True; foreground requests without a checkpointer still support store=False. Parent-response and branch-checkpoint validation also runs before streaming, returning HTTP 400/404 for invalid requests and a redacted HTTP 500 for unexpected backend failures. Clients must handle these HTTP errors before consuming Response or SSE events. #1290
    • [Breaking] We removed build_runnable_config_sync() from the experimental ResponsesHostServer. Callers must use await server.build_runnable_config(request, context). #1250
    • [Breaking] We removed isolation and TTL mismatch validation from FoundryCheckpointSaver and FoundryConversationChainStore. Existing stores retain their settings without rejecting mismatches. The chain store's on_mismatch argument is now a deprecated compatibility option; "fail" no longer rejects mismatches. Applications must provision existing stores with the intended isolation and TTL. #1235
    • [Breaking] We changed Responses execution errors from internal_error with exception details to server_error with the fixed message An internal error occurred.. Clients must update error-code handling and use server logs for details. #1232
    • We fixed HITL resumes by requiring langgraph>=1.2.16,<2.0, preventing completed tasks and their side effects from running again when outstanding interrupts are answered. #1258
    • We fixed Azure AI Inference streaming to preserve complete tool calls whose deltas omit index. #1221 Thanks to @pcbeingused333.
    • We fixed AzureAIOpenTelemetryTracer to mark handled tool failures returned as ToolMessage(status="error") as failed spans. #1160 Thanks to @Ko-Ko-Kirk.
    • We fixed cosine_similarity_top_k to return empty results when no candidate qualifies, honor explicit zero limits and thresholds, and preserve eligible zero or negative similarity scores. #1238 Thanks to @cr-sbarbouche.
    • We fixed AzureCosmosDBMongoVCoreSemanticCache to use a default similarity threshold of 0.5, rejecting weak matches while preserving explicitly configured thresholds, including 0.0. #1241 Thanks to @cr-sbarbouche.
    • We reduced hosting storage overhead by reusing State Store clients within a handler and cached store bindings across requests. #1232 #1262
    • We reduced repeated checkpoint and pending-write reads within Responses requests while preserving normal durability writes and latest-checkpoint checks. #1261
    • We cached response-chain root IDs to avoid repeatedly traversing response history. #1251
  • 1.2.12:

    • We fixed FoundryCheckpointSaver to select the latest checkpoint and order checkpoint history by LangGraph checkpoint ID rather than storage insertion order, including before filtering and namespace isolation. #1070 Thanks to @tanvir-ux.
    • We fixed a TypeError when selecting similarity or hybrid search with search_type in AzureSearch.asimilarity_search_with_score. #1211 Thanks to @revanth-045.
    • We fixed AzureAISearchRetriever to report search request errors instead of an unrelated KeyError when asynchronous searches fail. #1210 Thanks to @pcbeingused333.
    • We fixed the File Search example in the models notebook by importing FileSearchTool before binding it to the model. #1208
  • 1.2.11:

    • [NEW, Preview] We introduced AzureContentSafetyPolicyMiddleware to apply a Content Safety guardrail policy to agent and model messages, tool arguments, and tool results, with support for service-provided transforms and annotations. This requires azure-ai-contentsafety>=1.1.0b1. #1141
    • We mapped MCP approval responses to ordered approve/reject decisions for LangChain HumanInTheLoopMiddleware. Invalid or conflicting decisions fail the request without resuming pending interrupts. #1058
    • We preserved image and file attachments in hosted Responses requests and tool outputs. #1072 #1073
    • We preserved Responses text citations and their streaming annotation events in hosted agent output. #1074
    • We deferred model SDK imports during hosting startup while preserving the hosting User-Agent stamp, and added wrapt to the hosting extra so this instrumentation does not require the opentelemetry extra. #1155
    • We scoped AzureCosmosDBMongoVCoreSemanticCache lookups and clearing to the requested llm_string, preventing cache hits and deletions across model configurations. #1030 Thanks to @cr-sbarbouche.
    • We fixed AzureAIOpenTelemetryTracer to accept LangGraph interrupt and resume callbacks without callback errors. #1075 Thanks to @taekop.
    • We redacted agent finish output and retriever queries in AzureAIOpenTelemetryTracer when content recording is disabled. #1089 Thanks to @taekop.
    • We fixed agent requests to honor an explicitly selected agent version while preserving dynamic version resolution for version="latest". #1041
    • We fixed project endpoint resolution to match service names exactly and honor the supplied api_version. #1099 Thanks to @revanth-045.
    • We updated hosted Responses usage typing for SDK compatibility while preserving cache-write token counts. #1048 Thanks to @jkennedyvz.
  • 1.2.10:

    • We raised the minimum supported Python version from 3.10 to 3.11 in accordance with the repository's Python support policy. Users running Python 3.10 must upgrade their runtime to install this release. #1021
  • 1.2.8:

    • We extended AzureAIProjectToolbox to forward the x-agent-foundry-call-id header on toolbox calls, ensuring per-call isolation and authorization on the toolbox side for deployed agents (hosted agent container spec 2.0.0). #785
    • We fixed an issue where the LangGraph hosting wrapper for Microsoft Foundry (langchain_azure_ai.agents.hosting) did not stream model reasoning summaries. Hosted agents configured with reasoning summaries now emit them through the streaming Responses output. #771
  • 1.2.7:

    • [NEW] We extended AzureAIProjectToolbox with skills support: new get_skills/aget_skills methods load toolbox skills as DeepAgents-ready file mappings, and new get_resources/aget_resources methods fetch toolbox resources (such as skills) as LangChain Blob objects with flexible URI-scheme filtering. #700
  • 1.2.6:

    • We added a hosting User-Agent stamp on OpenAI and Anthropic SDK clients used by LangGraph agents hosted in Microsoft Foundry, so outbound model calls from hosted agents are correctly attributed to langchain-azure-ai/hosting. #671
    • We updated dependencies including aiohttp and the uv group to incorporate maintenance and security updates. #654 #657 #663 #667
  • 1.2.5:

    • We added messages_key configurability in AzureAIMemoryMiddleware to support agent states that use non-default message field names. #647
    • We improved Azure AI Memory and content safety middleware docstrings with clearer examples, and fixed memory retriever output context formatting for better usability. #647
  • 1.2.4:

    • [NEW] We introduced support for hosting LangGraph agents in Microsoft Foundry through ResponsesHostServer and InvocationsHostServer, including checkpoint integration for conversation state. #595
    • [NEW] We introduced Azure AI Memory turn-sync middleware and an on-demand memory retrieval tool to improve multi-turn memory workflows. #637
    • We fixed duplicate conversation history handling and improved parallel tool call handling in hosted Responses flows. #626
    • We updated Azure AI Content Understanding tooling to use the SDK to_llm_input helper for improved request shaping. #554
    • We introduced AzureAIProjectToolbox.get_tools_requiring_approval to help identify tools that require explicit user approval in agent flows. #537
    • We updated key dependencies such as urllib3, idna, and starlette to incorporate maintenance and security updates. #592 #582 #616 #623
  • 1.2.3:

    • [NEW] We introduced AzureAIProjectToolbox for accessing tools managed in Azure AI Foundry projects, simplifying tool configuration and management. #525
    • [NEW] We migrated speech-to-text tool for Azure AI from the community package, enabling speech integration capabilities. #499
    • We updated AzureAIOpenTelemetryTracer to emit OpenTelemetry spec-compliant spans for GenAI operations. #509
    • We patched 21 security alerts across dependency packages including langsmith, cryptography, langchain-core, and dev dependencies to improve package security posture. #496
  • 1.2.2:

    • [NEW] We introduced AzureAIContentUnderstandingLoader document loader for extracting content from documents, images, audio, and video using Azure AI Content Understanding. #423
    • [NEW] We introduced AzureAIContentUnderstandingTool for using Content Understanding as an agent tool, also available via AzureAIServicesToolkit. #446
    • We introduced context_extractor support across content safety middleware classes, so you can control how content is extracted from agent state before safety checks run. #419
    • We introduced context_extractor support for AzureGroundednessMiddleware and added a notebook example for easier adoption. #410
    • We changed the default implementation of init_chat_model("azure_ai:<your-model>") to use the OpenAI Responses API path for improved compatibility with modern LangChain chat model initialization. #409
    • We fixed an AttributeError in AzureAIOpenTelemetryTracer.on_chain_start when chain inputs were not dictionaries. #317
    • We upgraded the requests dependency for this package to include upstream security and maintenance updates. #417
    • We patched multiple high-severity dependency vulnerabilities (including PyJWT, orjson, and tornado) to improve package security posture. #412
  • 1.2.1:

    • You can now use context_extractor argument in classes langchain_azure_ai.agents.middleware. to configre how middleware instract extract content from your state.
    • We changed the default implementation of init_chat_model("azure_ai:<your-model>") to use OpenAI Responses API (this is also the default if using langchain>=1.2.3).
  • 1.2.0:

    • We now require langchain>=1.2 so our streaming implementation matches the latest version of langchain.
    • We introduced langchain_azure_ai.agents.middleware.content_safety.* namespace which unlocks the power of Azure AI Content Safety with LangChain.
    • We introduced langchain_azure_ai.tools.builtin.* namespace with server-side tools that can be used for models running in Microsoft Foundry.
    • We fixed an issue with duplicated spans generated in OpenTelemetry tracer. #398.
    • We fixed an issue in init_embeddings(provider="azure_ai") where an incorrect kwarg was passed.
  • 1.1.0:

    • Creating agents using Foundry Agents V1 has been deprecated in favor of V2. langchain_azure_ai.agents.AgentServiceFactory now using V2 implementation. Namespace langchain_azure_ai.agents.v1.AgentServiceFactory is marked as deprecated and requires the extra v1 to be used.
    • Chat and embedding models using Azure AI Inference SDK has been deprecated in favor of OpenAI-compatible APIs. Namespace langchain_azure_ai.chat_models.inference.AzureAIChatCompletionsModel and langchain_azure_ai.embeddings.inference.AzureAIEmbeddingsModel are marked as deprecated and require the extra v1 to be used.
  • 1.0.62:

    • We introduced support for asynchhronous agents operation and tracing using our OpenTelemetry tracer for context to propagate correctly. #290.
    • We introduced support for Bash operations in langchain-azure-dynamic-session. #238.
    • We introduced support for Agent Service V2 in Microsoft Foundry. PR #257.
    • We added a new tool to generate images based on OpenAI-compatible image generation models. PR #325
    • We fixed an issue when on_tool_start ignores enable_content_recording. Now it doesn't. #261.
    • We fixed a problem when uploaded files were not considered by the CodeInterpreterTool for the Agent Service. #256.
    • We fixed an issue when using AzureAIOpenTelemetryTracer on a Mac. #234.
  • 1.0.61:

    • This release reverts the code to the state of v1.0.5 while updating the version number to 1.0.61.
  • 1.0.5:

    • We fixed an issue with the content type of messages in AzureAIChatCompletionsModel. See #245.
    • We improve metadata generated for AzureAIOpenTelemetryTracer. See #233.
  • 1.0.4:

    • We fixed an issue with dependencies resolution for azure-ai-agents where the incorrect version was picked up. See #221.
    • We fixed an issue with AzureAIOpenTelemetryTracer where spans context was not correctly propagated when called from another service. See #217.
    • We fixed an issue where AzureAIOpenTelemetryTracer where context was deallocated incorrectly, preventing tools like langdev to correctly emit traces. See #212.
    • We introduced improvements in the order in which environment variables AZURE_AI_* are read.
    • Internal: We improved AzureAIOpenTelemetryTracer test coverage. See PR #239.
  • 1.0.2:

    • We updated the AzureAIOpenTelemetryTracer to create a parent trace for multi agent scenarios. Previously, you were required to do this manually, which was unnecesary.
  • 1.0.0:

    • We introduce support for LangChain and LangGraph 1.0.
  • 0.1.8:

    • We fixed some issues with AzureAIOpenTelemetryTracer, including compliant hierarchy, tool spans under chat, finish reason normalization, conversation id. See #167
    • We fixed an issue with taking image inputs for declarative agents created with Azure AI Foundry Agents service.
    • We enhanced tool descriptions to improve tool call accuracy.
  • 0.1.7:

    • [NEW]: We introduce LangGraph support for declarative agents created in Azure AI Foundry. You can now compose complex graphs in LangGraph and add nodes that take advantage of Azure AI Agent Service. See AgentServiceFactory
    • We fix an issue with the interface of AzureAIEmbeddingsModel #158.
    • We improve the signatures of the tools AzureAIDocumentIntelligenceTool, AzureAIImageAnalysisTool, and AzureAITextAnalyticsHealthTool PR #160.
  • 0.1.6:

    • [Breaking change]: Using parameter project_connection_string to create AzureAIEmbeddingsModel and AzureAIChatCompletionsModel is not longer supported. Use project_endpoint instead.
    • [Breaking change]: Class AzureAIInferenceTracer has been removed in favor of AzureAIOpenTelemetryTracer which has a better support for OpenTelemetry and the new semantic conventions for GenAI.
    • Adding the following tools to the package: AzureAIDocumentIntelligenceTool, AzureAIImageAnalysisTool, and AzureAITextAnalyticsHealthTool. You can also use AIServicesToolkit to have access to all the tools in Azure AI Services.
  • 0.1.4:

  • 0.1.3:

    • [Breaking change]: We renamed the parameter model_name in AzureAIEmbeddingsModel and AzureAIChatCompletionsModel to model, which is the parameter expected by the method langchain.chat_models.init_chat_model.
    • We fixed an issue with JSON mode in chat models #81.
    • We fixed the dependencies for NumpPy #70.
    • We fixed an issue when tracing Pyndantic objects in the inputs #65.
    • We made connection_string parameter optional as suggested at #65.
  • 0.1.2:

  • 0.1.1:

    • Adding AzureCosmosDBNoSqlVectorSearch and AzureCosmosDBNoSqlSemanticCache for vector search and full text search.
    • Adding AzureCosmosDBMongoVCoreVectorSearch and AzureCosmosDBMongoVCoreSemanticCache for vector search.
    • You can now create AzureAIEmbeddingsModel and AzureAIChatCompletionsModel clients directly from your AI project's connection string using the parameter project_connection_string. Your default Azure AI Services connection is used to find the model requested. This requires to have azure-ai-projects package installed.
    • Support for native LLM structure outputs. Use with_structured_output(method="json_schema") to use native structured schema support. Use with_structured_output(method="json_mode") to use native JSON outputs capabilities. By default, LangChain uses method="function_calling" which uses tool calling capabilities to generate valid structure JSON payloads. This requires to have azure-ai-inference >= 1.0.0b7.
    • Bug fix #18 and #31.
  • 0.1.0:

    • Introduce AzureAIEmbeddingsModel for embedding generation and AzureAIChatCompletionsModel for chat completions generation using the Azure AI Inference API. This client also supports GitHub Models endpoint.
    • Introduce AzureAIOpenTelemetryTracer for tracing with OpenTelemetry and Azure Application Insights.

Metadata

Release files for langchain-azure-ai 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-azure-ai 1.4.1
File Size Uploaded Provenance Actions
langchain_azure_ai-1.4.1.tar.gz 322.4 kB Without provenance Details for langchain_azure_ai-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-azure-ai 1.4.1
File Interpreter ABI Platform Actions
langchain_azure_ai-1.4.1-py3-none-any.whl Python 3 none any Details for langchain_azure_ai-1.4.1-py3-none-any.whl

Total release size: 693.2 kB

Release files / langchain_azure_ai-1.4.1.tar.gz

Download URL langchain_azure_ai-1.4.1.tar.gz
Size 322.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b001befe8558804af0477aafce5f81611256fad9f0741dc65043de2b0e2b8d41
BLAKE2b-256 checksum
How to use checksums
8e0cd69701d4fd0b00149b8b6235547a02b9aa876a036bf34e400013b2c96e63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / langchain_azure_ai-1.4.1-py3-none-any.whl

Download URL langchain_azure_ai-1.4.1-py3-none-any.whl
Size 370.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06a87b773a85d5ac5425bb3b4e007b8e66858a92a6884be8080fcc93554a69bb
BLAKE2b-256 checksum
How to use checksums
0c23d143605da143eda98fee3254fceb153b3306cbe30151480b17e2d902ad1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for langchain-azure-ai 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page