LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • 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

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdkstreamcontrollerStreamController
    Class●Since v0.3

    StreamController

    Copy
    StreamController(
      self,
      *,
      transport: AsyncProtocolTransport,
      run_start_gate: Callable[[], Awaitable[None

    Constructors

    Attributes

    Methods

    View source on GitHub
    ]
    ]
    |
    None
    =
    None
    ,
    max_queue_size
    :
    int
    =
    1024
    ,
    seen_event_ids_max
    :
    int
    =
    10000
    ,
    max_reconnect_attempts
    :
    int
    =
    5
    ,
    reconnect_backoff_base
    :
    float
    =
    0.1
    ,
    reconnect_backoff_cap
    :
    float
    =
    2.0
    )

    Parameters

    NameTypeDescription
    transport*AsyncProtocolTransport

    the AsyncProtocolTransport bound to this thread session.

    run_start_gateCallable[[], Awaitable[None]] | None
    Default:None

    zero-argument async callable that resolves once the current run.start has committed server-side (no-op when no run is in flight).

    max_queue_sizeint
    Default:1024
    seen_event_ids_maxint
    Default:10000
    constructor
    __init__
    NameType
    transportAsyncProtocolTransport
    run_start_gateCallable[[], Awaitable[None]] | None
    max_queue_sizeint
    seen_event_ids_maxint
    max_reconnect_attemptsint
    reconnect_backoff_basefloat
    reconnect_backoff_capfloat
    attribute
    register_subscription: _register_subscription
    attribute
    unregister_subscription: _unregister_subscription
    attribute
    ensure_fanout_running: _ensure_fanout_running
    method
    subscribe

    Open a typed subscription against the shared SSE.

    Returns an async iterator that yields raw Event dicts matching the given filter. Multiple concurrent subscribes share one HTTP connection whose union expands or rotates as subscriptions come and go.

    method
    close

    Tear down the controller, awaiting any pending rotation closes.

    method
    reconcile_stream

    Public alias for _reconcile_stream.

    method
    observe_applied_through_seq

    Advance the reconnect cursor from a command response meta sequence.

    Manages subscriptions and fan-out against one shared SSE connection.

    Responsibilities:

    • subscription registry (register / unregister)
    • shared-stream lifecycle (open on first subscribe, rotate on filter widen)
    • dedup of replayed events via a bounded LRU _SeenEventIds
    • fan-out from the shared stream to per-subscription queues

    per-subscription queue bound (default 1024).

    LRU cap for the dedup set (default 10_000).