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_streamGraphRunStreaminterleave
    Methodā—Since v1.2

    interleave

    Copy
    interleave(
        self,
        *names: str = (),
    ) -> Iterator[tuple[str
    View source on GitHub
    ,
    Any
    ]
    ]

    Parameters

    NameTypeDescription
    *namesstr
    Default:()

    Iterate multiple projections in arrival order, yielding (name, item).

    Items are ordered by a monotonic push stamp assigned when each transformer pushes into its StreamChannel. This gives strict arrival ordering across projections, unlike round-robin.

    Each named channel is locked for the duration of iteration and released when the generator completes, is closed, or raises. Channels cannot be subscribed concurrently — use .tee(n) if you need fan-out.

    Example:

    for name, item in run.interleave("messages", "values"):
        if name == "messages":
            print("msg:", item)
        else:
            print("val:", item)

    Projection keys to interleave. Must match keys in extensions.