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/vueuseMessages
Function●Since v1.0

useMessages

Subscribe to a scoped messages stream.

Contract:

  • At the root (no target) this returns stream.messages — the always-on root projection; no extra subscription is opened.
  • For any non-root namespace, mount triggers a ref-counted messages subscription scoped to that namespace. The subscription is released automatically when the calling scope disappears (and the registry closes the underlying server subscription when the last consumer leaves).

Messages are always BaseMessage class instances from @langchain/core/messages.

Copy
useMessages(
  stream: AnyStream,
  target: MaybeRefOrGetter<SelectorTarget>
): Readonly<ShallowRef<BaseMessage[]>>

Used in Docs

  • Graph execution
  • OpenUI
  • Subagent streaming

Parameters

NameTypeDescription
stream*AnyStream
targetMaybeRefOrGetter<SelectorTarget>
View source on GitHub