Subscribe to a scoped messages stream. Pass stream and
optionally a subagent/subgraph snapshot (or any namespaced target).
Contract:
stream.messages directly
— no extra subscription is opened. stream.messages is the
live merge of messages-channel token deltas and
values.messages snapshots (see
UseStreamReturn.messages), so token-by-token
streaming here depends on the backend emitting messages
channel events. Backends that only emit values updates will
render full turns at once rather than streaming.messages subscription scoped to that namespace. Unmounting
the last component that watches this namespace closes the
subscription automatically.Messages are always BaseMessage class instances from
@langchain/core/messages.
useMessages(
stream: AnyStream,
target: SelectorTarget
): BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]| Name | Type | Description |
|---|---|---|
stream* | AnyStream | |
target | SelectorTarget |