Skip to main content
嗨站  /  Tools 工具组 /  SendMessageTool:Agent 通信

SendMessageTool:Agent 通信

SendMessageTool:Agent 通信

它是多 Agent 模式下的通信总线

在 Claude Code 的多 Agent 体系里,普通文本不会自动被其他 teammate 看见。
所以如果一个 Agent 想通知另一个 Agent、广播消息、回复审批,它必须走 SendMessageTool

这意味着这个工具不是辅助功能,而是多 Agent 系统真正成立的基础设施。

关键源码

tools/SendMessageTool/SendMessageTool.ts

const inputSchema = z.object({
  to: z.string(),
  summary: z.string().optional(),
  message: z.union([z.string(), StructuredMessage()]),
})

StructuredMessage 又支持几类特殊消息:

type: 'shutdown_request'
type: 'shutdown_response'
type: 'plan_approval_response'

这说明它不只是发文本,而是已经支持协议化消息

调用链

加载图表中…

它支持的不只是 teammate 名称

源码注释里写得很清楚,to 还可能是:

  • * 广播
  • uds:<socket-path>
  • bridge:<session-id>

这说明 Claude Code 的消息路由已经不止本地单进程 teammate,而是扩展到了 bridge / peer 模式。

小结

SendMessageTool 的本质是:

把多 Agent 协作里的消息传递做成正式协议,而不是靠模型输出文本碰运气。

Leave a Comment

您的邮箱地址不会被公开。 必填项已用 * 标注