# LangGraph Guide: Stateful, Controllable Agent Workflows for Production

> LangGraph is an MIT-licensed framework that runs agents as a graph over explicit state, saves a checkpoint after every step and can pause for human approval. LangChain supplies model and tool integrations; LangGraph is the runtime underneath. Use it for long, multi-step processes with sign-offs.

Canonical URL: https://www.ruebstudio.de/en/guides/agent-frameworks/langgraph-guide  
Author: Dr.-Ing. Marcus Rüb, CEO  
Published: 2026-10-28

Most agent prototypes are a loop: ask the model, call a tool, repeat. That is fine for a demo. It is not fine for a process that runs for hours, needs a manager's sign-off halfway through and must carry on after a server restart. LangGraph was built for that second case. This guide covers its execution model, how it relates to LangChain, and when the extra effort is justified. Checked against LangGraph 1.2.18, October 2026.

## What is LangGraph and what is it used for?

LangGraph is an open-source framework from LangChain that runs agents and workflows as a graph of functions sharing one explicit state. It handles control flow, persistence, pauses for human decisions and streaming. Teams use it when an agent has to be traceable, interruptible and resumable rather than a black-box loop.

The [official overview](https://docs.langchain.com/oss/python/langgraph/overview) calls it "a low-level orchestration framework and runtime for building, managing, and deploying long-running, stateful agents". Low-level is the operative word. LangGraph does not dictate prompts or an agent architecture; it gives you a runtime on which you define both.

[PyPI](https://pypi.org/project/langgraph/) lists version 1.2.18, released on 26 October 2026, under the MIT licence, requiring Python 3.10 or later. Version 1.0 shipped on 22 October 2025 with a [public commitment](https://www.langchain.com/blog/langchain-langgraph-1dot0) to "no breaking changes until 2.0". If you plan to run an agent for several years, that commitment matters as much as any feature.

Where it tends to fit:

- **Multi-step business processes:** read a request, pull data from the ERP and document store, draft a response, get approval, send.
- **Agents with checkpoints for people:** the agent may call tools freely, but certain actions, such as placing an order or emailing a third party, wait for a human to confirm.
- **Long-running jobs:** research or analysis tasks that take minutes or hours and must survive a crash.
- **Several specialised agents:** separate subgraphs for research, review and writing, coordinated by a parent graph.

## How does LangGraph differ from LangChain?

LangChain is the toolkit for building blocks and quick agents: model integrations, tool definitions and, since version 1.0, the `create_agent` function. LangGraph is the runtime underneath that handles flow, state and persistence. You can use LangGraph without LangChain, and every LangChain agent already runs on LangGraph.

Both points come straight from the source. The [overview](https://docs.langchain.com/oss/python/langgraph/overview) says you do not need LangChain to use LangGraph, and the [1.0 release post](https://www.langchain.com/blog/langchain-langgraph-1dot0) states that `create_agent` "uses LangGraph under the hood". The same release deprecated the `langgraph.prebuilt` module and moved its ready-made agent helpers to `langchain.agents`.

In practice:

- **One agent with a model, some tools and a system prompt**, no special flow: `create_agent` in LangChain is enough, and you still get checkpointing because LangGraph sits below it.
- **A defined process with branches, approvals and deterministic steps** between model calls: model the graph yourself in LangGraph.
- **Both:** a hand-built graph can include a `create_agent` agent as one of its nodes.

If you are still choosing between LangGraph, the OpenAI Agents SDK, CrewAI or the Claude Agent SDK, start with our [comparison of AI agent frameworks](https://www.ruebstudio.de/en/guides/agent-frameworks/ai-agent-frameworks-comparison). That article weighs the options side by side; this one goes deep on a single framework and what its design means once you run it in production. Compared with the [Claude Agent SDK](https://www.ruebstudio.de/en/guides/agent-frameworks/claude-agent-sdk-guide), the key difference is who drives: there the model runs the agent loop and you steer through hooks and permissions, whereas in LangGraph you fix the flow as a graph and the model only works inside the nodes you give it.

## How does LangGraph work? The building blocks

A LangGraph program has a state object, nodes (Python functions) that read the state and return updates, and edges that decide which node runs next. You compile these into an executable graph and attach a checkpointer for persistence and pause points.

The [Graph API docs](https://docs.langchain.com/oss/python/langgraph/graph-api) put it in one line: "nodes do the work, edges tell what to do next". The pieces:

- **State:** usually a `TypedDict`; dataclasses and Pydantic models also work, the latter with validation at some speed cost. State is the single source of truth for a run.
- **Reducers:** define per field how updates are merged. The default overwrites. `operator.add` appends to lists, and `add_messages` appends chat messages or replaces them by ID.
- **Nodes:** sync or async functions that take the state and return a partial update. A node may call a model, query a database or run plain business rules.
- **Edges:** fixed edges via `add_edge`, conditional edges via `add_conditional_edges` with a routing function. `START` and `END` mark entry and exit.
- **`Command` and `Send`:** `Command` returns a state update and a jump target together. `Send` fans work out to a number of parallel node calls that you only know at runtime, the classic map-reduce pattern.
- **`compile()`:** runs structural checks, such as orphaned nodes, and takes the checkpointer and breakpoints. Nothing runs until you compile.

Execution follows a model inspired by Google's Pregel: work happens in super-steps, nodes that become active together run in the same super-step, and the run ends when no node is active. Since version 1.0.6 the default recursion limit is 1,000 super-steps; past that, LangGraph raises `GraphRecursionError` so a broken loop cannot burn model tokens indefinitely.

### Checkpointing is the real core

A checkpointer saves the run's state after each super-step, keyed by a `thread_id`. That one mechanism gives you conversation memory, human approvals, recovery after failures and the ability to step back to an earlier point.

The [checkpointer docs](https://docs.langchain.com/oss/python/langgraph/checkpointers) list these implementations:

| Package | Class | Intended use per docs |
|---|---|---|
| `langgraph-checkpoint` (bundled) | `InMemorySaver` | Experiments; lost on restart |
| `langgraph-checkpoint-sqlite` | `SqliteSaver` | Local development |
| `langgraph-checkpoint-postgres` | `PostgresSaver` | Production |
| `langgraph-checkpoint-mongodb` | `MongoDBSaver` | Production |

`graph.get_state(config)` returns the latest state, `get_state_history` lists earlier checkpoints, and `update_state` writes a new checkpoint with corrected values while leaving the original untouched. You can only resume at a super-step boundary. The `durability` option controls when writes happen: `"exit"` only at the end (fast, but no mid-run recovery), `"async"` alongside the next step, or `"sync"` before the next step starts (safest, slightly slower).

For data that should outlive a single thread, such as a user's preferences or facts the agent has learned, there is a separate [store](https://docs.langchain.com/oss/python/langgraph/persistence): a key-value store shared across threads.

### Interrupts give people a seat in the loop

Calling `interrupt()` inside a node stops the graph and hands a question to the outside world. The run waits in the checkpointer until your application resumes it with `Command(resume=...)` and the same `thread_id`, which can be days later and from a different process.

This is the [human-in-the-loop](https://www.ruebstudio.de/en/glossary/human-in-the-loop) pattern: a person decides at defined points, the agent does the rest. The example below drafts a supplier reply and waits for approval. It skips the model call so it runs as-is. Tested with `langgraph` 1.2.18 on Python 3.14, October 2026.

```python
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.types import interrupt, Command

class State(TypedDict):
    request: str
    draft: str
    approved: bool

def write_draft(state: State) -> dict:
    # an LLM call would go here
    return {"draft": f"Draft reply to: {state['request']}"}

def approval(state: State) -> dict:
    # pause until a person decides
    ok = interrupt({"please_review": state["draft"]})
    return {"approved": bool(ok)}

def route(state: State) -> str:
    return "send" if state["approved"] else END

def send(state: State) -> dict:
    print("sent:", state["draft"])
    return {}

builder = StateGraph(State)
builder.add_node("write_draft", write_draft)
builder.add_node("approval", approval)
builder.add_node("send", send)
builder.add_edge(START, "write_draft")
builder.add_edge("write_draft", "approval")
builder.add_conditional_edges("approval", route)
builder.add_edge("send", END)
graph = builder.compile(checkpointer=InMemorySaver())

config = {"configurable": {"thread_id": "po-1042"}}
result = graph.invoke({"request": "Delivery date for PO 1042"}, config)
print(result["__interrupt__"])
# later; with a durable checkpointer this can be another process
graph.invoke(Command(resume=True), config)
```

The first `invoke` stops at the interrupt and returns the review payload under `__interrupt__`. The second resumes with the decision. In production, swap `InMemorySaver` for `PostgresSaver`.

## Which variants and use cases are there?

You can use LangGraph at three levels: an explicitly modelled graph, the Functional API with ordinary Python control flow, or indirectly through LangChain's `create_agent`. Subgraphs add a fourth pattern for multi-agent systems. Which level fits depends on how fixed your process is.

**Graph API.** You declare state, nodes and edges. The flow is visible, can be rendered as a diagram and can be inspected at every super-step. This suits processes a business team could already sketch as a flowchart, such as [quotation](https://www.ruebstudio.de/en/ai-agents/quotation) with review and approval steps.

**Functional API.** The `@entrypoint` and `@task` decorators let you write normal Python with `if` statements and loops while still getting persistence, interrupts and streaming. Per the [docs](https://docs.langchain.com/oss/python/langgraph/functional-api), you skip the explicit state schema, but you lose visualisation because the graph is only created at runtime. Both APIs share one runtime and can be mixed.

**`create_agent` as an on-ramp.** If all you need for now is one agent with tools, start in LangChain and move to custom graphs once fixed process steps appear. Because both levels share a runtime, that move is a refactor, not a rewrite.

**Multi-agent setups via subgraphs.** A compiled graph can act as a node inside a parent graph, so you can build a research agent and a review agent separately and wire them together. The docs note that subgraphs keep their own checkpoint namespace; data that must cross graph boundaries belongs in the store. Whether several agents actually beat a single one is covered in our guide to [multi-agent systems](https://www.ruebstudio.de/en/guides/ai-agent-architecture/multi-agent-systems-guide).

Good candidates are processes with clear hand-offs: triaging requests in [technical service](https://www.ruebstudio.de/en/ai-agents/technical-service), research tasks in [knowledge management](https://www.ruebstudio.de/en/ai-agents/knowledge-management), or lead qualification in [sales](https://www.ruebstudio.de/en/ai-agents/sales). For a broader view of what agents typically take on inside a company, see [AI agents for business processes](https://www.ruebstudio.de/en/ai-agents).

## What do you need before starting a LangGraph project?

You need Python skills in the team, a database for checkpoints in production, access to a language model and a documented process with clear decision points. Without the last one, no framework will help: LangGraph makes a process explicit, it does not invent it for you.

In more detail:

- **Technical:** Python 3.10 or later for 1.2.18. A PostgreSQL or MongoDB instance for `PostgresSaver` or `MongoDBSaver`. Some way to run the graph as a service, for example a container behind an internal API.
- **Model access:** a hosted model via API or a self-hosted one. LangGraph does not care; the choice comes down to data protection and cost. If you need models to stay on your own hardware, see [sovereign AI](https://www.ruebstudio.de/en/sovereign-ai).
- **Systems:** read and write access to your ERP, CRM or document management system, exposed as tools with narrow, dedicated permissions.
- **Ownership:** a named person on the business side who decides where approvals sit and judges the output. Without that, nobody knows where an interrupt belongs.
- **Skills:** the team has to be comfortable with reducers, super-steps and idempotency. The learning curve is noticeably steeper than with frameworks that only offer an agent loop.

## How should you approach a LangGraph project?

Start from the process, not the code. Map the steps and decisions, derive state and nodes, place approval points, and only then add model calls. That keeps the deterministic share of the system large and confines the model to the places where judgement on unstructured input is genuinely needed.

1. **Sketch the process.** Steps, data, decisions, and who signs off. Paper is fine.
2. **Define the state.** Which fields does each step need? Which should append rather than overwrite, such as messages or collected evidence?
3. **Write nodes without a model first.** Stub logic like the example above proves the routing and approvals work.
4. **Add model calls and tools.** One per node, with clear inputs and outputs.
5. **Decide on persistence.** `PostgresSaver` for production, a `durability` mode that suits your run times, and a `thread_id` derived from a business ID. The [persistence docs](https://docs.langchain.com/oss/python/langgraph/persistence) advise keeping it under 255 characters for Postgres.
6. **Make it observable.** The [stream modes](https://docs.langchain.com/oss/python/langgraph/streaming) `updates`, `tasks` and `debug` show which node changed what. Whether you use LangSmith or your own logging is an operational choice; for everything else worth monitoring once agents are live, see [AgentOps](https://www.ruebstudio.de/en/guides/ai-agent-development/agentops-running-ai-agents).
7. **Test on real cases.** Replay past requests, have the business owner judge the results, and only then grant write access.

If you are still deciding which process to start with, a structured [workshop](https://www.ruebstudio.de/en/workshop) with the business teams usually gets you there faster than a technical inventory.

## What are LangGraph's limits and risks?

LangGraph solves flow and state, not output quality. A badly scoped process does not improve by turning it into a graph, and the freedom of a low-level runtime comes with complexity. There are also some technical traps worth knowing before an agent is allowed to write to live systems.

- **Learning curve.** Reducers, super-steps, subgraph checkpoint namespaces and durability modes are concepts in their own right. For a simple question-and-answer bot that is overhead.
- **Nodes restart after an interrupt.** The [interrupts docs](https://docs.langchain.com/oss/python/langgraph/interrupts) state that on resume "the runtime restarts the entire node from the beginning". Anything before `interrupt()` runs again, so non-idempotent actions such as placing an order belong after the interrupt or in a separate node.
- **No bare `try/except` around `interrupt()`.** Interrupts work by raising an exception internally; a broad `except` swallows it and the pause never happens.
- **Replays repeat model calls.** Stepping back to an earlier checkpoint reruns every later node, including LLM and API calls. That costs money and can duplicate side effects.
- **Checkpoint storage grows.** Checkpoints accumulate and add storage and latency. You need a retention policy.
- **`InMemorySaver` is not production storage.** A restart wipes every run and every pending approval.
- **Ecosystem pull.** The library is open and free, but the convenient tracing and hosting options come from LangChain itself. Decide deliberately which parts you run yourself.

When LangGraph is the wrong tool: a single model call over a document search, a team with nobody to maintain Python, or a process so unclear that nobody can draw it. In those cases, a simpler tool, or process work first, is the better investment.

## How do you get started with LangGraph?

Pick a small, real process with exactly one approval point. Build it without a model and with `InMemorySaver` first, then switch to Postgres once routing and approval behave. You learn the concepts on your own problem instead of a toy example, and you find out early whether the steeper learning curve is worth it for your team.

A practical first pass:

1. `pip install langgraph` in a Python 3.10+ environment, then adapt the example above to one of your own processes.
2. Replace one node with a real model call and watch the output with `stream_mode="updates"`.
3. Attach `PostgresSaver`, kill the process mid-run and resume with the same `thread_id`. Only when that works reliably is the agent ready for production.

If you have not settled on a framework yet, the [framework comparison](https://www.ruebstudio.de/en/guides/agent-frameworks/ai-agent-frameworks-comparison) helps narrow the field. For the question of which processes suit agents at all and how to run them inside a company, [AI agents for business processes](https://www.ruebstudio.de/en/ai-agents) is the next stop.

## Frequently asked questions

### Do I need LangChain to use LangGraph?

No. The official docs state that LangGraph works without LangChain. LangChain is simply a convenient way to connect models and tools.

### What does LangGraph cost?

The library is MIT-licensed and runs on your own infrastructure. You pay for the model APIs you call and for optional hosted services such as LangSmith, if you choose to use them.

### Which Python version does LangGraph need?

Version 1.2.18, released in October 2026, requires Python 3.10 or later according to PyPI.

### Can I use LangGraph with self-hosted models?

Yes. Nodes are plain Python functions, so they can call any model, including one running on your own servers. Orchestration is independent of the model.

### What happens if the server crashes mid-run?

With a durable checkpointer such as PostgresSaver and durability set to "sync", the run resumes from the last saved step. With InMemorySaver, every intermediate state is lost.

## Sources

- [LangGraph overview (LangChain docs)](https://docs.langchain.com/oss/python/langgraph/overview)
- [LangGraph Graph API](https://docs.langchain.com/oss/python/langgraph/graph-api)
- [LangGraph persistence](https://docs.langchain.com/oss/python/langgraph/persistence)
- [LangGraph checkpointers](https://docs.langchain.com/oss/python/langgraph/checkpointers)
- [LangGraph interrupts](https://docs.langchain.com/oss/python/langgraph/interrupts)
- [LangGraph Functional API](https://docs.langchain.com/oss/python/langgraph/functional-api)
- [LangGraph streaming](https://docs.langchain.com/oss/python/langgraph/streaming)
- [langgraph on PyPI](https://pypi.org/project/langgraph/)
- [LangChain and LangGraph Agent Frameworks Reach v1.0 Milestones](https://www.langchain.com/blog/langchain-langgraph-1dot0)
- [Claude Agent SDK overview](https://code.claude.com/docs/en/agent-sdk/overview)
