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.
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.
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.
Patterns it is known for
- PatternLong-running jobs
An AI agent can follow a task for days or weeks only if the task lives outside the agent, as a saved record of goal, progress and next step that survives restarts. The agent wakes, reads the record, does one step, writes it back and sleeps, so nothing depends on one long conversation.
- PatternHuman approval gates
Human approval gates sort every action an AI agent can take into three levels: draft only, needs a person to approve, or allowed to run automatically. The agent prepares, a person signs off anything that matters, and the system refuses any action that does not match what was approved.
- PatternAgent memory
AI agents remember in layers: short-term context is what the model can see in the current conversation, and long-term memory is stored outside the model and fetched back in when relevant. Vector stores find memories by meaning, graph stores by how people, records and events connect.
- PatternRouting and specialist agents
Routing means one agent reads each request and hands it to the specialist best placed to handle it, such as finance, operations or sales. Each specialist has its own instructions, tools and permissions, which keeps answers sharper and access tighter than one agent trying to do everything.
- PatternTraces and audit logs
You see what an AI agent did and why by recording a trace of every run, each model call, tool call and decision as a timed step, plus a separate audit log of every action that changed something and who approved it. Traces are for debugging; the audit log is the permanent record.
Related entries
- Harness profileOpenAI Agents SDK
The OpenAI Agents SDK is an open-source library, in Python and TypeScript, for building agents that use tools, hand work to each other and pause for approval. It suits teams that want a light agent loop with tracing built in, rather than a full orchestration platform.
- Harness profileMicrosoft Agent Framework
Microsoft Agent Framework is Microsoft’s open-source framework for agents and multi-agent workflows in .NET and Python, and the direct successor to both AutoGen and Semantic Kernel. It is best for teams on Azure or .NET that want typed, checkpointed workflows with approvals and OpenTelemetry tracing.
Sources
- LangGraph overviewdocs.langchain.com
- Interruptsdocs.langchain.com
- Persistencedocs.langchain.com
- LangChain MCP integrationdocs.langchain.com
- LangChain pricinglangchain.com
- langgraph on GitHubgithub.com