Skip to content
3.2Advanced7 min

LangGraph: Stateful Agents as a Directed Graph

Blck Alpaca·
Definition

LangGraph is a low-level orchestration framework from LangChain Inc. for building long-running, stateful AI agents. It models agents as a directed graph of nodes and edges with shared state, persistent checkpointing, human-in-the-loop and streaming. The current version is 1.2.0 (as of May 2026), licensed under MIT.

Key Takeaways

  • LangGraph models agents as a directed graph: nodes execute logic, edges control the flow, and a shared state is updated via reducers.
  • Its core strength is durable execution: persistent checkpointing allows pausing, resuming and human-in-the-loop approvals in long-running workflows.
  • LangGraph is the controlled orchestration layer on top of LangChain, not its replacement: LangChain provides models and 750+ tools, LangGraph the stateful flow control.
  • It suits complex, regulated, long-running multi-step workflows with audit requirements; for simple single-shot tasks it is over-engineered.
  • Used in production by Klarna, Replit, Uber, LinkedIn and Elastic, among others; observability via LangSmith, self-hostable on EU infrastructure such as STACKIT, IONOS or OVHcloud.
  • The price of the learning curve: graph mental model and verbosity (around 120 instead of 40 lines of code for a ReAct agent according to third-party analyses).

LangGraph is a low-level orchestration framework from LangChain Inc. for building long-running, stateful AI agents. It models an agent not as a linear script execution but as a directed graph of nodes and edges with a shared state object, persistent checkpointing, human-in-the-loop points and streaming. The current version is 1.2.0 (as of May 2026), the licence is MIT, and Python and JavaScript/TypeScript are supported.

Anyone who wants to run agents productively beyond pure LLM API calls needs controlled flow control with reliable state. That is exactly what LangGraph is built for: a low level of abstraction, explicit control, durable execution.

Quick answers

  • What it is: An orchestration layer that describes agent workflows as a graph of nodes (logic) and edges (control flow) over a shared state.
  • What it suits: Complex, controlled, long-running multi-step workflows, especially with state, approvals and audit requirements.
  • Distinction: LangGraph is not the successor to LangChain, but the stateful orchestration on top of it. LangChain provides models and tools, LangGraph the flow.

The core model: nodes, edges, state, reducers

LangGraph describes an agent as a state graph. Three building blocks support the model:

  • State: A typed, shared object that travels through the entire graph. Each step reads from the state and writes back to it. The state is the single source of truth about the progress of a run.
  • Nodes: Functions that do work, such as calling an LLM, executing a tool or validating a result. A node receives the current state and returns a state update.
  • Edges: They determine which node runs next. Conditional edges allow branching based on the state, so that loops, retries and dynamic paths are possible that a linear pipeline structure cannot represent.

The concept of the reducer is important. When multiple nodes write to the same state field, such as a list of messages, the reducer defines how the updates are merged, for example appending instead of overwriting. This keeps parallel or iterative steps conflict-free. This is the difference between a fragile, self-built agent loop and a controlled state machine.

Persistence and checkpointing: durable execution

The most important production property of LangGraph is durable execution via checkpointing. After each step, the state is persisted in a backend. This results in three practical capabilities:

  • Pausing and resuming: A run can be halted and later resumed at exactly the same point without loss of progress.
  • Fault tolerance: If a long-running workflow crashes, it does not start from zero but from the last checkpoint.
  • Time travel: Earlier state can be inspected and the run re-branched from a specific point, which considerably eases debugging and auditability.

LangGraph brings mature mechanisms for this, including the DeltaChannel and per-node timeouts (graceful drain), which are documented in the current releases.

Human-in-the-loop, streaming, subgraphs

Human-in-the-loop (HITL): Because the state is persistent, a graph can halt at a defined point and wait for a human decision, such as an approval before a paid or irreversible action. Only after confirmation does the workflow continue. This is exactly what regulated industries with a human-oversight requirement need.

Streaming: LangGraph streams intermediate results, tokens and step progress. A type-safe streaming path (v2) and content-block streaming (v3) are available, so that UIs can display the agent's progress live.

Subgraphs: A graph can be embedded as a node in a larger graph. This makes it possible to encapsulate reusable agent modules and to cleanly compose complex multi-agent architectures such as supervisor or swarm patterns, instead of forcing everything into a monolithic flow.

Pseudocode: a simple graph

The following pseudocode example shows a minimal agent loop: a model node decides, a tool node executes, a conditional edge closes the loop.

```
State = {
messages: list # Reducer: append, do not overwrite
}

def call_model(state):
response = llm.invoke(state.messages)
return {"messages": [response]}

def call_tools(state):
result = tools.run(state.messages[-1].tool_calls)
return {"messages": [result]}

def should_continue(state):
if state.messages[-1].has_tool_calls:
return "tools" # conditional edge -> execute tool
return END # answer complete -> finish

graph = StateGraph(State)
graph.add_node("model", call_model)
graph.add_node("tools", call_tools)
graph.set_entry_point("model")
graph.add_conditional_edges("model", should_continue)
graph.add_edge("tools", "model") # loop back to the model

app = graph.compile(checkpointer=Checkpointer())
app.invoke({"messages": [user_input]}, config={"thread_id": "customer-42"})
```

