LangGraph · Lesson 53 of 120
Several Stream Modes
At once.
A real app often wants several kinds of stream together. Progress messages, node updates, and tokens. Pass a list of modes, and each item tells you which mode it came from.

- Several kinds at once
- Pass a list
- Each item says its mode
Updates and custom together
The node writes a progress message, then calls the model. We stream with two modes, updates and custom. Each item is now a pair, the mode, and the data. Run it. First the custom progress message, then the update from the node, each labelled with its mode.
multi_stream.pypython
from langchain.chat_models import init_chat_model
from langgraph.config import get_stream_writer
from langgraph.graph import MessagesState, StateGraph, START
model = init_chat_model("google_genai:gemini-flash-lite-latest", temperature=0)
def answer(s: MessagesState):
get_stream_writer()({"status": "asking the model..."})
return {"messages": [model.invoke(s["messages"])]}
b = StateGraph(MessagesState); b.add_node(answer); b.add_edge(START, "answer")
q = {"messages": [{"role": "user", "content": "Name one Austen novel. Title only."}]}
for mode, data in b.compile().stream(q, stream_mode=["custom", "updates"]):
if mode == "custom":
print("custom: ", data["status"])
else:
print("updates:", data["answer"]["messages"][-1].text.strip())Output
custom: asking the model... updates: Pride and Prejudice
Stream modes
Here are the modes we've met. Values, the full state. Updates, each node's change. Messages, model tokens. And custom, your own data. There's also debug, which streams everything, for deep debugging.
| Mode | Yields |
|---|---|
| values | full state per step |
| updates | {node: change} |
| messages | (token chunk, metadata) |
| custom | your own data |
| debug | everything |
Summary
Pass a list of stream modes, and each item comes as a pair of mode and data. Next, a quiz on streaming.
Key takeaways- stream_mode=[...]
- (mode, data) pairs
- Mix what you need
Next up: Streaming Quiz — test yourself