When a coordinator agent spawns specialist subagents (a researcher, an analyst, a writer), you need to render the orchestrator’s messages separately from each subagent’s streaming output. The v1 SDK keeps coordinator messages on the root stream and exposes subagents as discovery snapshots. Pass a snapshot to selector hooks or composables such asDocumentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-cbuipl-1779916257-33d1bcf.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
useMessages(stream, subagent) to render
the specialist’s scoped stream.
This is where the LangChain frontend SDKs go beyond a flat chat transcript:
subagents are first-class stream entities with their own status, messages,
tool-call metadata, and results. Your UI can show delegation, progress, errors,
and final synthesis without asking users to read interleaved tokens from every
worker.
Why selector-based subagent streams
The root stream stays focused on the coordinator conversation:stream.messagescontains only the coordinator’s messagesstream.subagentscontains discovery snapshots with identity, namespace, and status- Each subagent’s messages, tool calls, and values are read with selector helpers
- The UI stays clean: the coordinator’s reasoning is separate from the specialists’ work
Setting up useStream
No extra stream options are required. Point the stream at your deep agent,
render coordinator messages from stream.messages, and use stream.subagents
to mount cards for active specialists. In chat layouts, index subagents by the
tool-call ID that spawned them so each card appears under the coordinator turn
Point the stream at your deep agent, render coordinator messages from stream.messages, and use stream.subagents to mount cards for active specialists. In chat layouts, index subagents by the
tool-call ID that spawned them so each card appears under the coordinator turn that delegated the work.
The code examples use
useStream<typeof myAgent> for type-safe stream state. See Type inference for Python or JavaScript backends.Submitting messages
Submit messages through the root stream. Deep agent workflows often involve multiple layers of nested subgraphs, so set an appropriate recursion limit if your agent can delegate deeply:Deep Agents sets a default recursion limit of 10,000, which is sufficient for
most multi-expert setups. You can override this via
config.recursion_limit if
needed.The SubagentDiscoverySnapshot
Each SubagentDiscoverySnapshot is a lightweight discovery record for a subagent running inside the thread. It tells your UI that a subagent exists, where it sits in the subagent tree, and what lifecycle state it is in. The snapshot does not include the subagent’s streamed messages or tool calls. Instead, pass the snapshot to selector hooks such asuseMessages(stream, subagent) or useToolCalls(stream, subagent). These hooks
use the snapshot namespace to subscribe to the subagent’s stream primitives only
when the corresponding card or panel is mounted.
Building the SubagentCard
Each subagent card shows the specialist’s name, status, streaming content, and tool calls. Use selector hooks to subscribe to the subagent namespace:Progress tracking
Show a progress bar and counter so users know how many subagents have finished:Rendering messages with subagent cards
The key layout pattern is to render coordinator messages from the root stream and attach subagent cards to the AI message whose tool call spawned them:stream.subagents for a persistent sidebar that summarizes all active workers.
That gives users both local context and a bird’s-eye view of the whole run.
Best practices
- Mount selectors only where needed. Scoped messages and tool calls stream
when a card calls
useMessages(stream, subagent)oruseToolCalls(stream, subagent). - Show specialist names.
subagent.nametells users which worker is active. - Use collapsible cards. In workflows with 5+ subagents, auto-collapse completed cards so users can focus on active work.
- Override recursion only when needed. Deep Agents sets a high default
recursion limit; pass
config.recursion_limitonly for unusually deep custom workflows. - Handle errors per subagent. One subagent failing shouldn’t crash the entire UI. Show the error in that subagent’s card while others continue running.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

