LangGraph is a low-level, graph-based orchestration framework built by LangChain for creating stateful, multi-agent AI systems. Unlike traditional linear chains, LangGraph models workflows as directed graphs where nodes represent actions (LLM calls, tool executions, or logic) and edges define transitions between them. This architecture enables cycles, conditional routing, human-in-the-loop patterns, and persistent state management β making it ideal for building production-grade agents that handle complex reasoning, error recovery, and long-running conversations. As of LangGraph 1.0, the framework commits to stability with no breaking changes until 2.0, and introduces a complementary Functional API alongside the Graph API for flexible workflow construction.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 147 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core Graph Components
| Component | Example | Description |
|---|---|---|
StateGraph(MessagesState) | β’ Main graph class managing state-driven workflows with typed state schemas β’ state is shared across all nodes and persists between executions. | |
def agent(state): return {"messages": [response]} | Function receiving current state, performing an action, and returning state updates to be merged. | |
graph.add_edge("agent", "tools") | β’ Fixed connection between nodes β’ the graph always transitions from source to destination without conditions. | |
add_conditional_edges("agent", router_fn) | Dynamic routing: a routing function determines the next node(s) based on current state or output. | |
graph.add_edge(START, "agent") | β’ Special node representing the entry point β’ execution always begins from edges connected to START. |