Production stateful agent orchestration: graphs with durable execution, human-in-the-loop oversight, and built-in deployment infrastructure.
Before you start
Python 3.10+ or Node.js 18+ • pip install langgraph or npm install @langchain/langgraph • Solid single-agent foundation
LangGraph defines agents as graphs: nodes are functions, edges are transitions, and a state object flows between them. Read the core concepts doc before writing any code. The mental model is everything.
LangGraph supports checkpointing: the graph state is saved between turns, enabling human-in-the-loop, long-running workflows, and resumable runs. Use the built-in MemorySaver or a database-backed checkpointer.
Enable LangSmith by setting LANGCHAIN_TRACING_V2=true and LANGCHAIN_API_KEY before any agent runs. Every node execution, state snapshot, and LLM call will be queryable in the LangSmith UI, this is the primary debugging tool for complex graphs.
LangGraph's graph primitives, persistence layer, interrupt pattern, and LangSmith observability.
| Command / Skill | What it does | When to use it |
|---|---|---|
StateGraph | The core class, define nodes (functions), edges (transitions), and a typed state schema | Starting any LangGraph workflow, every graph starts here with your state TypedDict |
add_conditional_edges() | Branch the graph based on state, route to different nodes based on a condition function | Any decision point: retry vs complete, approve vs reject, continue vs stop |
MemorySaver / checkpointeradvanced | Persist graph state between turns, enables resumable runs and human-in-the-loop workflows | Any workflow that pauses for human input or must survive process restarts between turns |
interrupt()advanced | Pause graph execution and surface state to the caller, resumes when approval is received | Human-in-the-loop checkpoints: review before sending, approve before deploying |
LangSmith tracing | Full execution trace, every node, edge, state snapshot, and LLM call logged and queryable | Set LANGCHAIN_TRACING_V2=true before writing any logic, debugging without it is significantly harder |
LangGraph Platformadvanced | Managed deployment for LangGraph apps with REST API, streaming, and persistence built-in | Moving from prototype to production, handles infra so you focus on graph logic |