Building agents: When to fold subagents into your main agent loop
Source: https://claude.com/resources/articles/building-agents-when-to-fold-subagents-into-your-main-agent-loop
Author: Diane Sarkis (Anthropic Applied AI)
Published: 2026-10-22
Fetched: 2026-11-28 via web search metadata + local Agent practice note
备注:未抓取 claude.com 全文,以下内容基于检索摘要与本地实践笔记双源佐证。
Guide contents (grounded via search metadata)
- Single agent with skills often scored higher than both one-prompt and subagent designs, at lower cost and latency; one customer ~2x faster after folding.
- Orchestrator failure modes: lossy handoffs, subagent sprawl, Frankenprompt, unowned evals.
- Keep subagents for: context bloat; parallel work with discardable context; black-box verification.
- Migration: task-completion evals first (10 golden examples), merge chained/data-sharing subagents, fold one at a time into skills and MCP tools.
- Tool choice degrades past ~30-50 tool definitions. Companion repo: anthropics/single-agent-loop-kit (Apache-2.0, support-desk demo).
Local evidence (Agent 实践探索 2026-11-28 excerpt)
今日主题
框架层收敛成几个小原语之后,Anthropic 最新指南却在劝人拆掉多 agent 结构,回到一个带 skills 的单循环。
十月底 Anthropic 发了一篇指南,标题很直白:什么时候该把 subagent 折叠回主循环。作者 Diane Sarkis 给出的数字不小:一位客户把多 agent 编排改成单循环后,运行时间快了约一倍;Claude Code 面向更强模型的系统提示词砍掉了八成以上。后一个数字有条件,砍的是提示词长度,总 token 开销没有同步降八成。指南里时机这个变量值得记:从 Opus 4.5 起,单个模型在一个循环里能处理的事比多数团队预期多,他们做过几次迁移,发现僵硬的多 agent 结构反而是新模型发挥的限制。
当年拆 subagent 有正当理由:一个系统提示词装不下所有工具和规则。Anthropic 的经验值是三十到五十个工具定义以上,模型挑工具的准确度开始下滑。这个约束如今用渐进披露解开,模型先看 skills 和工具的短描述,用到才加载全文。拆分的动机没了,架构惯性还在。指南点了三个仍值得保留 subagent 的场景:单循环的上下文膨胀到质量可测地下降;多个任务能并行、且各自用完即弃;一个 agent 选不对工具或自身指令互相冲突。它还点名了最常见的失败:每个团队都要一个自己的 subagent,agent 架构最后成了组织架构的复写。
把这条建议放回时间线里看更有意思。整整一年前,2025 年 10 月 22 日,LangGraph 发布 1.0,自称持久化 agent 框架的第一个稳定大版本,Uber、LinkedIn、Klarna 在生产环境使用。它的贡献在于把执行做稳:每个 super-step 落一次 checkpoint,exit、async、sync 三种持久化模式明码标价,性能换一致性由用户挑。文档里有个细节我印象很深:如果进程在第一个 checkpoint 落盘前崩溃,这个线程和从未启动过的线程无法区分,想区分没受理和跑丢了两种情况,得自己在框架外先记一条受理记录。OpenAI 那边是另一个节奏,Agents SDK 作为 Swarm 的正式接班人,原语只有 agent、handoff、guardrail 三个,发了一年多还停在 0.x,近期版本 v0.26.0,改动没停过。它的文档把护