stream.subagents 从 delegated subagents 进行 streaming。对于通用 agent streaming(stream.messages、stream.values、tool calls、custom updates),请参阅 LangChain Event Streaming。
Stream subagents
Deep Agents 在 LangGraph streaming 之上添加了 subagent projection。当你希望每个 delegatedtask call 都有一个 stream handle 时,请使用 stream.subagents。该 projection 很轻量:它会先发现 subagent tasks,只有当你在 subagent handle 上访问 message、tool-call 和 value streams 时才会打开它们。
每个 handle 的 name 都是 sub-agent 配置的 name:也就是 coordinator 调用 task tool 时传入的 subagent_type。Deep Agents 会将该 name 绑定到 delegated run,因此你在 subagent specs 中定义的同一 label,就是你在 stream 中用于 filter 和 route 的 label。
Subagent stream fields
每个 subagent stream 都会暴露与 parent run 相同类型的 projections,例如 messages、tool calls、nested subagents 和 final output。关于通用 parent-run streaming model,请参阅 LangChain Event Streaming。 TypeScript 使用toolCalls 和 taskInput 等 camelCase projection names。每个 subagent stream 都可以暴露 .messages、.toolCalls、.values、.subagents 和 .output。
| Field | Description |
|---|---|
name | Sub-agent name,来自 coordinator 在其 task call 中选择的 subagent_type。 |
messages | Subagent emitted messages。 |
subagents | Nested subagent invocations。 |
output | Final subagent state,或 delegated task 的 completion signal。 |
taskInput | 传给 task tool 的 prompt 对应的 Promise。 |
toolCalls | 作用域限定到 subagent 的 tool calls。 |
跟踪 subagent lifecycle
当你只需要显示哪些 subagents started 和 finished 时,请使用stream.subagents。除非访问单个 subagent 上的这些 projections,否则不需要订阅 message 或 value streams。
Stream messages
Deep Agents 可以从 coordinator agent 和 delegated subagents 发出 messages。对 top-level messages 使用stream.messages,对每个 delegated subagent 使用 subagent.messages。
Stream tool calls
Deep Agents 会在 agent tree 的每一层暴露 tool calls。对 coordinator tools 使用 top-levelstream.tool_calls,对 delegated work 使用每个 subagent.tool_calls。
Stream nested work
你可以递归进入 subagent stream,以观察 nested subagents、messages 和 tool calls。并发消费
Coordinator 和 subagent output 经常交错。当需要 live UI updates 时,请并发消费 projections。 在 JavaScript 中使用 concurrent consumers:namespace 识别来源:
Subagents 与 subgraphs
stream.subgraphs 显示 graph execution structure。stream.subagents 显示 product-level Deep Agents task delegations。对于 user-facing UI,请使用 stream.subagents,因为它会隐藏 internal graph nodes,并直接暴露 subagent concept。
相关
- LangChain Event Streaming 涵盖通用 agent message 和 tool-call streaming concepts。
- Subagent frontend streaming 展示将 coordinator messages 与 subagent cards 分离的 UI patterns。
- LangGraph Event Streaming 涵盖底层 graph streaming model。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

