LangGraph Agents

Course Content

LangGraph Agents

7 sections · 49 lessons

What is the difference between a simple sequence of nodes and an explicit graph?


What you need to know

Python
builder.add_sequence([("extract", extract), ("validate", validate), ("save", save)])builder.add_edge(START, "extract")

add_sequence adds the nodes and the fixed edges between them in one call.

Signs you need an explicit graph

  • Result-dependent next step — valid goes to save, invalid goes to repair.
  • Repeat — repair goes back to validate, up to three times.
  • Parallel — extracting from three documents at once.
  • Pause — a human must approve before save.
  • Separate retry or streaming — you want the progress bar to show "validating" as its own step.

Linear with hidden branches

  • if statements inside one node
  • Diagram shows a straight line
  • Cannot interrupt at the branch
  • Trace shows one big step

Explicit graph

  • Branch is a conditional edge
  • Diagram shows every path
  • Can interrupt or resume at the branch
  • Trace shows which path ran

A real-life example

An HR tech company processes resumes in three steps: parse, score, store. For two years that was a sequence and it was fine. Then two needs arrived: scanned PDFs sometimes failed parsing and needed an OCR fallback, and candidates scoring above 85 needed a recruiter's review before an interview invite. The team turned the sequence into a graph with a conditional edge after parse (to ocr_fallback) and after score (to recruiter_review, which calls interrupt()). The code for each step did not change; only the wiring did.

Follow-up questions to expect

  • "Is there a performance difference?" — Only the checkpoint per super-step. A sequence of ten tiny nodes writes ten checkpoints; merge trivial steps into one node.
  • "Can a sequence still use a checkpointer?" — Yes. Even a linear flow gains resume-after-crash from checkpoints.
  • "When would you not split a sequence into nodes at all?" — When the steps are pure, fast data transformations. Keep them as functions inside one node.