Module 1: Why Graphs for Agents
Why LangGraph Exists
Learning objectives
- Explain the core mental model behind Why LangGraph Exists
- Apply Why LangGraph Exists within Why Graphs for Agents
- Identify important boundaries, trade-offs, and failure modes
- Produce concrete evidence from the practice exercise
Related: LangGraph What Is LangGraph | LangGraph Core Concepts | LangGraph Architecture Overview | LangGraph Index
The Limits of Chains and Agents
LangChain chains are DAGs: data flows in one direction. That works for simple pipelines but breaks for:
- Agent loops (model → tool → model → tool)
- Human-in-the-loop (pause, review, resume)
- Multi-step reasoning with retries
- Multi-agent coordination
Problem 1: Chains Cannot Loop
A chain is A | B | C. There is no way to go back to B if C fails.
LangGraph solution: Cycles via conditional edges.
Problem 2: Agents Are Black Boxes
Traditional agent executors hide the loop inside a class. You cannot inspect or control intermediate steps.
LangGraph solution: Every step is a node. The graph is the loop.
Problem 3: No Built-In Persistence
If a long-running agent crashes, you lose all progress.
LangGraph solution: Checkpoints after every node.
Problem 4: Hard to Add Human Approval
Adding a pause in the middle of a chain requires hacking the runtime.
LangGraph solution: First-class interrupt primitive.
What LangGraph Adds
| Capability | LangChain Chain | LangGraph |
|---|---|---|
| Cycles | No | Yes |
| Explicit state | No | Yes |
| Checkpoints | No | Yes |
| Human-in-the-loop | Hard | Native |
| Multi-agent | Manual | Graph-based |
| Time travel | No | Yes |
When Not to Use LangGraph
- Simple one-shot chains. Use LangChain directly.
- Pure DAG workflows. Use Airflow, Temporal, or pure LangChain.
- High-frequency, low-latency inference. The graph runtime adds overhead.
Related
- LangGraph What Is LangGraph — the working definition
- LangGraph Core Concepts — the vocabulary
- LangGraph Architecture Overview — the system design
- LangGraph Index — full topic map
Practice lab
Implement the smallest runnable agent workflow that demonstrates Why LangGraph Exists. Trace inputs, state, model and tool calls, outputs, and cost; inject one failure and add a regression test that prevents it from returning.
Review questions
- What problem does Why LangGraph Exists solve, and what assumptions does it rely on?
- Which boundary or failure case is easiest to miss, and how would you expose it?
- What alternative design would you consider, and what trade-off would change the decision?
- What artifact, trace, test, or metric proves that your implementation is correct?
Completion evidence
- A working artifact, annotated trace, or reproducible experiment
- At least one normal case and one deliberately failing or boundary case
- A concise explanation of the design choice and its trade-offs
- Saved output showing how correctness was evaluated