Reference · Glossary
LangGraph
Last updated
A framework (from the LangChain team) for building agents as an explicit **graph of steps** — nodes are actions, edges decide what runs next, and state is passed along the graph. Built for loops, branches, and multi-agent handoffs that a single prompt chain can't express cleanly.
#When to use
Agents that need loops (retry until good), conditional branches (route to a specialist), or multiple cooperating agents with shared state and checkpoints you can resume.
#When not to
A single-call prompt or a simple one-shot tool call — a graph adds structure you don't need yet. Start with a plain function call, add LangGraph once branching logic gets tangled.
#Example
from langgraph.graph import StateGraph
graph = StateGraph(dict)
graph.add_node("research", research_step)
graph.add_node("write", write_step)
graph.add_edge("research", "write")
app = graph.compile()
result = app.invoke({"topic": "RAG evaluation"})