The thread_id binds the run to a checkpoint thread. It is precisely this mechanism that makes it possible to resume the same conversation or process thread later, instead of starting over each time.

LangGraph vs. LangChain: the distinction

A common confusion: LangGraph is not the next version of LangChain. Both originate from LangChain Inc. but serve different purposes. LangChain is the library for models, prompts and tool integrations (over 750 tools in the ecosystem). LangGraph is the low-level orchestration that brings these building blocks together into a stateful, long-running flow. Migration from classic LangChain to LangGraph proceeds incrementally, and existing LangChain components remain usable.

In the ecosystem, a clear layering emerges: LangChain (library and integrations) provides the building blocks, LangGraph (orchestration, durable) controls the flow, LangSmith (eval and observability) provides tracing, and the LangGraph Platform, respectively LangSmith Deployment, offers managed hosting.

Feature and benefit at a glance

Feature

Practical benefit

Directed graph (nodes/edges)

Explicit control over branching, loops and retries instead of opaque agent loops

Shared state with reducers

Conflict-free merging of updates across many steps

Persistent checkpointing

Durable execution: pausing, resuming, fault tolerance, time-travel debugging

Human-in-the-loop

Approvals before critical actions, meets human-oversight requirements

Streaming (v2 type-safe / v3 content-block)

Live progress in the UI, better user experience during long runs

Subgraphs

Reusable agent modules, clean multi-agent composition

Per-node timeouts, DeltaChannel

Robust behaviour and graceful drain in production

LangSmith observability (OTel)

Tracing and audit trails for regulated workloads

Concrete example: a controlled process with approval

A B2B agency builds an agent for an insurance client that pre-processes claims: read documents, extract data, check against policies, involve a case handler for approval when an amount exceeds 5,000 euros, then create the case.

With LangGraph this becomes a graph with four nodes and a conditional edge at the threshold. If the amount exceeds the limit, the graph halts at a HITL point and persists its state; after approval it continues. If the system fails in the meantime, it resumes from the last checkpoint and no document is processed twice. Every step is traceable in LangSmith, which satisfies auditability.

The price of this control is the learning curve. Third-party analyses put the additional effort at around 120 lines of code for a ReAct agent compared to about 40 in lighter frameworks. In return, the flow is deterministically controllable instead of a hard-to-debug black-box loop. LangGraph is used in production by Klarna, Replit, Uber, LinkedIn and Elastic, among others.

For agencies and B2B teams

LangGraph is the right choice when you need controlled, long-running and auditable agents, not the fastest demo prototype. For DACH clients with GDPR and sovereignty requirements, the decisive point is: the framework is open source (MIT) and fully self-hostable, for example on STACKIT, IONOS or OVHcloud. The managed solution LangSmith is US-based, so the status of EU data residency should be clarified in advance (not legal advice). As the agency Blck Alpaca, we evaluate with you whether LangGraph, a lighter framework or a lean direct solution fits your use case, and implement the architecture in a sovereignty-compliant way. Get in touch with us for a framework evaluation.

FAQ

What is the difference between LangGraph and LangChain?
LangChain is the library for models, tools and integrations (over 750 tools). LangGraph is the low-level orchestration layer on top of it, which controls long-running, stateful agents as a directed graph. LangGraph does not replace LangChain but continues to use its components. Migration from classic LangChain to LangGraph happens incrementally.
When should I choose LangGraph over a simpler framework?
LangGraph fits complex, controlled, long-running workflows with state, multi-step logic, human-in-the-loop or audit requirements in regulated industries. For simple rapid prototyping it is too verbose (around 120 instead of 40 lines of code for a ReAct agent according to third-party analyses). Following the Anthropic principle: start with the simplest solution, and only reach for a framework once you have more than three tools plus state.
What does checkpointing mean in LangGraph?
Checkpointing persists the graph state after each step in a storage backend. This enables durable execution: a workflow can be interrupted, resumed later or paused for a human approval without losing the progress made so far. It is the foundation for human-in-the-loop and long-running processes.
Does LangGraph support MCP and A2A?
As of May 2026, LangGraph integrates the Model Context Protocol (MCP) via a community adapter (langchain-mcp), not natively. The Agent-to-Agent protocol (A2A) is also connected via adapters. Frameworks such as CrewAI, the Microsoft Agent Framework or Pydantic AI support these protocols natively in part.
Which languages does LangGraph support?
LangGraph supports Python and JavaScript/TypeScript first-class. A Java variant exists as a third-party project (langgraph4j). This makes it suitable for teams in both major web and backend ecosystems, unlike CrewAI for example, which is Python-only.
Is LangGraph GDPR- and sovereignty-ready?
The framework itself is open source (MIT) and fully self-hostable, for example on EU infrastructure such as STACKIT, IONOS or OVHcloud. This makes a DACH-compliant architecture possible. The managed solution LangSmith, respectively LangGraph Platform, is US-based; here the status of EU data residency should be clarified before signing a contract. This is not legal advice.

Want to go deeper?

Get new analyses straight to your inbox – or see how we put this knowledge to work for companies.