LangGraph is a library for building stateful, multi-actor agent workflows as directed graphs. Nodes are Python functions (LLM calls, tool executions). Edges define control flow between nodes. Conditional edges enable dynamic routing based on state. A checkpointer (SQLite, PostgreSQL, Redis) persists state between graph invocations — enabling resumable, human-in-the-loop workflows. LangGraph solves the state management problem in multi-step agents.
LangGraph state definition with messages reducer.
Without checkpointing, agent state is lost on failure. LangGraph checkpointers (PostgreSQL for production) save state after every node — agents can resume from any point after a crash.
The routing function receives full state and returns an edge name. This is where agent 'decisions' happen — tool calling vs responding, replanning vs finishing, escalation to human.
Each thread_id has isolated state. For a chatbot, thread_id = session_id. For a per-user agent, thread_id = user_id. This enables concurrent multi-user agent workflows on the same graph.
Sign in to share your feedback and join the discussion.