import { ... } from "@langchain/langgraph/stream";The set of stream modes requested by
streamEvents(..., { version: "v3" }) — every mode the protocol maps
to a channel.
The verbose "debug" mode is intentionally excluded: it was a thin
re-wrap of checkpoints + tasks carrying no new information.
The "checkpoints" mode is likewise excluded from the stream-mode
request because the protocol's checkpoints channel carries only a
lightweight envelope (id, parent_id, step, source) emitted as a
separate [namespace, "checkpoints", envelope] chunk before each paired
values chunk — not the full-state shape from Pregel's checkpoints
stream mode when subscribed via debug.
Maps a protocol event method to its subscription Channel.
Returns undefined for unrecognized methods so that new server-side
channels (e.g. from extension transformers) don't break existing
subscribers. The custom method resolves to the named custom:<name>
channel when the payload carries a name, otherwise the bare custom
channel. Both "input" and the wire-level "input.requested" map to the
input channel.
Whether namespace starts with prefix.
Segments are compared literally first; if the prefix segment itself contains
no :, the candidate segment is also compared after its dynamic suffix is
stripped (see normalizeNamespaceSegment). This mirrors
is_prefix_match in api/langgraph_api/protocol/namespace.py so server-side
filtering and client-side per-subscription narrowing stay consistent.
@langchain/langgraph/stream — backend toolkit for the v2 streaming protocol.
This entrypoint collects the primitives needed to build a custom transport or server on top of the Agent Streaming Protocol:
streamEvents (v3) payloads
into canonical ProtocolEvents.since replay cursor).These are intentionally transport-agnostic: pair them with SSE, WebSocket, or any custom framing to expose a graph over the protocol.
Whether value names a protocol subscription channel — either a base
channel ("messages", "values", …) or a named custom channel
("custom:<name>"). Unknown/future method names return false,
mirroring inferChannel.
Returns whether an event should be delivered for a subscription definition.
When the definition carries a since replay cursor, events at or before
that sequence number are excluded — letting the same predicate drive both
live fan-out and buffered replay over a StreamChannel.
Strip dynamic suffixes (after :) from a namespace segment.
Server-emitted namespaces contain runtime-generated suffixes like
"fetcher:abc-uuid", while user-supplied subscription filters are typically
static names ("fetcher"). Mirrors normalize_namespace_segment in
api/langgraph_api/protocol/namespace.py.
True when payload is a lightweight checkpoint envelope (not a full-state
Pregel checkpoints debug payload).
A projection channel for StreamTransformers.
Implements AsyncIterable<T> so it can be iterated directly by
in-process consumers via run.extensions.<key>. Channels created with
StreamChannel.remote or new StreamChannel(name) are also
auto-forwarded to remote clients.
A projection channel for StreamTransformers.
Implements AsyncIterable<T> so it can be iterated directly by
in-process consumers via run.extensions.<key>. Channels created with
StreamChannel.remote or new StreamChannel(name) are also
auto-forwarded to remote clients.