Framework-agnostic orchestrator for custom transport streams.
Encapsulates all business logic shared across React, Vue, Svelte, and Angular for custom transport (non-LGP) streaming.
class CustomStreamOrchestratorCurrently active subagents (where status === "running").
Use this to track and display subagents that are actively executing. Completed or errored subagents are not included.
// Show loading indicators for active subagents
stream.activeSubagents.map(subagent => (
<SubagentCard
key={subagent.id}
type={subagent.toolCall.args.subagent_type}
isLoading={true}
/>
));The current branch of the thread. Used for navigating between different conversation branches.
Last seen error from the stream, if any.
Reset to undefined when a new stream starts.
Current interrupt, if the stream is interrupted.
Convenience alias for interrupts[0].
For workflows with multiple concurrent interrupts, use interrupts instead.
All current interrupts from the stream. When using Send() fan-out with per-task interrupt() calls, multiple interrupts may be pending simultaneously.
Whether the stream is currently running.
true while streaming, false when idle or completed.
All currently active and completed subagent streams.
Keyed by tool call ID for easy lookup. Includes subagents in all states: pending, running, complete, and error.
// Iterate over all subagents
stream.subagents.forEach((subagent, toolCallId) => {
console.log(`Subagent ${toolCallId}: ${subagent.status}`);
});
// Get a specific subagent
const specific = stream.subagents.get("call_abc123");Tool calls paired with their results.
Each entry contains the tool call request and its corresponding result. Useful for rendering tool invocations and their outputs together.
stream.toolCalls.map(({ call, result }) => (
<ToolCallCard
name={call.name}
args={call.args}
result={result}
/>
));The current state values of the stream. Updated as streaming events are received.
Tear down the orchestrator. Marks the instance as disposed, unsubscribes from the stream, and aborts any in-progress stream. After calling this method, no further notifications will be emitted.
Retrieve stream-level metadata for a given message.
Return the current version number, incremented on each state change.
Useful as a cache key for external sync (e.g. useSyncExternalStore).
Look up a single subagent stream by its tool call ID.
Retrieve all subagent streams associated with a specific AI message.
Retrieve all subagent streams matching a given tool name / type.
Get tool calls (with results) that belong to a specific AI message.
Reconstruct subagent streams from history values when subagent filtering is enabled and the stream is not currently loading. This is a no-op if subagents are already populated.
Update the current branch and notify listeners.
Abort the current stream and invoke the onStop callback
if one was provided in the options.
Submit input values and start a new stream run.
Delegates to submitDirect. Override or wrap this method in framework adapters to add queuing or other middleware.
Start a new stream run against the custom transport.
This is the low-level submit entry point that handles thread ID resolution, optimistic value merging, and transport invocation. Prefer submit unless you need to bypass higher-level wrappers.
Register a listener that is called whenever the orchestrator state changes.
Switch to a different thread. If the thread ID actually changed, the current stream is cleared and listeners are notified.
Synchronize the external thread ID with the orchestrator. If the ID has changed, the current stream is cleared and listeners are notified.
Custom transports do not negotiate stream modes with the server the way LangGraph Platform streams do, but framework adapters call this method on both orchestrator variants. Keep the API surface aligned as a no-op.