A Pipeline
Nodes in a row.
The simplest useful graph is a pipeline. Steps in a row, each doing one job. Let's process a customer's order. Clean the input, work out the price, then write a receipt.

- Steps in a row
- One job each
- Process an order
An order pipeline
Clean tidies the title. Price looks it up in a small price list, and multiplies by the quantity. Receipt writes a line for the customer. Add sequence adds all three nodes, with edges between them, in order. Run it. A messy title goes in, and a tidy receipt comes out.
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
PRICES = {"Dune": 9.99, "Circe": 10.99}
class Order(TypedDict):
title: str
quantity: int
total: float
receipt: str
def clean(s): return {"title": s["title"].strip().title()}
def price(s): return {"total": round(PRICES[s["title"]] * s["quantity"], 2)}
def receipt(s): return {"receipt": f"{s['quantity']} x {s['title']} = £{s['total']}"}
b = StateGraph(Order)
b.add_sequence([clean, price, receipt])
b.add_edge(START, "clean"); b.add_edge("receipt", END)
print(b.compile().invoke({"title": " dune ", "quantity": 2})["receipt"])2 x Dune = £19.98
Why split into nodes?
You could do this in one function. But separate nodes are easier to test, and to change. You can add a step in the middle, like a discount, by changing two edges. And later, each step can be streamed, traced, or retried on its own.
| key | value |
|---|---|
| Test | each step alone |
| Change | add steps easily |
| Stream | see progress |
| Retry | one step at a time |
Summary
A pipeline is nodes in a row, each with one job, and add sequence builds one quickly. Splitting work into nodes makes it easy to test and change. Next, how updates combine with the state.
Key takeaways- One job per node
- add_sequence
- Easy to extend