LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraphstreamrun_streamGraphRunStream
    Class●Since v1.1

    GraphRunStream

    Copy
    GraphRunStream(
      self,
      graph_iter: Iterator[Any] | None,
      mux: StreamMux,
      values_transformer:

    Constructors

    Attributes

    Methods

    View source on GitHub
    ValuesTransformer
    ,
    *
    ,
    wire_pump
    :
    bool
    =
    True
    )

    Parameters

    NameTypeDescription
    graph_iter*Iterator[Any] | None

    Pull-based iterator over the graph's stream, or None for nested run streams whose pump is driven by an outer run (e.g. SubgraphRunStream).

    mux*StreamMux

    The StreamMux owning projections and the main log.

    values_transformer*ValuesTransformer

    The built-in values transformer providing output / interrupted / interrupts.

    wire_pumpbool
    Default:True
    constructor
    __init__
    NameType
    graph_iterIterator[Any] | None
    muxStreamMux
    values_transformerValuesTransformer
    wire_pumpbool
    attribute
    extensions: Mapping[str, Any]
    attribute
    output: dict[str, Any] | None

    Drive the run to completion and return the final state.

    attribute
    interrupted: bool

    Drive the run to completion, then return whether it was interrupted.

    attribute
    interrupts: list[Any]

    Drive the run to completion, then return interrupt payloads.

    method
    abort

    Stop the run early.

    Closes the mux and marks the stream exhausted. The graph iterator is dropped; any in-flight nodes see the closure on their next yield point. Idempotent.

    method
    interleave

    Iterate multiple projections round-robin, yielding (name, item).

    Each turn advances one projection's cursor; when a cursor's buffer is empty, pulling from it drives the pump once, which fans out to every subscribed projection log. Projections whose items aren't consumed on this turn sit in their own buffers only until the next turn reaches them, bounding memory by the skew between projection rates rather than letting any single log grow to the full run length.

    Projections are exhausted independently; a projection that finishes early drops out of the rotation while others continue. The overall iterator ends once all named projections are done.

    Sync run stream with caller-driven pumping.

    The caller's iteration on any projection (values, messages, raw events, or output) drives the graph forward. No background thread is used — the caller's for loop is the pump.

    Projections are single-consumer — iterating run.values twice raises. Use projection.tee(n) if you genuinely need fan-out.

    All transformer projections live in extensions. Native transformer projections (those with _native = True) are also set as direct attributes on this instance (e.g. run.values, run.messages).

    When True (default), bind _pump_next as the mux's pump callable. Subclasses that inherit a parent pump via StreamMux._make_child should pass False to preserve the parent binding.