
LangGraph
You define the agent's flow as a graph of nodes and shared state; the model decides only what happens inside a node
What is LangGraph?
LangGraph has you define the agent's flow as a graph. Nodes are the units of work — an LLM call, a tool run — edges decide which node runs next, and every node reads and writes one shared state. Edges can branch on that state to form loops, and the state is checkpointed at each node, so a run can stop for a person's approval and resume later, or restart from the last checkpoint after a crash. The cost is code: a simple tool-calling agent takes noticeably more setup here than elsewhere.
What can you do with LangGraph?
- Define the flow as a graph — You place each step as a node and wire the edges between them yourself. The model decides what happens inside a node — never which node runs next.
- One shared state across every node — Findings, retry counts, approval flags: the run carries a single state object, and every node reads it and writes back to it.
- Branch and loop on the state — Conditional edges route the run based on the state — or send it back: search, draft, check, and search again when the draft falls short.
- Resume from a checkpoint — The state is saved at every node, so a run that dies partway restarts from the last checkpoint instead of from the beginning.
- Pause for human approval — The run can stop at a node you pick, so a person can inspect and correct what is about to happen before it continues.
- Start higher up with Deep Agents — Deep Agents, built on top of LangGraph, covers planning, sub-agents and file use — skip designing the graph when you do not need that control.
Before you choose LangGraph
- Restarting picks up from the last saved point, not the last thing the agent did. On the managed service, slow steps have been reported to run two or three times over, and cancelling a run can lose the newest state.Reported in#7417#5672
- The approval step is a building block rather than a finished feature — you assemble the review screen yourself, and asking a person several questions in a row has shown the earlier question again instead of the new one.Reported in#8026#3275
- The tool the project points to for seeing what an agent did, LangSmith, is a separate paid product: free for one person up to 5,000 traces a month, $39 per seat beyond that, and self-hosting only on the Enterprise plan.
Star history
15 Aug to 28 Aug · +899
Frequently asked questions
Is LangGraph free for commercial use?
LangGraph is released under the MIT licence — OSI-approved open source, which permits commercial use.
How can LangGraph be deployed?
LangGraph is available as Self-hosted / Managed cloud.
Documentation
Reproduced from the langchain-ai/langgraph README, published under MIT. Read the original ↗
Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents.
pip install -U langgraph
[!TIP] If you’re looking to quickly build agents, check out Deep Agents — a higher-level package built on LangGraph for agents that can plan, use subagents, and leverage file systems for complex tasks.
For an equivalent JS/TS library, check out LangGraph.js and the JS docs.
Why use LangGraph?
LangGraph provides low-level supporting infrastructure for any long-running, stateful workflow or agent:
- Durable execution — Build agents that persist through failures and can run for extended periods, automatically resuming from exactly where they left off.
- Human-in-the-loop — Seamlessly incorporate human oversight by inspecting and modifying agent state at any point during execution.
- Comprehensive memory — Create truly stateful agents with both short-term working memory for ongoing reasoning and long-term persistent memory across sessions.
- Debugging with LangSmith — Gain deep visibility into complex agent behavior with visualization tools that trace execution paths, capture state transitions, and provide detailed runtime metrics.
- Production-ready deployment — Deploy sophisticated agent systems confidently with scalable infrastructure designed to handle the unique challenges of stateful, long-running workflows.
[!TIP] For developing, debugging, and deploying AI agents and LLM applications, see LangSmith.
LangGraph ecosystem
While LangGraph can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools for building agents.
To improve your LLM application development, pair LangGraph with:
- Deep Agents – Build agents that can plan, use subagents, and leverage file systems for complex tasks.
- LangChain – Provides integrations and composable components to streamline LLM application development.
- LangSmith – Helpful for agent evals and observability. Debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and improve performance over time.
- LangSmith Deployment – Deploy and scale agents effortlessly with a purpose-built deployment platform for long-running, stateful workflows. Discover, reuse, configure, and share agents across teams – and iterate quickly with visual prototyping in LangSmith Studio.
Documentation
- docs.langchain.com – Comprehensive documentation, including conceptual overviews and guides
- reference.langchain.com/python/langgraph – API reference docs for LangGraph packages
- LangGraph Quickstart – Get started building with LangGraph
- Chat LangChain – Chat with the LangChain documentation and get answers to your questions
Discussions: Visit the LangChain Forum to connect with the community and share all of your technical questions, ideas, and feedback.
Additional resources
- Guides – Quick, actionable code snippets for topics such as streaming, adding memory & persistence, and design patterns (e.g. branching, subgraphs, etc.).
- LangChain Academy – Learn the basics of LangGraph in our free, structured course.
- Case studies – Hear how industry leaders use LangGraph to ship AI applications at scale.
- Contributing Guide – Learn how to contribute to LangChain projects and find good first issues.
- Code of Conduct – Our community guidelines and standards for participation.