Orchestration with LangGraph
Hand-rolled loops get you understanding. LangGraph gets you control at scale. LangGraph models an agent as a graph of nodes (steps) and edges (what happens next), with shared state passed between them. That gives you what raw loops lack: durable execution, human-in-the-loop checkpoints, and clear control flow you can inspect.
Why LangGraph in this course
We chose LangGraph over higher-level "do everything" agent products because it stays low-level and controllable. You still own the graph. You can see every transition. You can pause for a human. That matches how production systems actually get debugged.
The three building blocks
- State - a typed shared object (messages, flags, scratch data) that every node can read and update.
- Nodes - functions that take state in and return state updates (call the model, run a tool, ask a human).
- Edges - what runs next: fixed edges, or conditional edges that branch on state (for example "if tool call, go to tools node; else END").
What you gain over the raw loop
Inspectable control flow
The graph is the architecture diagram. You can draw it, test a node in isolation, and explain the system to a teammate.
Persistence / resume
Checkpointers save state between steps so long runs and human approvals do not lose the thread.
Human in the loop
Pause before irreversible actions (send email, spend money, delete data). Resume when a human approves.
What you will do
Rebuild the hand-made loop as a LangGraph StateGraph: a model node, a tools node, and conditional edges. Run the same task you ran raw. Compare the execution trace. Then add a simple interrupt before one consequential tool.
Tip
Same behaviour, better machinery
If LangGraph feels mysterious, go back to the raw loop. The graph should feel like a clearer spelling of what you already built.
Watch out
Common mistakes
- Stuffing the entire product into one mega-node "agent" with no readable edges.
- Skipping checkpointers, then wondering why HITL loses state.
- Using LangGraph when a plain workflow (fixed edges, no model-in-the-loop) would be simpler.