Skip to main content
Stream from a Functional API entrypoint in two ways. Custom data is a side channel: you push progress with a writer, then read custom chunks. Values are state snapshots the runtime records, including the entrypoint return value. You do not call a writer for values. For concepts, see the Functional API overview. For messages and other typed projections, see event streaming.

Emit custom data

The Functional API uses the same stream as the Graph API. Emit with a writer, then consume custom chunks. For stream modes, see Streaming.

View example trace

Open a public LangSmith run for this example.
  1. Import get_stream_writer from langgraph.config.
  2. Call it inside the entrypoint to get a writer.
  3. Emit custom data before and after the computation.
  4. Call stream(..., stream_mode="custom") and iterate the chunks.
Async with Python < 3.11 In async code on Python < 3.11, get_stream_writer does not work. Use the injectable StreamWriter parameter instead. See Async with Python < 3.11.

Stream values

Reuse the main entrypoint from Emit custom data. Iterate stream.values for state snapshots. For messages and other projections, see event streaming.

See also