src/stream.ts

langgraphjs · libs/langgraph-core/src/stream.ts · typescript · MIT
ai

Backend toolkit for LangGraph's v2 streaming protocol with transport-agnostic primitives for custom event servers and subscribers.

// Source: https://github.com/langchain-ai/langgraphjs | License: MIT | Copyright 2024 LangChain
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * `@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:
 *
 *   - {@link StreamChannel} — an append-only, buffered event log with
 *     independent replay cursors, for buffering events and fanning them out
 *     to multiple subscribers.
 *   - {@link convertToProtocolEvent} — turns raw `streamEvents` (v3) payloads
 *     into canonical {@link ProtocolEvent}s.
 *   - {@link inferChannel} / {@link matchesSubscription} — map an event to its
 *     {@link Channel} and dec

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key