A customer-service chatbot may need to answer a question, retrieve company information, or act on an order. LangGraph organizes that work as a graph: nodes perform actions, and directed edges determine which action runs next. It works with LangChain’s LLM building blocks, but its graph structure is useful whenever a workflow needs multiple steps or decisions. section 10.0 section 10.2.1 section 10.2.2
Three parts make a LangGraph workflow:
- State holds named values, such as a list of conversation messages. A node receives the current state and returns an update. section 10.2.2
- Directed edges connect nodes in execution order. A conditional edge can choose a path based on the state. section 10.2.2 section 10.6.4
- A checkpointer saves state between invocations. Pass the same thread ID to resume a conversation rather than start with a fresh state. section 10.3.1
Start with one assistant node
Define a state with a messages list, then add an assistant node between START and END. The node sends those messages to an LLM and returns its reply in the updated state. Compile the graph and invoke it with a human message; the final state contains the response. This straight-line graph is a useful starting point, though branching is where the graph structure becomes more valuable. section 10.2.3
A fresh invocation does not remember earlier turns on its own. Compiling with LangGraph’s MemorySaver checkpointer and invoking with a thread ID lets later turns use saved conversation state. MemorySaver stores that state in memory; other checkpointers can store it in databases such as PostgreSQL or SQLite. section 10.3.1
Let the chatbot act on an order
For an order-status request, the assistant can decide to call an order lookup tool, receive the result, and respond to the customer. Bind the available tools to the LLM, add LangGraph’s ToolNode, and use tools_condition to route a tool call to that node. An edge back to the assistant lets it continue after the tool runs. The same pattern supports actions such as tracking or canceling orders. section 10.6.4
Listing 10.12 An agentic graph.py
from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import START, StateGraph, MessagesState
from langgraph.prebuilt import tools_condition, ToolNode
from langchain_core.documents import Document
from langchain_core.messages import HumanMessage, SystemMessage
from prompts import *
from tools import tools
...
class SupportAgentGraph:
...
def build_graph(self):
...
builder.add_node("tools", ToolNode(tools))...
builder.add_edge("augment", "assistant")
builder.add_conditional_edges("assistant", tools_condition)
builder.add_edge("tools", "assistant")
return builder.compile(checkpointer=memory)
...
The agentic graph listing shows ToolNode, conditional routing, the return edge to the assistant, and compilation with a checkpointer together. section 10.6.4






