Why LangGraph?
LangChain chains are linear — A → B → C. Real agents need loops: call a tool, observe the result, decide to call another tool. LangGraph models this as a directed graph with nodes, edges, conditional routing, and cycles.
| LangChain Chains | LangGraph |
|---|---|
| Linear: A → B → C → Output | Graph: nodes + conditional edges |
| No loops or branching | Supports cycles and loops |
| Stateless between calls | Persistent state across steps |
| Good for: RAG, simple chatbots | Good for: multi-step agents, ReAct |
Flow:
- START — Initial state
- Agent — LLM decides next action
- Tools — Execute tool call
- Observe — Process tool result
- END — Task complete