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_streamAsyncGraphRunStream
    Classā—Since v1.1

    AsyncGraphRunStream

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

    Constructors

    Attributes

    Methods

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

    Parameters

    NameTypeDescription
    graph_aiter*AsyncIterator[Any] | None

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

    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_aiterAsyncIterator[Any] | None
    muxStreamMux
    values_transformerValuesTransformer
    wire_pumpbool
    attribute
    extensions: Mapping[str, Any]
    method
    abort

    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.

    method
    output

    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.

    method
    interrupted

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

    method
    interrupts

    Drive the run to completion and return interrupt payloads.

    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:
            ...

    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.