LangGraph
Abstract
LangGraph — an extension over LangChain for creating complex cyclic agents: state graphs, forks, self-checking, and human involvement.
What Sets It Apart from LangChain
Regular chains follow a straight path: step 1 → step 2. LangGraph builds agents as graphs with forks: «execute → check → if error, go back and redo».
Example: Autonomous Developer
Task: «Write a function for parsing currency rates».
- Coder — generates code.
- Executor — runs the code.
- Fork — error? Send error text back to Coder (up to 3–5 attempts). Success? Finish.
Human-in-the-loop
LangGraph can pause the process and wait for a human. For example, in refund processing: up to $50 the model approves automatically, above that — it notifies the operator who presses «Approve», and the graph continues.
When to Choose
| LangChain | LangGraph | |
|---|---|---|
| Architecture | Straight chain | Graph with cycles |
| Flow | A → B → C | A → B → if error → A |
| Human in the loop | Difficult | Native |
| For what | RAG, bots | Complex agents, code refactoring |