LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Getting started
  • useStream
  • Selectors
  • Interrupts & headless tools
  • Subagents & subgraphs
  • Fork & edit from a checkpoint
  • Submission queue
  • Multimodal media
  • Transports
  • Suspense
  • provideStream & context
  • Type safety
  • Migrating to v1
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewGetting starteduseStreamSelectorsInterrupts & headless toolsSubagents & subgraphsFork & edit from a checkpointSubmission queueMultimodal mediaTransportsSuspenseprovideStream & contextType safetyMigrating to v1
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/vueUseStreamReturn
Interface●Since v1.0

UseStreamReturn

Vue binding return type for useStream.

Reactive primitives follow Vue conventions:

  • Data projections are Readonly<ShallowRef<T>> / ComputedRef<T> so templates auto-unwrap via msg.value in <script setup> and directly in templates. They are snapshots — never mutate.
  • Imperative methods (submit / stop / respond) are plain functions — no refs involved.
  • Identity values captured at setup time (client / assistantId) are exposed as plain values; if you need to swap the bound agent or client, remount the composable.
Copy
interface UseStreamReturn

Properties

property
assistantId: string

Assistant id the thread is bound to for its lifetime.

property
client: Client

LangGraph SDK client used to construct thread streams.

property
error: ComputedRef<unknown>

The last error observed on the active run or hydration attempt. undefined when no error has occurred. Cleared optimistically when a new submit starts.

property
hydrationPromise: ComputedRef<Promise<void>>

Promise that settles when the active thread's initial hydration completes. Exposed so async setup() sites can await stream.hydrationPromise.value to implement a Suspense-like boundary. A fresh promise is installed on every threadId change.

property
interrupt: ComputedRef<Interrupt<InterruptType> | undefined>

Convenience alias for interrupts[0] — the primary interrupt most UIs should act on when only one is pending. undefined when no interrupt is active.

property
interrupts: Readonly<ShallowRef<Interrupt<InterruptType>[]>>

All unresolved protocol interrupts observed on the root namespace during the active thread. Populated from lifecycle / input events and seeded on hydration from thread.getState(). Cleared optimistically when a new run starts or an interrupt is resolved via respond.

property
isLoading: ComputedRef<boolean>

true while a run is active or being started on the current thread. Driven by root-namespace lifecycle events (running → true, terminal phases → false). Use this to disable submit buttons and show in-flight spinners.

property
isThreadLoading: ComputedRef<boolean>

true while the initial thread.getState() hydration for the active thread is in flight. Distinct from isLoading — thread loading covers the one-time fetch that seeds values / messages before any user submit.

property
messages: Readonly<ShallowRef<BaseMessage[]>>

The root message projection. Assembled from two sources and merged in real time:

  1. messages-channel deltas — token-level streaming events (message-start, content-block-delta, message-finish) emitted by the runtime. These drive live, token-by-token updates.
  2. values.messages snapshots — the authoritative ordering and any messages the agent produces without token streaming (human turns, tool results, echoes from subagents).

If the backend only emits values events (no messages channel), every message will appear fully-formed on each values update rather than streaming. This is a backend/runtime concern — the Vue layer faithfully renders whatever the server sends.

Equivalent to calling useMessages(stream) with no target.

property
subagents: Readonly<ShallowRef<ReadonlyMap<keyof SubagentStates & string extends never ? string : keyof SubagentStates & string, SubagentDiscoverySnapshot>>>

Subagents discovered on the root run. For DeepAgent-typed streams the key set is narrowed to the subagent names declared on the agent brand (keyof InferSubagentStates<T>).

property
subgraphs: Readonly<ShallowRef<ReadonlyMap<string, SubgraphDiscoverySnapshot>>>

Subgraphs discovered on the root run.

A namespace is classified as a subgraph iff at least one strictly-deeper namespace has been observed with it as a prefix. This is inferred from the lifecycle event stream — plain function nodes (orchestrator, writer in the nested-stategraph example) never appear here even though the server emits namespaced lifecycle events for them. Promotion is monotonic and retroactive; an entry appears as soon as the first descendant event lands.

property
subgraphsByNode: Readonly<ShallowRef<ReadonlyMap<string, readonly SubgraphDiscoverySnapshot[]>>>

Subgraphs indexed by the graph node that produced them (addNode("visualizer_0", …)). Each value is an array because parallel fan-outs and loops can spawn multiple invocations of the same node; arrays preserve insertion order. Updates in lock-step with subgraphs.

property
threadId: ComputedRef<string | null>

Id of the thread the controller is bound to. null until the first submit creates or selects a thread (or until an explicit threadId option is provided and hydrated).

property
toolCalls: Readonly<ShallowRef<InferToolCalls<T>[]>>

Root-namespace tool calls assembled from the tools channel. Each entry is a fully parsed AssembledToolCall with name, args, and id — suitable for rendering approval UIs or forwarding to headless tool handlers.

When the stream is typed with an agent brand or tool list, entries are narrowed via InferToolCalls. Equivalent to calling useToolCalls(stream) with no target.

property
values: Readonly<ShallowRef<StateType>>

The most recent values-channel snapshot emitted at the root namespace — i.e. the thread-level state as the server sees it after each superstep. Updated on every root values event, not on token-level deltas: if you render stream.values.value.messages directly you'll see full turns appear at once instead of streaming token-by-token. Use messages (or useMessages) for the token-streamed view.

Equivalent to calling useValues(stream).

Methods

method
disconnect→ Promise<void>

Disconnect the client without cancelling the run server-side. Alias for stop({ cancel: false }).

method
getThread→ ThreadStream<Record<string, unknown>> | undefined

Returns the bound ThreadStream, if one exists (undefined until the thread is hydrated or the first submit completes). Prefer the projections and selector composables for UI work; use this for low-level protocol access (raw subscriptions, state commands, etc.).

method
respond→ Promise<void>

Resume a pending protocol interrupt by sending a response payload back to the interrupted namespace.

When options.interruptId is omitted, walks getThread()?.interrupts from newest to oldest and resumes the first not yet resolved by a prior respond() call. That may be a root or subgraph interrupt and is not necessarily interrupt (interrupts[0], root-only). Safe when exactly one interrupt is pending; otherwise pass an explicit options.interruptId. When options.namespace is omitted, it is resolved from getThread()?.interrupts by that id (falling back to root [] only if the id is unknown).

Pass options.update (and/or options.goto) to apply a state update (and/or directed jump) in the same superstep as the resume — mapped to LangGraph's Command(resume, update, goto). The resumed run produces a single checkpoint reflecting both, so a HITL card can push its message into state at the moment it answers the interrupt (no separate state write, no intermediate checkpoint, no flicker). Messages may be plain dicts or @langchain/core BaseMessage instances (serialized like submit()).

method
respondAll→ Promise<void>

Resume several pending interrupts at the same checkpoint in a single command — required when a run pauses on multiple interrupts at once (e.g. parallel tool-authorization prompts), which sequential respond calls cannot handle. responsesById maps each pending interruptId to its response, so different interrupts can receive different payloads. Pass options.config / options.metadata to fold run-level config and metadata into the resumed run, mirroring submit().

method
stop→ Promise<void>

Stop the active run on the current thread. By default cancels the run server-side and disconnects the client; pass { cancel: false } or use disconnect for join/rejoin. Sets isLoading to false immediately; values and messages are preserved.

method
submit→ Promise<void>

Dispatch a new run on the bound thread.

input is typed as Partial<StateType> so IDE autocompletion surfaces the state keys declared on the root composable.

View source on GitHub