All skills
Agents & Frameworks
📊

LangGraph

Stateful agent orchestration with graphs

What it is

LangChain extension that models agent workflows as directed graphs. Each node is a function, each edge a conditional transition. Enables loops, branching, and persistent state across calls — essential for agents that need to think multiple steps, retry, and maintain memory across sessions. Used in production by major AI companies.

How to use it, step by step

  1. 1

    Install: pip install langgraph (requires LangChain).

  2. 2

    Define a 'State' (usually a typed dict) representing the data flowing through the graph.

  3. 3

    Create a StateGraph and add nodes: each node is a function that takes the state and returns an updated version.

  4. 4

    Connect nodes with add_edge and add_conditional_edges to define branching and loops; set the entry point and END.

  5. 5

    Compile the graph with .compile() and invoke it with an initial state; add a checkpointer for persistent memory.

💡Practical tips

  • Keep state immutable: each node returns a new dict, never mutates the existing one.
  • Use conditional edges to let the agent decide its next step, including looping back.
  • The checkpointer lets you pause and resume an agent: handy for human approvals mid-flow.

💰Pricing

Open-source and free. LangGraph Platform (managed hosting) has optional paid plans.

Go to LangGraph

The official site opens in a new tab.