| Name | Type | Description |
|---|---|---|
options* | UseStreamOptions<InferStateType<T>> |
React binding for the v2-native stream runtime.
useStream exposes three always-on projections
(values / messages / toolCalls) at the thread root plus
cheap discovery maps for subagents / subgraphs. Scoped views of
subagents, subgraphs, or any namespaced projection are surfaced via
the companion selector hooks:
const stream = useStream({ assistantId: "deep-agent" });
// Root messages — always on, already class instances.
stream.messages.map((m) => <Bubble key={m.id} msg={m} />);
// Subagent view — mount = subscribe, unmount = unsubscribe.
function SubagentCard({ subagent }) {
const messages = useMessages(stream, subagent);
const toolCalls = useToolCalls(stream, subagent);
return <>{messages.map(...)}</>;
}
The first generic accepts either a plain state type
(useStream<MyState>()) or a compiled graph type
(useStream<typeof agent>()); in the latter case the
state shape is unwrapped from the graph via InferStateType, so
stream.values is always typed as the state, never as the graph
class itself.