Back to Skill Directory

Agent Framework

Stateful GraphPython & JSMIT

LangGraph

by LangChain · langchain-ai/langgraph

LangGraph is LangChain's production-grade framework for building stateful, graph-based agents. Instead of a hidden ReAct loop, you declare explicit nodes, edges, and shared state — giving you full control over branching, cycles, interruption, and persistence in long-running LLM workflows.

With built-in checkpointers (SQLite, Postgres, Redis), LangGraph agents become durable: they survive crashes, support human-in-the-loop approval, and can time-travel to any prior state. This is the framework the LangChain team themselves recommend for any agent destined for production.

14k+
Stars
fast-growing
LangChain
Backed By
Series A funded
Py + JS
Runtimes
parity across both
MIT
License
open source

Quick Install

pip install langgraph

Key Features

Explicit State Graph

Declare nodes, edges, and a shared State schema. The graph is introspectable, visualizable, and debuggable — no more hidden agent loops.

Checkpointers

Persist state at every step to SQLite, Postgres, or Redis. Resume mid-flow after a crash or a user comes back tomorrow — durable agents out of the box.

Human-in-the-Loop

Interrupt the graph at any node for approval, edit state, then resume. Ideal for agents that take irreversible actions (payments, emails, code merges).

Time Travel

Rewind the graph to any prior checkpoint and branch off. Invaluable for debugging: reproduce a failure, tweak state, and re-run from the exact failure point.

Multi-Agent Patterns

Supervisor, hierarchical, and swarm topologies as first-class primitives. Compose agent teams without writing custom orchestration code.

LangGraph Platform

Managed deployment with scaling, task queues, and monitoring. Self-host with any Postgres, or deploy to the cloud service — same graph code.

Execution Brief

Use this page as a rollout checklist, not just reference text.

Suggest update

Tool Mapping Lens

Organize Tools by Workflow Phase

Catalog-oriented pages work best when users can map discovery, evaluation, and rollout in a clear path instead of reading an undifferentiated list.

  • Define the job-to-be-done first
  • Group tools by stage
  • Prioritize by adoption friction

Actionable Utility Module

Skill Implementation Board

Use this board for LangGraph before rollout. Capture inputs, apply one decision rule, execute the checklist, and log outcome.

Input: Objective

Deliver one measurable improvement with langgraph langchain stateful agent framework graph orchestration production

Input: Baseline Window

20-30 minutes

Input: Fallback Window

8-12 minutes

Decision TriggerActionExpected Output
Input: one workflow objective and release owner are definedRun preview execution with fixed acceptance criteria.Go or hold decision backed by repeatable evidence.
Input: output quality below baseline or retries increaseLimit scope, isolate root issue, and rerun controlled test.One confirmed correction path before wider rollout.
Input: checks pass for two consecutive replay windowsPromote to broader traffic with fallback path active.Stable rollout with low operational surprise.

Execution Steps

  1. Record objective, owner, and stop condition.
  2. Execute one controlled preview run.
  3. Measure quality, latency, and correction burden.
  4. Promote only when pass criteria are stable.

Output Template

tool=langgraph langchain stateful agent framework graph orchestration production
objective=
preview_result=pass|fail
primary_metric=
next_step=rollout|patch|hold

What Is LangGraph?

LangGraph is a Python and TypeScript library for building stateful, graph-based LLM applications. It is developed by the LangChain team and is now the recommended framework for any agent workload that needs to go beyond a single LLM call or a simple ReAct loop.

The core abstraction is a StateGraph. You define a State (typically a TypedDict), register nodes that receive state and return partial updates, and connect nodes with edges — some static, some conditional on state. When you invoke the graph, LangGraph threads state through nodes, calls LLMs or tools as each node requires, and returns the final state.

Crucially, LangGraph separates state from code. This means you can checkpoint state at every step, rewind to any prior checkpoint, branch off into alternate timelines, and interrupt execution for human approval. These capabilities are what turn an agent demo into a production workflow.

LangGraph also ships high-level helpers. create_react_agent gives you a tool-using agent with one line. Prebuilt patterns exist for supervisor-based multi-agent systems, hierarchical teams, and swarm coordination. You can start simple and gradually expose more of the graph as your needs grow.

How to Calculate Better Results with langgraph langchain stateful agent framework graph orchestration production

Install with pip install langgraph. Optionally add a checkpointer: pip install langgraph-checkpoint-postgres for production, or use the default MemorySaver for development. Import StateGraph and your preferred LangChain chat model.

