stream() and astream()
stream() and astream() expose progress before the final result is ready. Pick a stream mode based on what the client needs.1
Tiny example
Section titled “Tiny example”for part in graph.stream( {"question": "Check order A-104"}, stream_mode="updates", version="v2",): if part["type"] == "updates": print(part["data"])| Mode | What it exposes |
|---|---|
updates |
Node name and its state update |
values |
Full state after a step |
messages |
LLM message/token chunks with metadata |
custom |
Application-defined progress events |
Use async for part in graph.astream(...) in an async application.
Failure note
Section titled “Failure note”Streaming is an observation interface, not a checkpoint. A client seeing an update does not by itself mean the update is durably stored. Configure a checkpointer and durability mode separately.