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
    LangGraph Store
    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
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraphstreamrun_streamAsyncGraphRunStream
    Classā—Since v1.2

    AsyncGraphRunStream

    Copy
    AsyncGraphRunStream(
      self,
      graph_aiter: AsyncIterator[Any] | None,
      mux: StreamMux,
      *,

    Constructors

    Attributes

    Methods

    View source on GitHub
    wire_pump
    :
    bool
    =
    True
    )

    Parameters

    NameTypeDescription
    graph_aiter*AsyncIterator[Any] | None
    mux*StreamMux
    wire_pumpbool
    Default:True
    constructor
    __init__
    NameType
    graph_aiterAsyncIterator[Any] | None
    muxStreamMux
    wire_pumpbool
    attribute
    extensions: Mapping[str, Any]
    method
    abort
    method
    output
    method
    interrupted
    method
    interrupts

    Async run stream with caller-driven pumping.

    Async iteration on any projection drives the graph forward — there is no background task. Concurrent consumers share a single-flight pump via an asyncio.Lock, so each awaiting cursor contributes one event per acquisition. Backpressure comes from the logs: when a subscribed log's buffer reaches maxlen, apush awaits the subscriber to drain, which holds back the pump and paces the graph.

    Projections are single-consumer — a second aiter(run.values) raises. Use projection.tee(n) for fan-out.

    Use as an async context manager to guarantee clean shutdown on early exit:

    async with await handler.astream(input) as run:
        async for msg in run.messages:
            ...
    Warning

    Awaited from Pregel.astream_events(version="v3"), which is experimental and may change.

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

    The StreamMux owning projections and the main log.

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

    Stop the run early.

    Marks the stream exhausted, wakes any pump-waiters, and closes the mux. Any apush blocked on backpressure wakes and returns without appending. Idempotent.

    Drive the run to completion and return the final state.

    Methods (not properties) on the async lane so run.output without await raises at type-check time instead of silently yielding a coroutine object.

    Drive the run to completion and return whether it was interrupted.

    Drive the run to completion and return interrupt payloads.