Course Content
LangGraph Agents
7 sections · 49 lessons
What is LangGraph, and when would you choose it over LangChain Chains or Agents?
What you need to know
The three layers in 2026
The LangChain ecosystem was reorganised around the 1.0 releases. It helps to see it as three layers:
| Layer | What it is | Use it for |
|---|---|---|
LCEL chains (prompt | model | parser) | A fixed, forward-only pipeline | One pass, no loop, no pause |
langchain.agents.create_agent | A ready-made tool-calling agent, extended with middleware | The standard "model calls tools until done" loop |
LangGraph StateGraph | The runtime underneath both | Custom branches, loops, approvals, multi-agent flows |
Older names you may still hear: LLMChain and SequentialChain are legacy (replaced by LCEL), and AgentExecutor is legacy. LangGraph's own create_react_agent still works in 1.x but is deprecated in favour of create_agent.
What a graph adds that a chain cannot express
- Cycles — draft, critique, revise; call a tool, look at the result, call another.
- Runtime branching — the next step depends on what the model or a tool produced.
- Durable state — a checkpointer saves state after every step, keyed by a
thread_id, so a run can stop and continue later, even in another process.
When not to use it
If the flow is one prompt and one answer, a graph is only ceremony. If the flow is "model plus tools until done", create_agent gives you the loop, human approval middleware and call limits without writing a graph. Reach for a raw StateGraph when you can name a specific branch, loop or pause that the prebuilt agent does not give you.
A real-life example
An e-commerce marketplace builds a refund assistant in three stages.
- Week 1 — it only drafts a polite reply from the order details. One LCEL chain is enough.
- Week 3 — it must look up the order, check the return window and call a refund tool. The team uses
create_agentwith three tools. - Week 6 — finance adds a rule: refunds above Rs 5,000 need a human approver, who may answer hours later, and the refund must never be paid twice if a server restarts. Now the team writes a
StateGraphwith an approval node that callsinterrupt(), and compiles it with a Postgres checkpointer.
Each step up was justified by one new requirement, not by fashion.
Follow-up questions to expect
- "Is LangGraph part of LangChain?" — It is a separate package from the same company. LangChain 1.x agents run on the LangGraph runtime, but you can use LangGraph without LangChain.
- "What replaced
create_react_agent?" —create_agentinlangchain.agents. It keeps the same loop and adds middleware for approvals, summarisation, retries and call limits. - "Does LangGraph make the model smarter?" — No. It controls what runs, in what order, and what is saved. The quality of each decision still comes from the model and the prompt.