← Back to all agents
Framework Open Source

LangGraph

Build stateful, multi-actor agents as a graph from LangChain.

Our take

The framework to reach for when simple chains aren't enough.

What it is

LangGraph is a framework for building stateful, multi-step agent workflows as a graph. Nodes are functions (LLM calls, tools, routing logic) and edges define how state flows. It is the production-grade choice for agents that need cycles, human-in-the-loop, persistent memory, or fine-grained control over execution.

Best for

  • Build production agents with cycles, branching, and memory
  • Human-in-the-loop workflows (approve, edit, retry)
  • Multi-agent systems with explicit state management

Pros

  • Best-in-class for stateful, long-running agents
  • Python and TypeScript SDKs
  • Backed by LangChain — large ecosystem

Cons

  • Steeper learning curve than CrewAI or AutoGen
  • Tied to the LangChain ecosystem

Quick start

  1. Install: `pip install langgraph langchain-openai`.
  2. Define state with a TypedDict: { question, documents, route, generation, rewrite_count }.
  3. Add nodes as plain Python functions: router_node, retriever_node, grader_node, rewriter_node, generator_node.
  4. Build the graph: `workflow = StateGraph(State)`, add nodes + edges, then `add_conditional_edges` for the router / grader branches.
  5. Compile: `app = workflow.compile()` and call `app.invoke({...})` to run.

Sample input / output

Input
Input: "What's our company's data retention policy for EU customers?"
Graph nodes: router → [vector|graph|web|direct] → grader → [generate | rewrite (≤3) | web-fallback] → hallucination-check → END.
Output
 1. router → "vector" (factual / static knowledge)
 2. vector_node → 4 docs from internal policy repository
 3. grader → 3/4 docs graded "relevant"
 4. generator → answers from those 3 docs only
 5. hallucination_check → "grounded: yes" → END
Final answer with inline citations to each supporting document. ~6 LLM calls, no infinite loop.

Benchmarks

GitHub stars 12,000+ — github.com/langchain-ai/langgraph
SDKs Python and TypeScript
Key advantage Cycles + persistent state — full DAG control
Origin LangChain team; spun out as production-grade layer in 2025

Pricing

Free library; LangGraph Cloud paid

Underlying models

Any LLM (Claude, GPT-4o, Gemini, local models)

Self-hosting

Yes — LangGraph can be self-hosted under the MIT license. This gives you full control over data and deployment.

Should you pick this?

Pick it if You need fine-grained control over cycles, retries, human-in-the-loop, or persistent state — LangGraph is the graph-of-truth for serious agent workflows.
Skip it if You just want "a team of agents" with minimal mental model — CrewAI is faster. For one-step tasks you can do in a Jupyter cell, you probably don't need a graph at all.

Similar agents