LangGraph
Low-level Python framework from LangChain for building stateful, long-running AI agents with durable execution, human-in-the-loop control and persistent memory.
Overview
LangGraph is a low-level orchestration framework for building, managing and deploying long-running, stateful agents, used in production by companies like Klarna, Replit and Elastic. Unlike opinionated agent frameworks, it gives you graph primitives (nodes, edges, state) and lets you build your own abstraction on top. It can be used standalone, without LangChain.
How it works
Agents get durable execution: they persist through failures and resume exactly where they left off on long-running tasks. You can also inspect or modify agent state at any point during execution before it continues (human-in-the-loop), and memory covers both short-term working state for a single run and long-term memory that persists across sessions. For debugging, LangSmith traces execution paths, captures state transitions and reports runtime metrics. If you want planning, subagents or file-system access without building the graph primitives yourself, pair LangGraph with Deep Agents, a higher-level package built on top of it.
Examples
- A durable customer-support agent that survives a process restart mid-task and resumes from its last checkpoint.
- Adding a human-approval step inside an agent's execution graph before a high-stakes action runs.
- Building a custom multi-agent architecture from scratch when CrewAI's
higher-level
Crew/Flowabstraction is too opinionated for the use case.
Installation
You need Python 3.9+ and an API key for whichever LLM provider you plan to use. LangGraph itself doesn't ship a model.
- Install the package, ideally inside a virtual environment:
pip install -U langgraph - Install the LangChain integration for your model provider, for example:
pip install langchain-openai - Set your provider's API key as an environment variable, for example
OPENAI_API_KEY. - Define your graph in Python (nodes, edges and state) and run it as a script.
- Optional: set
LANGCHAIN_TRACING_V2=trueandLANGCHAIN_API_KEYto inspect execution traces in LangSmith.
Related assets
Dify
Open-source LLM app development platform that combines a visual AI workflow canvas, RAG pipelines, agent tooling and model management in one workspace, for teams shipping production-ready AI apps.
Langflow
Visual Python platform for building and deploying AI agents and workflows, with full component source access, multi-agent orchestration and one-click export as an API or MCP server.
CrewAI
Code-first Python framework for orchestrating autonomous, role-based AI agents (Crews) alongside precise event-driven workflows (Flows), built to run standalone in production.