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 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 CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    PythonlanggraphpregelremoteRemoteGraphstream
    Method●Since v0.2

    stream

    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.

    Copy
    stream(
      self,
      input: dict[str, Any] | Any,
      config: 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 = {}
    ) -> Iterator[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

    Stream mode(s) to use.

    interrupt_beforeAll | Sequence[str] | None
    Default:None

    Interrupt the graph before these nodes.

    interrupt_afterAll | Sequence[str] | None
    Default:None

    Interrupt the graph after these nodes.

    subgraphsbool
    Default:False

    Stream from subgraphs.

    headersdict[str, str] | None
    Default:None

    Additional headers to pass to the request.

    **kwargsAny
    Default:{}

    Additional params to pass to client.runs.stream.

    View source on GitHub