Lesson 2 of 11
Chapter 18 . LangGraph . Lesson 2 of 11

A sequential pipeline

Edges run nodes in order. Each step adds its result to the state, and nothing is lost on the way.

01Real-world example

Illustration: Every Playwright test has a lifecycle: set up the browser, run the test, clean up. Each stage records what it did.
Every Playwright test has a lifecycle: set up the browser, run the test, clean up. Each stage records what it did.

02The graph

A sequential pipeline as a graph
setup, execute and teardown each add one key. stream() lets you watch every step.

03How the code does it

  • total=False lets the state start with only test_name; the other keys are filled in on the way.
  • Each node returns one key. Keys a node does not return keep their current value.
  • stream(..., stream_mode="updates") yields one dict per step: {node_name: what_it_changed}.

Key points

  • Edges run the steps in order
  • Keys you don't return stay as they were
  • stream(stream_mode="updates") shows each step

04Run it

terminal
cd chapter_18_LangGraph/src/chapters
python 002_Linear_Pipeline.py
output
setup     changed -> {'browser': 'chromium'}
execute   changed -> {'status': 'passed'}
teardown  changed -> {'cleaned_up': True}