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
    PythonlanggraphpregelremoteRemoteGraphastream
    Method●Since v0.2

    astream

    Copy
    astream(
      self,
      input: dict[str, Any] | Any,
      config: 
    View source on GitHub
    RunnableConfig
    |
    None
    =
    None
    ,
    *
    ,
    context
    :
    Context
    |
    None
    =
    None
    ,
    stream_mode
    :
    StreamMode
    |
    list
    [
    StreamMode
    ]
    |
    None
    =
    None
    ,
    interrupt_before
    :
    All
    |
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    interrupt_after
    :
    All
    |
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    subgraphs
    :
    bool
    =
    False
    ,
    headers
    :
    dict
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    ,
    version
    :
    Literal
    [
    'v1'
    ,
    'v2'
    ]
    =
    'v1'
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    AsyncIterator
    [
    dict
    [
    str
    ,
    Any
    ]
    |
    Any
    ]

    Parameters

    NameTypeDescription
    input*dict[str, Any] | Any

    Input to the graph.

    configRunnableConfig | None
    Default:None

    A RunnableConfig for graph invocation.

    stream_modeStreamMode | list[StreamMode] | None
    Default:None
    interrupt_beforeAll | Sequence[str] | None
    Default:None
    interrupt_afterAll | Sequence[str] | None
    Default:None
    subgraphsbool
    Default:False
    headersdict[str, str] | None
    Default:None
    **kwargsAny
    Default:{}

    Create a run and stream the results.

    This method calls POST /threads/{thread_id}/runs/stream if a thread_id is specified in the configurable field of the config or POST /runs/stream otherwise.

    Stream mode(s) to use.

    Interrupt the graph before these nodes.

    Interrupt the graph after these nodes.

    Stream from subgraphs.

    Additional headers to pass to the request.

    Additional params to pass to client.runs.stream.