Skip to content

Harness profile

LangGraph: agents as graphs you can pause, resume and inspect

LangGraph is an open-source framework from LangChain for building stateful agents as graphs of steps, with saved checkpoints so a run can pause, wait for a person and resume. It is best for long-running, multi-step work where you want explicit control over every path.

StudiedLast reviewed 4 min read

Explained from public sources. Mai has not built this yet.

On this page

In plain English

LangGraph lets you draw an agent as a flowchart in code: boxes for steps, arrows for what happens next. Some boxes are ordinary code and some ask an AI model to decide. After each step it saves where it got to, so the work can stop, wait for a person to check something, and pick up exactly where it left off, even after a crash or a restart. It is built by LangChain, the company behind the LangChain library, but can be used on its own.

How it works

The documentation describes LangGraph as a low-level orchestration runtime for long-running, stateful agents. It gives you three primitives and leaves the design to you:

  • State: one shared object that every step reads from and writes to.
  • Nodes: functions that do the work, such as a model call, a tool call or a plain calculation.
  • Edges: the control flow between nodes, including conditional edges that choose the next node and the fixed start and end points.

You build a graph from these, compile it, and run it with a thread ID. The thread ID names a conversation or job, and a checkpointer saves a snapshot of the state for that thread as the graph runs. The persistence docs list an in-memory saver for experiments, SQLite for development and Postgres for production.

In: Request. Then Plan node, Tool node, Draft node. Then Interrupt. Then Send node. Then Checkpointer, Store.

Each step saves a checkpoint, so the graph can pause for a person and resume on the same thread

Human-in-the-loop. A node calls interrupt() with whatever the person needs to see. The graph saves its state and hands control back. Later, your application resumes the same thread with the person’s answer, and that answer becomes the return value of the interrupt. The docs are clear that the node then restarts from its beginning, so any code before the interrupt runs twice and should be safe to repeat.

Memory. Checkpoints give short-term memory within a thread. A separate store holds long-term facts, such as user preferences, across threads. The docs suggest most applications use both, and recommend pruning old checkpoints.

Tools and MCP. LangGraph does not prescribe how tools are defined. LangChain provides an MCP adapter that turns the tools on MCP servers, local or remote, into tools an agent can call.

Tracing and hosting. Debugging, tracing and evaluation come from LangSmith, LangChain’s separate platform. LangSmith Deployment hosts stateful agents. LangSmith has a free tier for individuals; team plans and deployments are paid.

LangGraph is MIT licensed. Python is the main library, LangGraph.js covers JavaScript and TypeScript, and it is model-agnostic because nodes are your own code. LangChain also publishes Deep Agents, a higher-level agent harness with planning, sub-agents and file tools built on LangGraph.

What it does best

  • Explicit control. Every path the agent can take is written down as nodes and edges, so you can mix fixed business logic with model decisions and see exactly where each one sits.
  • Durable runs. Checkpoints mean a run can survive failures and long pauses. This is the core reason to choose it.
  • Pausing for people. Interrupts with resumable threads are a clean fit for review and approval steps that may take hours.
  • Inspection. Because state is saved at each step, you can look at what the agent knew at any point, and the docs list time travel as a checkpoint use.
  • No lock-in on design. It does not impose prompts or an agent architecture, so it can host a simple loop or a large multi-agent system.

Where it stops

  • It is low level on purpose. You design the graph, the state and the prompts. For a ready-made agent loop, the docs point you to LangChain agents or Deep Agents instead.
  • Persistence is yours to run. Production use needs a durable checkpointer such as Postgres, and checkpoints grow over time.
  • The best tooling is a separate product. Tracing, evaluation and hosted deployment are LangSmith features, with their own pricing.
  • More moving parts. For a single conversation with a few tools, a graph is often more structure than the job needs.

Where it goes wrong

The subtle one is the interrupt restart. Because the paused node runs again from the top on resume, a side effect placed before the interrupt, such as sending an email or writing a record, can happen twice unless it is idempotent. The docs also ask that interrupts happen in the same order every run. Other trouble comes from using the in-memory saver beyond testing and losing every paused job on restart, or from letting checkpoints pile up with no retention policy.

How Mai AI uses it

I would reach for LangGraph when a client process runs over hours or days, has real branches, and must stop for a person at known points: a quote that needs sign-off, a document chased through several stages. Its checkpoints and threads map directly onto long-running jobs, and interrupts onto human approval gates.

The idea I take from it, even when I use something else, is to save state after every meaningful step and to treat resume as a normal event rather than an error. I also borrow its split between thread memory and a cross-thread store when designing how agents remember. To see where this fits in a whole system, read how Mai AI designs custom AI operations systems.

Questions and answers

Is LangGraph free?

Yes. The LangGraph library is open source under the MIT licence. LangSmith, the separate LangChain platform for tracing and hosted deployment, has a free tier for individuals and paid plans for teams and deployments.

What is the difference between LangChain and LangGraph?

LangGraph is the low-level runtime that runs stateful agent graphs with checkpoints, streaming and human-in-the-loop. LangChain is the higher-level framework with model and tool integrations and ready-made agent loops. LangGraph can be used without LangChain.

How does human-in-the-loop work in LangGraph?

A node calls interrupt, which saves the graph state through a checkpointer and returns control to your application. You resume the same thread later with a command carrying the person’s answer, and the node runs again from its start.

Does LangGraph work with JavaScript?

Yes. Python is the main library, and LangGraph.js is the JavaScript and TypeScript version with its own documentation.

Sources

  1. LangGraph overviewdocs.langchain.com
  2. Interruptsdocs.langchain.com
  3. Persistencedocs.langchain.com
  4. LangChain MCP integrationdocs.langchain.com
  5. LangChain pricinglangchain.com
  6. langgraph on GitHubgithub.com