Lesson 3 of 4 Multi-Agent Orchestration Patterns and Frameworks

Orchestrating Agents with LangChain and LangGraph

This lesson explains the roles of LangChain and LangGraph, widely used open-source frameworks that run against Foundry model deployments, and the LangGraph concepts that multi-agent designs rely on.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe what LangChain provides.
  • Explain LangGraph state, nodes, edges and checkpointers.
  • Build multi-agent structures in LangGraph and host them on Azure.

LangChain

LangChain provides standard interfaces for chat models, embeddings, retrievers and tools, with integrations for many providers, including Azure OpenAI and Foundry models. Its agent API creates a tool-calling agent from a model, a list of tools and a system prompt. LangChain suits building individual agents and retrieval chains quickly; for durable, multi-step and multi-agent control flow, LangChain agents are built on LangGraph.

True or false

LangChain's role

Exam skills 2.4.6

Check what LangChain provides and where LangGraph takes over.

Log in to try this activity Interactive activities are free with an account.

LangGraph concepts

LangGraph models an agent system as a graph: a typed state object, nodes that are functions or agents updating the state, and edges, including conditional edges that choose the next node from the state. A checkpointer saves the state after each step, which enables persistence across requests (threads), time travel for debugging and resumption after failure. The interrupt() function pauses a node for human input, and the graph resumes when it is invoked with a Command(resume=...).

from typing import TypedDict
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import MemorySaver     # use a durable checkpointer in production
from langgraph.types import interrupt, Command

class Claim(TypedDict):
    text: str
    amount: float
    decision: str

def assess(state: Claim) -> dict:
    return {"decision": assessor.invoke(state["text"])}      # an LLM agent or chain

def approve(state: Claim) -> dict:
    answer = interrupt({"question": "Approve payout?", "amount": state["amount"]})
    return {"decision": "approved" if answer == "yes" else "rejected"}

g = StateGraph(Claim)
g.add_node("assess", assess)
g.add_node("approve", approve)
g.add_edge(START, "assess")
g.add_conditional_edges("assess", lambda s: "approve" if s["amount"] > 1000 else END)
g.add_edge("approve", END)
app = g.compile(checkpointer=MemorySaver())

cfg = {"configurable": {"thread_id": "claim-881"}}
app.invoke({"text": "...", "amount": 2400.0, "decision": ""}, cfg)     # pauses at interrupt
app.invoke(Command(resume="yes"), cfg)                                # resumes from the checkpoint
Spot the bug

A claims graph that skips approval

Exam skills 2.4.6 · 2.4.2

Find the lines in this LangGraph code that cause the problems described.

Log in to try this activity Interactive activities are free with an account.

Multi-agent structures and hosting

LangGraph builds multi-agent systems as graphs of agent nodes: a supervisor node that routes to worker agents (hub-and-spoke or orchestrator-subagent), agents that hand off by returning a Command that names the next node (peer-to-peer), and subgraphs that encapsulate teams. On Azure, LangGraph applications run as Foundry hosted agents (preview), on Azure Container Apps or on AKS, using a durable checkpointer backed by a database and exporting OpenTelemetry traces to Application Insights.

The following table compares the frameworks.

Microsoft Agent Framework
Core modelAgents plus typed workflow graphs
PersistenceCheckpoints
Human-in-the-looprequest_info events, tool approval
Built-in patternsSequential, concurrent, handoff, group chat, Magentic
LanguagesPython and .NET
LangGraph
Core modelTyped state graph of nodes and edges
PersistenceCheckpointers per thread
Human-in-the-loopinterrupt() and Command(resume)
Built-in patternsSupervisor and handoff patterns, subgraphs
LanguagesPython and JavaScript
Match the pairs

LangGraph structures and Agent Framework equivalents

Exam skills 2.4.6

Match each LangGraph mechanism with its Microsoft Agent Framework counterpart.

Log in to try this activity Interactive activities are free with an account.
Worked example

Keeping an existing LangGraph investment

A team has a mature LangGraph claims system with custom nodes and a PostgreSQL checkpointer. Management wants it to run on Azure with Foundry tracing and Entra ID authentication, with minimal rewriting.

The LangGraph code can be kept and deployed as a hosted agent or a Container Apps service, with the checkpointer pointed at Azure Database for PostgreSQL, models called through Foundry with a managed identity, and OpenTelemetry exported to the project's Application Insights. Rewriting in Agent Framework would be justified only by a requirement the existing code cannot meet.

Check yourself

What does LangGraph need in production so that runs can resume?

Show answer

A durable checkpointer, keyed by thread ID.

Exam Tips

Remember for the exam

  • LangGraph: typed state, nodes, conditional edges, checkpointers, interrupt() for approval.
  • Use a durable checkpointer in production, keyed by thread ID.
  • Existing LangGraph code runs on Azure without rewriting.