AI Hints
Home›LangGraph Tutorial›Streaming
LangGraph · Lesson 50 of 120

Streaming Updates

What changed.

⏱ 2 min read▶ Video at 53:00🎓 Free
Watch this lesson in the LangGraph courseWatch on YouTube ↗Full LangGraph course

Updates mode yields only what each node returned, along with the node's name. It's smaller than values, and tells you exactly which step did what.

Streaming Updates
From the video: Streaming Updates
  • Only the changes
  • With the node name
  • Which step did what

Updates per node

Same pipeline, now with stream mode updates. Each item is a dictionary, with the node name as the key, and its update as the value. Run it. We see clean fix the title, price add the total, and receipt write the line.

stream_updates.pypython
from order_graph import graph

config = {"configurable": {"thread_id": "s2"}}
for update in graph.stream({"title": "dune", "quantity": 2}, config, stream_mode="updates"):
    for node, change in update.items():
        print(f"{node:<8} -> {change}")
Output
clean    -> {'title': 'Dune'}
price    -> {'total': 19.98}
receipt  -> {'receipt': '2 x Dune = £19.98'}
Also uses order_graph.py
from typing import TypedDict
from langgraph.checkpoint.memory import InMemorySaver
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)
graph = b.compile(checkpointer=InMemorySaver())

Values vs updates

Values gives the whole state, so it's simple, but repetitive. Updates gives only changes, with node names, so it's compact, and great for progress messages. Choose based on what your app shows.

ModeEach itemBest for
valuesthe full stateshowing the latest state
updates{node: change}progress, debugging

Summary

Stream mode updates yields each node's name, and what it changed. Next, streaming the model's words as they're written.

Key takeaways
  • stream_mode='updates'
  • {node: update}
  • Compact
Next up: Streaming Tokens — messages mode