题记与说明
- 精读日期:2026-10-28
- 精读方式:主题研究。先用网络检索筛选互补来源,再逐一全文精读(本文所用 webReader 均返回全文,非仅摘要)
- 主题判断:确认是"研究主题"——一篇工程经验文章(不是学术论文),按研究主题流程处理,围绕"工作流 vs agent 的取舍原则"重点展开
- 来源说明:用户给的 URL 是https://www.anthropic.com/research/building-effective-agents,该路径与https://www.anthropic.com/engineering/building-effective-agents指向同一篇文章(原文实际归在 Engineering 栏目下,作者 Erik Schluntz & Barry Zhang,发布于 2024-12-19,页面标注"Last updated 9 Oct 2026",并带有 Managed Agents 的推广提示)
0. 精读来源清单(检索筛选结果)
| # | 来源 | 精读深度 | 价值定位 |
|---|---|---|---|
| 1 | Anthropic《Building effective agents》(2024-12-19) | 全文精读(主来源) | 取舍原则的原始出处:workflow/agent 定义、五种工作流模式、agent 适用判据、反框架立场 |
| 2 | Anthropic《How we built our multi-agent research system》(2025-06-13) | 全文精读 | 把取舍原则在生产中落地的量化证据:多智能体的收益(90.2%)、代价(15× token)、适用边界(研究型任务 vs 编码任务) |
| 3 | OpenAI《A practical guide to building agents》(2025-04,商业指南) | 全文精读(落地页全文;官方 PDF 版本未能直接抓取) | 同期对家的独立立论,交叉验证"何时用 agent"的判据;编排模式与护栏视角可对照 |
| 4 | Hacker News 讨论(item?id=42470541)(2024-12-20) | 全文精读 | 社区批评与一线实践:定义争议、可预测性主张、去框架化案例(LangGraph→原生 Python) |
检索中还见过以下来源但未精读(仅出现在搜索摘要里,本笔记不引用其细节):Microsoft Azure "Workflow-First vs Code-First vs Hybrid"(2025-11)、Orkes《Workflows vs Agents》、多篇 Medium 转述/评述。另:原文末尾链接的 Anthropic cookbook 示例库 未打开验证。
1. 核心问题
这篇文章要解决的问题非常明确:当"agent"概念被过度炒作时,工程团队到底该怎么决定"要不要上 agent、上多复杂的 agent"?
具体拆成四个子问题:
- 概念问题:workflow 和 agent 的边界到底在哪?(很多团队把"LLM + 一点工具调用"就叫 agent,导致讨论失焦)
- 决策问题:什么情况下值得用"模型动态自主决策"(agent),什么情况下应该用"预定义代码路径"(workflow)?
- 设计问题:决定要做之后,有哪些可复用、可组合的架构模式?复杂度应该从哪里起步?
- 实践问题:不用框架行不行?agent 在生产中真正难的地方在哪?
文章自己的立场是反炒作的:它开篇就警告不要为了 agent 而 agent,全文的主旋律是"找到能用的最简单方案"。
2. 主要主张
2.1 基础定义(整篇取舍讨论的地基)
原文的核心定义(逐字):
"Workflows are systems where LLMs and tools are orchestrated through predefined code paths. Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks."
(工作流:LLM 和工具通过预定义代码路径编排的系统;agent:LLM 动态指导自身过程和工具使用、自己掌握任务完成方式的系统。)
以及 agent 的极简定义(逐字):
"An agent can be defined as an LLM in a loop with tools."
(agent 可以定义成"带工具、跑在循环里的 LLM"。)
关键点:二者不是对立类别,而是控制权光谱——控制权在"代码"手里是 workflow,在"模型"手里是 agent。原文明确说 workflow 和 agent 都可以组合、分阶段使用。
2.2 取舍原则(本笔记重点)
综合原文与三篇互补来源,取舍原则可以提炼成 六条判据:
| # | 判据 | 选 workflow | 选 agent | 出处 |
|---|---|---|---|---|
| 1 | 可预测性 | 任务需要可预测、一致的行为 | 允许每次执行路径不同 | 原文:"Workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale."(大意) |
| 2 | 步骤可否预知 | 子任务可以事先分解、路径可硬编码 | "it's difficult or impossible to predict the required number of steps, and where you can't hardcode a fixed path" | 原文 When to use agents 一节 |
| 3 | 错误成本与信任 | 错误代价高、需要强护栏 | "the cost of errors is acceptable or can be effectively managed",且要在低风险环境起步、靠测试与护栏建立信任 | 原文 When to use agents 一节 |
| 4 | 成本与延迟 | 可接受固定开销 | agent 更贵更慢(多智能体文章给出量化:multi-agent ≈ 15× chat 的 token) | 多智能体文章 |
| 5 | 可评测性(复杂度自由度) | 问题能表示成 DAG,"正确"有明确定义 | 自由度指数级放大,系统性评测变难 | HN 评论 #60:"Agents increase the degrees of freedom in your system exponentially making it so much more challenging to evaluate systematically." |
| 6 | 并行化空间 | 任务串行、无可拆分子问题 | 重度并行、信息超出单上下文窗口、需要操作大量复杂工具 | 多智能体文章:"Multi-agent systems excel at valuable tasks that involve heavy parallelization, information that exceeds single context windows, and interfacing with numerous complex tools." |
决策流程(原文的实际建议顺序):
最简单的 Augmented LLM(检索 + 工具 + 记忆)
→ 任务能否拆成固定子任务? → 是:五种 workflow 模式之一(按需组合)
→ 步骤数不可预知、路径不可硬编码、错误成本可控、需要规模化灵活决策?
→ 是:agent(仍从最简形式起步)原文的总纲(逐字):
"The key is finding the simplest solution possible, and only increasing complexity when needed."
(关键是找到尽可能简单的方案,仅在确有必要时增加复杂度。)
2.3 模式库(复杂度阶梯)
原文给出一个从简到繁的模式谱系,每个模式都标注了"何时用 + 代价":
- Augmented LLM(积木):LLM + 检索 + 工具 + 记忆。一切的地基。
- Prompt chaining(链式):任务分解为固定子任务顺序执行,中间可加程序检查点。代价:延迟(更多计算)换更高准确率。适合能干净分解的固定流程(如先生成营销文案→再翻译)。
- Routing(路由):先分类输入再分流到专门化的后续处理。适合"同一类大问题、但每类各有优化空间"的场景(客服问题的分流)。
- Parallelization(并行):两个变体——sectioning(切块并行处理)与 voting(多次独立运行取多数/择优)。适合可独立并行的大任务,或需要多视角交叉验证的场景。
- Orchestrator-workers(编排者-工人):中央 LLM 动态分解任务、派发给 worker、再综合结果。与 parallelization 的区别在于子任务不是事先定死的,而是按输入动态确定的(原文点名的典型用例:对多个文件做无法预知数量的复杂改动)。
- Evaluator-optimizer(评估者-优化者):一个 LLM 生成、另一个 LLM 评审反馈、循环迭代。前提是存在清晰的评价标准且反馈能带来实质改进(如文学翻译、需要多轮检索补全信息的复杂搜索任务)。
- Agent(智能体):以上模式的终点形态——模型在循环中自主规划、调工具、根据环境反馈决定下一步。原文强调"每个行动都由模型完成",因此难以预测、难以解释决策。
2.4 反框架立场
原文在"Building agents from scratch"一节明确建议直接用 API,不用框架。承认框架有好处(简化调模型、串工具、管状态),但(大意,原文):"this often comes at the cost of reduced transparency to the underlying prompts and responses, making debugging harder. They can also add unnecessary complexity for simpler setups."——框架遮住了底层的 prompt 和响应,让调试变难,对简单场景还引入不必要的复杂度。
这一立场在社区得到强共鸣(HN):
- 评论 #35:"We replaced LangGraph with straight python calls a couple weeks ago and are much happier with the structure and simplicity (reduction of >1k LOC)."
- 评论 #79 指出:这些原则和一般编程原则高度同构——控制复杂度、避开抽象掉关键理解的框架。
2.5 两个容易被忽略的配套主张
- 自动化 vs 增强:原文区分 automation(自动化可扩展运营)与 augmentation(增强提升工作质量),成功的 agent 实现往往两者都用——不要默认"全自动"是唯一目标。
- "向上走"而非"造更复杂的 agent":与其不断堆 agent 复杂度,不如给 agent 造更强的工具/能力。生产建议(大意):"The most reliable, significant gains are from modifying the tool, rather than the prompt."——最可靠的显著收益来自改工具,而不是改 prompt。
3. 方法
这不是论文,立论方式是"工程经验 + 模式分类学",没有任何 benchmark 数据表:
- 来源:作者与"数百家客户"合作构建 agentic 系统的经验(原文自述:learnings from building many agents with customers)。
- 论证结构:定义 → 积木 → 模式谱系(每个模式给配置图 + 适用判据 + 代价)→ agent 专门章节 → 反框架 → 生产建议(工具优先、评估先行)。本质是案例归纳出的模式库,而非受控实验。
- 主张的可检验性:原文给的是"何时用 X"的定性判据;真正把判据变成可测量证据的是配套的多智能体文章——用内部研究评测集 + 公开 BrowseComp 做了量化归因(见第 4 节)。
- 交叉验证方法(本笔记采用):用 OpenAI 同期指南独立立论对照(两家实验室是否收敛到同一套判据),用 HN 一线工程师的实践检验(哪些主张被生产环境证实/质疑)。
4. 数据与证据
4.1 原文本身的证据形态(局限所在)
原文几乎没有定量数据——证据是客户合作实践和模式复用性。这是它被批评的主要原因之一(HN 有评论指出缺少 memory、治理与失败案例的讨论)。
4.2 Anthropic 多智能体研究系统文章的量化证据(对取舍原则的实证)
以下数字均出自该文全文:
- 收益:内部 research eval 上,"Claude Opus 4 当 lead agent + Claude Sonnet 4 当 subagents"的多智能体系统比单 agent Opus 4 高 90.2%。
- 代价:"agents typically use about 4× more tokens than chat interactions, and multi-agent systems use about 15× more tokens than chats."(agent ≈ 4× 聊天的 token,multi-agent ≈ 15×)——取舍原则里"成本"一侧最硬的数字。
- 归因:BrowseComp 上 token 用量单独解释 80% 的表现方差;加上工具调用次数与模型选择后达 95%——性能差异基本是"算力/探索预算"问题。
- 为何研究任务适合 agent(原文论证,正好复用原文判据):"Research work involves open-ended problems where it's very difficult to predict the required steps in advance. You can't hardcode a fixed path…"——判据 #2 的实证呼应。
- 适用边界(自认的反例):文章明确讨论"这个模式何时会失效",指出多数编码任务的可并行子任务远少于研究任务,因此多智能体模式对编码类任务收益有限——印证"agent 不是普适答案,要先看任务结构"。
- effort scaling 规则(可直接抄的工程参数):"For simple fact-finding tasks, use 1 agent with 3–10 tool calls; for comparative tasks, use 2–4 subagents with 10–15 calls each; for complex research, use more than 10 subagents in a clear division of labor."(简单事实检索:1 个 agent、3–10 次工具调用;对比型:2–4 个 subagent、各 10–15 次调用;复杂研究:10+ subagent 分工。)
- 并行收益:并行化把研究时间砍掉最高 90%。
- 工具描述即性能:一个工具描述含糊导致 agent 找不到页面,修复描述本身让任务完成提升 40%——"改工具优于改 prompt"的量化版。
- subagent 输出落盘:subagent 把产出存为 filesystem artifact、只回传引用而非全文,避免"传话失真"与上下文膨胀。
- 评估纪律:评测从约 20 条真实样例起步即可抓住主要问题,再逐步扩大;LLM-as-judge 有系统偏差(偏爱自家框架的答案),人工检查不可省。
4.3 HN 社区的实践佐证与反证
- 佐证"workflow 才是当下的价值所在":评论 #31 认为 Anthropic 实际上讲的更多是"workflow",而这正是 LLM 目前真正的价值所在(workflow 自动化)。
- 佐证"可预测性是生产硬约束":评论 #32 描述生产现实——agent 每次给出的计划不同,企业普遍要求这一步可预测,最后往往把"自主规划"环节砍掉换成人工/固定流程,把它退化回 workflow。
- 佐证反框架:评论 #35 的 LangGraph → 原生 Python(>1000 行代码削减)。
- 补充取舍维度:评论 #69 提出"Agents are Interfaces, Not Implementations"——把 agent 当接口而非实现,通过收窄问题域来压缩状态空间,这是对"自由度爆炸"问题的工程化对策。
4.4 OpenAI 指南的交叉验证
- 判据收敛:OpenAI 给出三类"值得上 agent"的信号——complex decision-making(细微判断/例外/上下文敏感决策)、difficult-to-maintain rules(规则库臃肿难维护)、heavy reliance on unstructured data(重度依赖非结构化数据)。并明确(逐字):"Before committing to building an agent, validate that your use case can meet these criteria clearly. Otherwise, a deterministic solution may suffice."——与 Anthropic 的"最简单方案优先"完全收敛。
- 单 agent 优先(逐字):"Our general recommendation is to maximize a single agent's capabilities first."——与 Anthropic 的复杂度阶梯一致。
- 有意思的定义差异:OpenAI 把 workflow 定义为"a sequence of steps that must be executed to meet the user's goal"(只是步骤序列,不含"预定义代码路径"的控制权含义),agent 则是"independently accomplish tasks on your behalf"的系统。Anthropic 的分类更强调控制权归属(代码 vs 模型),概念上更锐利。
- 独有补充:OpenAI 强调护栏分层(relevance/safety classifier、PII filter、moderation、规则兜底)与人接管触发条件(失败阈值超限、高风险动作),这在 Anthropic 原文里只有一句带过——是 Anthropic 文章的实际短板。
- 模型选择策略可对照:先全用最强模型建立性能基线,再逐项换小模型找成本/延迟优化空间(与多智能体文章"从最强模型起步"的主张一致)。
5. 结论
- 取舍原则一句话版:默认 workflow,例外才用 agent。workflow 买的是可预测性、一致性、低成本;agent 买的是灵活性、规模化下的模型驱动决策。购买 agent 的前提是:步骤数不可预知、路径无法硬编码、错误成本可管理、任务结构适合并行。
- 复杂度永远从最简方案起步(可能是零 agent、甚至一次 LLM 调用),按"证明有需要"逐级升级;改工具 > 改 prompt > 加架构。
- 框架默认不用;要用也只用在确实需要它的地方,因为透明度损失是真实成本。
- 多智能体是 agent 路线的极端形态:收益真实(90.2%)但代价同样真实(15× token),只对高价值、重并行、超出单上下文窗口的任务成立——这是"取舍原则"最量化的注脚。
- 两家头部实验室(Anthropic、OpenAI)在"何时该用 agent"上独立得出了收敛的判据,这本身就是这套原则最强的外部效度证据。
6. 局限
原文自认的:
- 通篇没有定量评测,判据是经验性的;"何为成功的 agent 实现"没有给出可复现标准。
我推断的(有依据):
- 定义边界模糊:workflow 与 agent 之间是连续谱,orchestrator-workers 与多 agent 的界限本身就在滑动;HN 亦有评论质疑"agent"一词与传统含义(代理人、法律责任)的冲突,并援引 Air Canada 聊天机器人赔偿案讨论 LLM 系统的法律主体问题。
- 生产可靠性着墨不足:HN 多条评论指出 memory、governance、人在环、持久化执行等生产关键话题基本没展开——OpenAI 指南的护栏章节恰好补这块。
- 时效性:写于 2024-12,模型能力快速演进;页面 2026-10 更新时新增了 Managed Agents 的推广提示,说明部分"自己从零搭"的建议已开始被官方托管方案部分取代(取舍原则本身未过时,但工具层建议会漂移)。
- 利益相关:"不用框架"的建议出自模型厂商,天然有利于引导用户直接消费其 API(尽管 HN 多数从业者基于自身实践表示认同)。
- 判据随模型能力漂移:"这个任务值不值得 agent"的答案依赖于当前模型的可靠性;模型越强,原本需要硬编码路径的任务会滑向 agent 侧。取舍原则里最不稳定的参数是模型本身。
多智能体文章自认的:
- 15× token 成本意味着只适用高价值场景;编码类任务并行化空间小,该模式不普适;多智能体带来协调、成本、误差复合三重挑战。
7. 对我的启发(结合当前知识库/精读流水线)
- 精读流水线本身就是"workflow 包 agent"的正确示范:nightshift 流程(检索筛选 3-5 来源 → 逐个精读 → 按七维度提取 → 落盘笔记)是预定义代码路径(workflow),agent 只出现在叶子环节(检索、精读、写作)。这符合"默认 workflow"原则——比"派一个全自主 agent 去调研"可控得多。
- subagent 产出落盘 + 只回传引用:精读员把笔记写成 markdown 文件、结构化结果里只带 notePath,正是多智能体文章"subagents store work in the filesystem as artifacts and only pass back a reference"的做法,避免了把全文塞回主上下文的传话失真。
- effort scaling 规则可以直接写进 prompt:文献检索类任务可套用"简单检索 1 agent 3-10 次调用;对比型 2-4 个 subagent 各 10-15 次;复杂综述 10+ subagent 分工"的显式规则,把"努力程度"从隐式猜变成显式指令。
- 搜索策略:"Start wide, then narrow down"(先宽后窄、先理解问题再收敛到具体来源)应作为检索类 subagent 的默认指令。
- evaluator-optimizer 模式用于笔记质量闭环:生成精读笔记(optimizer)+ 按七维度标准评审(evaluator)循环,前提是评价标准清晰——七维度模板恰好就是那个"clear evaluation criteria"。
- 改任务描述 > 改模型:40% 的任务完成提升来自修一句话的工具描述;同理,子代理的任务描述质量(要读什么、排除什么、输出什么格式)是整条流水线里杠杆最大的地方,值得花时间打磨模板而不是换模型。
- token 经济账:15× 的多智能体成本只配得上高价值任务。逐篇精读高信号来源属于高价值、中等成本,合算;但不要把多智能体扩散到低价值环节(比如让多个 agent 讨论格式问题)。
- 评测纪律:多智能体文章的"20 条真实样例起步 + LLM-as-judge 有偏 + 人工抽查不可省"可直接用于知识库笔记质量的抽检流程。
8. 附:重要原文引述备查
以下引述均出自精读全文,标注来源;翻译为本笔记所加。
- "Workflows are systems where LLMs and tools are orchestrated through predefined code paths. Agents, on the other hand, are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks." —— [原文]
- "An agent can be defined as an LLM in a loop with tools." —— [原文]
- "The key is finding the simplest solution possible, and only increasing complexity when needed." —— [原文]
- "Agents can be used for open-ended problems where it's difficult or impossible to predict the required number of steps, and where you can't hardcode a fixed path." —— [原文]
- "However, this often comes at the cost of reduced transparency to the underlying prompts and responses, making debugging harder." (谈框架)—— [原文]
- "In a production setting, the most reliable, significant gains are from modifying the tool, rather than the prompt." —— [原文]
- "Multi-agent systems excel at valuable tasks that involve heavy parallelization, information that exceeds single context windows, and interfacing with numerous complex tools." —— [多智能体文章]
- "Agents typically use about 4× more tokens than chat interactions, and multi-agent systems use about 15× more tokens than chats." —— [多智能体文章]
- "Before committing to building an agent, validate that your use case can meet these criteria clearly. Otherwise, a deterministic solution may suffice." —— [OpenAI 指南]
- "too many people rush to build autonomous agents when their problem could easily be defined as a DAG workflow. Agents increase the degrees of freedom in your system exponentially making it so much more challenging to evaluate systematically." —— [HN 评论 #60]
来源链接汇总
- Anthropic《Building effective agents》:https://www.anthropic.com/engineering/building-effective-agents (即用户所给 /research/ 路径的正文页)
- Anthropic《How we built our multi-agent research system》:https://www.anthropic.com/engineering/built-multi-agent-research-system
- OpenAI《A practical guide to building agents》:https://openai.com/business/guides-and-resources/a-practical-guide-to-building-ai-agents (PDF 版:https://cdn.openai.com/business-guides-and-resources/a-practical-guide-to-building-agents.pdf ,本次未成功抓取,以落地页全文为准)
- Hacker News《Building Effective "Agents"》讨论:https://news.ycombinator.com/item?id=42470541
- (提及未精读)Anthropic cookbook agents 示例:https://github.com/anthropics/anthropic-cookbook/blob/main/patterns/agents.ipynb