Skip to main content

πŸ“ LangGraph

Description​

< What is it? >​

  • Definition: LangGraph is an orchestration framework and runtime for stateful workflows and agents. It combines ordinary program logic with model-driven steps and supports persistence, streaming, and human intervention. It does not require LangChain. See the LangGraph overview.
  • Example: a support workflow retrieves evidence, checks whether it is sufficient, and either generates an answer or requests clarification.

Key points​

< State, nodes, and edges >​

  • State: the data shared across a workflow, such as messages, retrieved documents, and a selected action.
  • Nodes: functions that perform work and return state updates. A node can call an LLM or execute deterministic code.
  • Edges: transitions between nodes. Conditional routing selects the next step based on the current state. Branches and loops make it possible to retrieve again, call a tool, or stop.
  • Graph construction: the Graph API defines a state schema, registers nodes and edges, and compiles the graph before execution. See the Graph API guide.

< Persistence and human review >​

  • Checkpointing: a configured checkpointer saves workflow state so execution can resume. Durable storage is needed when state must survive process restarts.
  • Human intervention: an application can pause for review and resume with an approval or corrected information. The developer defines the review points and handling of the response.
  • Memory: conversational state and longer-term stored information serve different purposes. The existing agent memory page explains how to wire memory into LangGraph.

Examples​

< Route according to retrieved evidence >​

  • Illustrative state transitions: this example uses application-defined rules; it does not require a model to make the routing decision.

    State after retrievalNext nodeIllustrative output
    Question: β€œWhat is the headphone return period?”; document D17: β€œ30 days”Generate an evidence-based answerβ€œThe return period is 30 days. [D17]”
    Question: β€œWhat is the return period?”; no matching product informationAsk for clarificationβ€œWhich product are you asking about?”
  • Component relationship: graph nodes can use LangChain components, while LangSmith records instrumented execution. See the ecosystem diagram and tool comparison.

Reference​