Define your State. For a simple chat agent, from langgraph.graph import MessagesState is enough — it provides a messages list with append semantics. For a custom workflow, define a TypedDict with the fields you need to thread through the graph.

Build the graph. Create a StateGraph(State), add nodes with graph.add_node("name", node_fn), connect with graph.add_edge("a", "b") or graph.add_conditional_edges("a", router_fn, {"yes": "b", "no": "c"}). Compile with graph.compile(checkpointer=saver).

Invoke and iterate. graph.invoke({"messages": [HumanMessage("...")]}, config={"configurable": {"thread_id": "123"}}) runs the graph with a thread id that identifies the checkpoint stream. Stream with graph.stream for token-level UI updates.

Treat this page as a decision map. Build a shortlist fast, then run a focused second pass for security, ownership, and operational fit.

When a team keeps one shared selection rubric, tool adoption speeds up because evaluators stop debating criteria every time a new option appears.

Worked Examples

Human-in-the-loop refund approval agent

  1. Build a graph with three nodes: lookup_order, propose_refund, execute_refund
  2. Configure the graph to interrupt before execute_refund using interrupt_before
  3. User reports "I want a refund on order 12345" — agent runs lookup and composes a refund proposal
  4. Graph pauses with state containing the proposed refund amount and reason
  5. Support manager reviews proposed refund in a dashboard, optionally edits the amount, and approves
  6. Graph resumes from execute_refund node with updated state and performs the actual Stripe refund

Outcome: A production-safe agent that cannot take irreversible financial actions without human approval, while still automating 90 percent of the refund workflow.

Resumable long-running research agent

  1. Build a graph that plans a research task, searches N sources, summarizes each, and composes a final report
  2. Use Postgres as the checkpointer so every node completion is persisted
  3. User kicks off research at 10am with thread_id=research-abc
  4. At noon the user closes the laptop — the agent has completed 7 of 15 source summaries
  5. At 3pm the user resumes: graph.invoke(None, config={"configurable": {"thread_id": "research-abc"}})
  6. LangGraph restores state and continues from source 8, eventually producing the full report

Outcome: A durable research agent that survives session interruptions, crashes, and deploys — behavior impossible to achieve with stateless ReAct-style agents.

Frequently Asked Questions

What is LangGraph?

LangGraph is a library for building stateful, multi-step LLM applications as directed graphs. Each node is a function (or LLM call), edges define flow, and a shared State object threads through the graph. Unlike the classic LangChain Agent, LangGraph gives you explicit control over state transitions, cycles, branching, and checkpointing — making it the preferred framework for production agents that need reliability and observability.

How is LangGraph different from LangChain?

LangChain provides chains, tools, and the original AgentExecutor. LangGraph is a separate library (built by the same team) that focuses on stateful orchestration. You can use LangChain components (LLMs, tools, retrievers) inside LangGraph nodes, but the control flow is a graph rather than a linear chain or a ReAct loop. For anything beyond a simple agent, LangGraph is the recommended path forward from the LangChain team itself.

How do I install and start with LangGraph?

pip install langgraph (Python) or npm install @langchain/langgraph (JS/TS). Define a State type (usually a TypedDict), create a StateGraph, add nodes with graph.add_node, connect them with graph.add_edge or conditional edges, compile with graph.compile(), and invoke with graph.invoke({initial state}). A prebuilt create_react_agent helper gets you a tool-using agent in a few lines.

What is the checkpointer and why does it matter?

Checkpointers persist graph state at every step to SQLite, Postgres, or Redis. This unlocks three production features: (1) durable execution — resume an agent after a crash or a user leaves and returns, (2) human-in-the-loop — pause for approval and resume from the exact node, (3) time travel — rewind the graph to any prior state and branch off. Without a checkpointer you have a stateless agent; with one you have a resumable workflow.

Can LangGraph run in production?

Yes. LangGraph Cloud (now LangGraph Platform) offers a managed deployment with horizontal scaling, task queues, and monitoring. Self-hosted, you wrap the compiled graph in a FastAPI or Express service, use Postgres as the checkpointer, and deploy like any other backend. The framework is explicitly designed for long-running, durable agent workflows — not just demos.

When should I choose LangGraph vs CrewAI vs AutoGen?

Choose LangGraph when you want explicit control over state, branching, and persistence — it scales from single agents to complex multi-agent systems. Choose CrewAI for role-based multi-agent teams with a simpler mental model. Choose AutoGen when you want a research-grade multi-agent conversation framework with Microsoft's backing. LangGraph is the most production-oriented of the three in 2026.

Missing a better tool match?

Send the exact workflow you are solving and we will prioritize a new comparison or rollout guide.