Agent scaffold
Agent scaffold 指围绕模型运行的一层软件脚手架,包括提示词、工具接口、输出解析、状态管理以及多轮交互控制。导入文章的核心观点之一是:在 SWE-bench Verified 这类评测里,scaffold 本身就会显著影响结果。
- 文章中的 scaffold 设计原则是“尽量少约束,尽量多把控制权交给模型”。
- 《Building effective agents》补充了一个更基础的边界:scaffold 不只是工具列表和提示词模板,它还决定系统究竟更像 Workflows vs agents 里的哪一侧。
- 该 scaffold 由三部分组成:提示词、Bash 工具、编辑工具。
- 提示词建议了探索仓库、写复现脚本、修改代码、重新验证、检查边界情况的流程,但不把模型锁死在固定状态机里。
- 工具设计细节被明确优化过,包括:绝对路径、防止大输出、后台运行长命令、使用字符串替换来降低编辑歧义。
- 文章把工具描述本身视为重要 prompt 面积,认为工具接口设计会直接改变 agent 表现。
- Anthropic 在《Building effective agents》里把这种想法又抽象成更一般的
agent-computer interface:模型能否顺畅使用工具,取决于格式是否自然、是否减少不必要的计数和转义负担、以及接口是否被认真文档化。 - 这也说明 scaffold 不只是一层 orchestrator,它还包括 retrieval、memory 和 tools 这些被 Anthropic 统称为
augmented LLM的基础增强能力。 - 在《Code execution with MCP - Building more efficient agents》里,这个概念又向前推进了一步:scaffold 不只是“给模型哪些工具”,还包括是否提供代码执行环境、文件系统式工具发现、状态持久化和中间结果不过模的处理路径。
- 这意味着当工具数量很多时,更优的 scaffold 可能不是把所有 schema 一次性暴露给模型,而是让模型按需读接口文件,并通过代码调用 Model Context Protocol (MCP) 工具。
- 在《Building a C compiler with a team of parallel Claudes》里,这个概念继续扩展到多 agent 场景:scaffold 不再只是单 agent 的提示词和工具,而是共享 repo、任务锁、容器隔离、合并流程、日志格式和测试 oracle 的整体协调系统。
- 这也说明高质量 scaffold 的价值并不止于“帮模型起步”,还在于把大型任务重新分解成模型可以持续自我定位、并行推进和交接恢复的问题。
- 在《Harness design for long-running application development》里,这个概念又增加了另一层:scaffold 还包括何时使用 context reset、何时只用 compaction、以及是否把生成、规划、评估拆给不同 agent 角色。
- 这意味着 harness 不只是“提供环境”,还是一种持续假设检验:你需要不断验证哪些结构仍在弥补当前模型的真实短板,哪些已经成了多余复杂度。
- 《Effective harnesses for long-running agents》则补上了另一种更保守但很实用的结构:不是依赖单次长上下文硬撑,也不是直接上更复杂多 agent,而是把跨窗交接外化成 feature list、progress file、init script 和 git history 这类 artifact。
- 这说明 scaffold 的一部分价值,在于让每个新 session 都能快速完成“接班工程师式”的冷启动,而不必从压缩过的历史里盲目猜测前情。
- 在《Writing effective tools for agents — with agents》里,这个概念被压到更细的颗粒度:工具名称、参数、返回格式、错误提示和 token 预算本身,都是 scaffold 的一部分,因为它们会直接改变 agent 对环境的理解和行动路径。
- 也就是说,scaffold 不只是“外围 orchestrator”,还包括每个具体工具接口是否真正顺着 agent 的认知方式被设计。
- 《Introducing Contextual Retrieval》则把 retrieval 预处理也纳入这层含义:如果 agent 依赖知识库,chunk 如何切分、是否补回文档语境、是否用 BM25 与 reranking 叠加,本质上也都属于 scaffold 的知识访问层。
- 在《Introducing advanced tool use on the Claude Developer Platform》里,这个思路进一步被拆成功能层:scaffold 可以显式包括按需工具发现、Programmatic tool calling、以及工具 examples 这类帮助模型学习调用约定的结构。
- 这说明很多原本看似“平台能力”的东西,其实也是 scaffold 设计的一部分,因为它们直接决定模型何时看到哪些工具、以什么方式调用,以及中间结果是否进入上下文。
- 《The “think” tool- Enabling Claude to stop and think in complex tool use situations》则补充了另一种细粒度 scaffold 手段:不是增加外部行动能力,而是在关键 decision point 给模型一个专用的 Reasoning tools for agents 节点,让它在读取 tool result 后暂停整理约束。
- 在《Claude Code auto mode- a safer way to skip permissions》里,这个概念又延伸到“谁来批准 agent 的动作”:安全 allowlist、沙箱、模型 classifier、deny-and-continue 机制,本质上都属于 scaffold 的权限与控制层。
- 《Beyond permission prompts- making Claude Code more secure and autonomous》则把这层进一步硬化:scaffold 不只决定“哪些动作默认放行”,还可以直接通过 Sandboxing for agents 决定 agent 客观上能碰哪些文件、能连哪些网络目标。
- 这说明 agent scaffold 不只是帮模型完成任务,也在界定模型在哪些边界内可以自主行动,哪些边界必须被拦下或升级给人类。
- 云端场景里,这层 scaffold 甚至会外包部分敏感能力,例如把真正的 git credential 留在沙箱外,由代理在检查 branch 和 repo 约束后代为执行。
- 《Scaling Managed Agents-Decoupling the brain from the hands》则把这一层再往上提了一阶:如果说 scaffold 是“某个 agent 怎么跑”,那么 Meta-harness 关心的是“未来不同 scaffold 如何在稳定的 session / harness / sandbox 接口上持续替换与恢复”。
- 这说明 scaffold 本身也可以被看作可插拔部件,而不是必须和 session、执行环境、恢复逻辑绑死在一个容器里。
- 《Best Practices for Claude Code》则从用户侧补上了另一面:scaffold 不只是系统内部的 loop 和 tool 层,也包括
CLAUDE.md、hooks、skills、subagents、checkpointing 和 compaction 这些直接决定 Context hygiene for agents 的外部使用约定。 - 这说明很多看似“产品功能”的东西,其实也是 scaffold 的一部分,因为它们决定了哪些信息会长期常驻、哪些规则按需加载、以及会话何时该被清空或压缩。
- 《Effective context engineering for AI agents》则把这些零散部件收束成一个更宽的名字:scaffold 的一个核心职责,就是替模型持续完成 Context engineering,包括系统提示、工具暴露、runtime retrieval、compaction、memory 和 subagent 返回摘要的边界选择。
- 《My fireside chat about agentic engineering at the Pragmatic Summit》则补了一个更贴近实际使用的细节:scaffold 不只是“有哪些工具”,还包括 session 一开始就明确告诉 agent 如何运行测试、该遵循什么测试风格,以及是否要求
red/green TDD。 - 同一篇文章还说明,项目模板和代码模式本身也是 scaffold。带测试、README、CI 和既有风格的 repo,会显著提高 agent 延续高质量模式的概率;反之,混乱结构也会被 agent 忠实放大。
- [llm-wiki/raw/anthropic/Raising the bar on SWE-bench Verified with Claude 3.5 Sonnet](/raw/anthropic/Raising the bar on SWE-bench Verified with Claude 3.5 Sonnet.md)
- Building effective agents
- Code execution with MCP - Building more efficient agents
- Building a C compiler with a team of parallel Claudes
- Harness design for long-running application development
- Effective harnesses for long-running agents
- Writing effective tools for agents — with agents
- Introducing advanced tool use on the Claude Developer Platform
- The “think” tool- Enabling Claude to stop and think in complex tool use situations
- Introducing Contextual Retrieval
- Claude Code auto mode- a safer way to skip permissions
- Beyond permission prompts- making Claude Code more secure and autonomous
- Scaling Managed Agents-Decoupling the brain from the hands
- Best Practices for Claude Code
- Effective context engineering for AI agents
- My fireside chat about agentic engineering at the Pragmatic Summit
- Claude 3.5 Sonnet
- Anthropic
- Workflows vs agents
- SWE-bench Verified
- Model Context Protocol (MCP)
- Contextual Retrieval
- Agent teams
- Generator-evaluator loop
- Tool ergonomics for agents
- Programmatic tool calling
- Reasoning tools for agents
- Permission delegation for agents
- Sandboxing for agents
- Meta-harness
- Context engineering
- Context hygiene for agents
- Multi-context window workflows
- Agentic coding evals
- Agentic engineering
- Anthropic Engineering, “Raising the bar on SWE-bench Verified with Claude 3.5 Sonnet”, 2025-01-06: https://www.anthropic.com/engineering/swe-bench-sonnet
- 中文翻译:用 Claude 3.5 Sonnet 提升 SWE-bench Verified 的标准
- Anthropic, “Building effective agents”, 2024-12-19.
- 原文摘录:[llm-wiki/raw/anthropic/Building effective agents](/raw/anthropic/Building effective agents.md)
- Anthropic, “Code execution with MCP - Building more efficient agents”, 2025-11-04: https://www.anthropic.com/engineering/code-execution-with-mcp
- 原文摘录:[llm-wiki/raw/anthropic/Code execution with MCP - Building more efficient agents](/raw/anthropic/Code execution with MCP - Building more efficient agents.md)
- Anthropic, “Building a C compiler with a team of parallel Claudes”
- 原文摘录:[llm-wiki/raw/anthropic/Building a C compiler with a team of parallel Claudes](/raw/anthropic/Building a C compiler with a team of parallel Claudes.md)
- Anthropic, “Harness design for long-running application development”
- 原文摘录:[llm-wiki/raw/anthropic/Harness design for long-running application development](/raw/anthropic/Harness design for long-running application development.md)
- Anthropic, “Effective harnesses for long-running agents”, 2025-11-26.
- 原文摘录:[llm-wiki/raw/anthropic/Effective harnesses for long-running agents](/raw/anthropic/Effective harnesses for long-running agents.md)
- Anthropic, “Writing effective tools for agents — with agents”, 2025-09-11: https://www.anthropic.com/engineering/writing-effective-tools-for-agents-with-agents
- 原文摘录:[llm-wiki/raw/anthropic/Writing effective tools for agents — with agents](/raw/anthropic/Writing effective tools for agents — with agents.md)
- Anthropic, “Introducing advanced tool use on the Claude Developer Platform”, 2025-11-24: https://www.anthropic.com/engineering/introducing-advanced-tool-use-on-the-claude-developer-platform
- 原文摘录:[llm-wiki/raw/anthropic/Introducing advanced tool use on the Claude Developer Platform](/raw/anthropic/Introducing advanced tool use on the Claude Developer Platform.md)
- Anthropic, “The “think” tool- Enabling Claude to stop and think in complex tool use situations”, 2025-03-20.
- 原文摘录:[llm-wiki/raw/anthropic/The “think” tool- Enabling Claude to stop and think in complex tool use situations](/raw/anthropic/The “think” tool- Enabling Claude to stop and think in complex tool use situations.md)
- Anthropic, “Introducing Contextual Retrieval”, 2024-09-19.
- 原文摘录:[llm-wiki/raw/anthropic/Introducing Contextual Retrieval](/raw/anthropic/Introducing Contextual Retrieval.md)
- Anthropic, “Claude Code auto mode- a safer way to skip permissions”
- 原文摘录:[llm-wiki/raw/anthropic/Claude Code auto mode- a safer way to skip permissions](/raw/anthropic/Claude Code auto mode- a safer way to skip permissions.md)
- Anthropic, “Beyond permission prompts- making Claude Code more secure and autonomous”, 2025-10-20.
- 原文摘录:[llm-wiki/raw/anthropic/Beyond permission prompts- making Claude Code more secure and autonomous](/raw/anthropic/Beyond permission prompts- making Claude Code more secure and autonomous.md)
- Anthropic, “Scaling Managed Agents-Decoupling the brain from the hands”.
- 原文摘录:[llm-wiki/raw/anthropic/Scaling Managed Agents-Decoupling the brain from the hands](/raw/anthropic/Scaling Managed Agents-Decoupling the brain from the hands.md)
- Anthropic, “Best Practices for Claude Code”.
- 原文摘录:[llm-wiki/raw/anthropic/Best Practices for Claude Code](/raw/anthropic/Best Practices for Claude Code.md)
- Anthropic, “Effective context engineering for AI agents”, 2025-09-29.
- 原文摘录:[llm-wiki/raw/anthropic/Effective context engineering for AI agents](/raw/anthropic/Effective context engineering for AI agents.md)
- Simon Willison, “My fireside chat about agentic engineering at the Pragmatic Summit”.
- 原文摘录:[llm-wiki/raw/01_AI/My fireside chat about agentic engineering at the Pragmatic Summit](/raw/01_AI/My fireside chat about agentic engineering at the Pragmatic Summit.md)