跳转到内容
use-cases / agents-spawn-agents / hero
AGENT · EXEC · CONTAINERS

能派生其他 AI 智能体的 AI 智能体

一个研究智能体收到一个复杂提示。它没有亲自做完所有事,而是 POST 到容器 API,拿回三个子智能体 URL。每个子智能体可以派生自己的子智能体。它们都不知道有什么编排器。它们只是通过 HTTP 互相调用。

阅读智能体文档
research-agentscrapesummarizefact-checkfetch-arxivfetch-newssummary-1summary-2verify-claim-1verify-claim-2verify-claim-3
use-cases / agents-spawn-agents / layers

三层,一种协议

树里的每个节点都是一个带 hoody-agent 服务的 Hoody 容器。父子之间只通过 URL 互识。没有从上面盯着的中央调度器。

父级

研究智能体

接收提示。决定要扇出哪些子任务。POST 到容器 API,为每个子智能体起一个新容器,然后用各自的 /api/v1/agent/tasks 端点把它负责的工作切片传过去。

子智能体

Scrape、summarize、fact-check

每个都跑在自己的容器里,有自己的文件系统、终端和 SQLite。谁也无法损坏其他。它们中任何一个都可以决定自己需要帮助,以父智能体相同的方式派生自己的子节点。协议是对称的。

孙级

按声明的逐项核验器

事实核查器看到五条声明,并行起五个容器,发出五次 HTTP 请求,等回五个响应。同样的模式,深一层。空闲容器不花钱,所以深树在经济上是免费的。

use-cases / agents-spawn-agents / mechanism

派生一个子智能体就是一次 HTTP 调用

没有要安装的智能体运行时、没有要配置的消息总线、没有要同步的共享状态。父智能体使用与人类一样的容器 API:POST 创建,然后调用子节点的 URL。

research-agent / spawn-children.ts
// Parent agent (running in its own Hoody container).
// Spawn three sub-agents, hand each one a slice of work,
// await their results in parallel.

const HOODY = 'https://api.hoody.com';

async function spawnChild(name) [
  // 1. Create a fresh container with the agent service running.
  const res = await fetch(HOODY + '/api/v1/projects/' + PROJECT + '/containers', [
    method: 'POST',
    headers: [ authorization: 'Bearer ' + TOKEN ],
    body: JSON.stringify([
      name,
      server_id: SERVER,
      container_image: 'debian-12',
      hoody_kit: true,
      ai: true,
    ]),
  ]);
  const child = (await res.json()).data;
  // 2. Hit the child's agent URL like any other HTTP service.
  const agentUrl = 'https://' + PROJECT + '-' + child.id + '-agent-1.' + SERVER + '.containers.hoody.com';
  return [ id: child.id, agentUrl ];
]

const [scrape, summarize, factCheck] = await Promise.all([
  spawnChild('scrape'),
  spawnChild('summarize'),
  spawnChild('fact-check'),
]);

// 3. Dispatch tasks. Each child runs autonomously,
//    can spawn its own children the same way.
const results = await Promise.all([
  fetch(scrape.agentUrl + '/api/v1/agent/tasks', [ method: 'POST', body: JSON.stringify([ description: scrapeBrief ]) ]),
  fetch(summarize.agentUrl + '/api/v1/agent/tasks', [ method: 'POST', body: JSON.stringify([ description: summarizeBrief ]) ]),
  fetch(factCheck.agentUrl + '/api/v1/agent/tasks', [ method: 'POST', body: JSON.stringify([ description: factCheckBrief ]) ]),
]);

两个端点都是有文档的 Hoody API:POST /api/v1/projects/$PID/containers 起一个预装了智能体服务的新容器;POST $CHILD_URL/api/v1/agent/tasks 把任务派给它。事实核查器可以跑完全一样的代码来派生它自己按声明的核验器——递归就是 HTTP。

use-cases / agents-spawn-agents / compare

无需编排框架

每个智能体框架都是套在进程内函数调用之上的薄层。它们都假设智能体共享内存、共享 Python、共享单一运行时。Hoody 的假设相反:智能体是各自独立的电脑,而 HTTP 已经是它们说的协议。

你今天装的东西替代它的东西
  • LangGraph在 Python 里接的 DAG
  • CrewAI进程内的「crew」对象
  • AutoGen消息总线 + 角色配置
  • LangChain agents工具包装器 + executor
  • Haystack pipelines每个工作流一份图谱规格
  • 自定义编排器队列、重试、你维护的胶水
一个原语

POST /api/v1/projects/$PID/containers

fetch(child.url + '/api/v1/agent/tasks')

每个子节点两次 HTTP 调用。父级不引入框架、不注册工具、不共享状态。每个子智能体都是带 URL 的对等节点——和父级同形,和你调用任何其他 HTTP 服务同形。

use-cases / agents-spawn-agents / punchline

每个智能体都是带 URL 的对等节点。它们就像任何 HTTP 服务调用任何其他 HTTP 服务一样互相调用。

没有编排器。没有消息总线。没有要同步的共享状态。唯一限制你并行跑多少智能体的,是你愿意花多少钱——而空闲容器不花钱。

无框架只有 HTTP
use-cases / agents-spawn-agents / replaces

这取代了什么

当一个智能体不够用时,人们抓的那些编排框架和临时运行时服务。每一个都解决问题的一片。HTTP 原生原语取代那一片以及包在它外面的框架。

  • LangChain工具包装器、executor、按 provider 的胶水
  • LangGraph在 Python 里组装的智能体 DAG
  • CrewAI进程内 crew 对象,单一运行时
  • AutoGen消息总线 + 角色配置
  • E2B sandboxes无持久家园的临时执行
  • Modal / Replicate runner每次调用冷启动,无长期 URL
  • 自定义编排器队列、重试、你维护的可观测性
use-cases / agents-spawn-agents / cta

停止接智能体图。起一个。让它去起其余的。

阅读智能体文档
use-cases / agents-spawn-agents / related

阅读其他内容