介绍
图 0-1|AI Harness 六层能力模型与依赖结构
数据来源:基于本文分析绘制的示意图。
1. 背景与问题提出
1.1. 模型能力在涨,工程信心没跟着涨
2023 年以来,基础模型(Foundation Model)的能力指标持续攀升,各类编码与推理基准的分数几乎每季度刷新一次。但与能力曲线形成鲜明对照的,是工程侧信任度的停滞甚至回落。
Stack Overflow 2025 开发者年度调研(2025-07-29 发布,49,000+ 份回答、覆盖 177 个国家、62 道题、314 项技术,第 15 届,A 级来源)给出了几组关键数字:
| 指标 | 2024 年 | 2025 年 |
|---|---|---|
| 正在使用或计划使用 AI 工具 | 76% | 84% |
| 专业开发者每日使用 | — | 51% |
| 不信任 AI 输出准确性 | 31% | 46% |
| 高度信任 AI 输出 | — | 3.1% |
| 对 AI 的正面情绪 | 70%+(2023/2024) | 60% |
与此同时,该调研中最刺眼的一条是:66% 的受访者把"AI 方案几乎对但不完全对"列为最大挫败,45.2% 表示调试 AI 生成的代码比自己写更耗时。
这组数据刻画了一个清晰的矛盾:采用率已经接近饱和,信任度却没有跟上。企业已经大规模引入 AI 编码与智能体工具,但工程上的可预期性并没有同步建立。
1.2. 瓶颈已经从模型内部外移到模型外部
两只头部实验室在 2026 年初几乎同时给出了同一判断。
OpenAI 在《Harness engineering: leveraging Codex in an agent-first world》(2026-02-11,A 级)中写道:
"Our most difficult challenges now center on designing environments, feedback loops, and control systems."
Anthropic 在《Harness design for long-running application development》(2026,A 级)中把这一判断表述为:
"Harness design is key to performance at the frontier of agentic coding."
Google DeepMind 的 Philipp Schmid 在 2025-06-30 给出的那句被反复引用的话,可以作为这一判断的最简表达:
"Most agent failures are not model failures anymore, they are context failures."
三句话指向同一结论:当模型足够强之后,制约系统表现的不再是模型本身的智能,而是模型被放置其中的那套工程环境。这套环境的名字,就是 AI Harness。
1.3. 一个被反复观察到的现象:同样的模型,不同的分数
最能说明 Harness 价值的,是基准测试中反复出现的"同模型不同分"现象。
Terminal-Bench(Stanford + Laude Institute,2025 年发布,A 级项目、C 级数据)在其方法论中明确指出:
"Terminal-Bench does not score a model in isolation. Every result is a model plus an agent harness... the leaderboard is a ranking of systems, not of models."
也就是说,排行榜上排的是系统,不是模型。下面是若干已公开的对照数据,其来源等级为 B/C,均须标注 后方可用于决策:
| 对照项 | 数据 | 说明 |
|---|---|---|
| Factory Droid + GPT-5.3-Codex | 77.3% | 与下表同为 GPT-5.3-Codex |
| OpenAI Simple Codex + GPT-5.3-Codex | 75.1% | 2.2 个百分点纯由 scaffold 差异造成 |
| KRAFTON Terminus-KIRA + Claude Opus 4.6 | 74.7% | 与下表同为 Claude Opus 4.6 |
| Bigai TongAgents + Claude Opus 4.6 | 71.9% | 差 2.8 个百分点 |
| LangChain 仅改 Harness(同模型、同 API) | 52.8% → 66.5% | 排名从 30 名外升至前 5 |
| Vercel 工具数 15 → 2 | 准确率 80% → 100%,Token −37%,速度 3.5× | 减法带来的提升 |
上述数字全部标注 。但它们共同指向的方向是明确的、且被 A 级来源确认的:Harness 的设计差异足以造成数个百分点甚至十几百分点的表现差异,这一差异量级常常超过换一个模型带来的差异。
2. AI Harness 的定义
2.1. 统一定义
本项目全文统一采用如下定义,不得改写:
AI Harness(人工智能驾驭层 / 智能体运行时框架):位于基础模型(Foundation Model)与真实业务系统之间的一整套工程化承载层。它不负责提升模型本身的智能,而负责把模型的不确定性转化为工程上的可预期性。
Harness 一词借自软件工程的 Test Harness(测试夹具):测试夹具不生产功能,但让功能可被自动、可重复、可判定地验证。AI Harness 同理——它让模型能力可被编排、可被观测、可被约束、可被回归验证。
2.2. 定义的四个限定条件
为了在后续文档中避免歧义,该定义包含四个必须同时满足的限定条件:
| 限定条件 | 含义 | 反例 |
|---|---|---|
| 位置限定 | 必须位于基础模型与业务系统之间 | 模型训练、微调本身不属于 Harness |
| 职责限定 | 不负责提升模型智能,只负责承载与约束 | 提示词技巧若仅为"让模型更聪明"则不算 Harness 的核心职责 |
| 目标限定 | 目标是可预期性,而非能力上限 | 单纯追求 benchmark 刷分不属于 Harness 工程目标 |
| 手段限定 | 通过编排、观测、约束、回归验证四种手段达成 | 一次性人工审核不是 Harness |
2.3. 官方与业界对 Harness 的四种表述
除本项目的统一定义外,以下四组官方表述可作为定义的多角度印证:
表述一 · Anthropic(产品定义)
Anthropic 在《Effective harnesses for long-running agents》(2025,A 级)中直接把 Claude Agent SDK 定义为 harness:
"The Claude Agent SDK is a powerful, general-purpose agent harness adept at coding, as well as other tasks that require the model to use tools to gather context, plan, and execute."
这是"Harness"一词被头部厂商写进产品定义的直接证据。
表述二 · OpenAI(三大支柱)
OpenAI 在《Harness engineering》(2026-02-11,A 级)中给出核心哲学 "Human Steer, Agent Execute",并把 Harness 工程拆为三大支柱:
| 支柱 | 英文 | 含义 |
|---|---|---|
| 上下文工程 | Context Engineering | 决定模型看到什么 |
| 架构约束 | Architecture Constraints | 决定系统能被怎样组合 |
| 垃圾回收 | Garbage Collection | 治理熵增,防止文档与规则腐烂 |
表述三 · martinfowler.com(方法论界定)
Birgitta Böckeler 在《Harness engineering for coding agent users》(2026,A 级)中把 Harness 拆为三个维度:
| 维度 | 英文 | 作用 |
|---|---|---|
| 引导 | guides | 前馈控制——在行动之前告诉 agent 该怎么做 |
| 传感 | sensors | 反馈控制——在行动之后检查结果是否合格 |
| 行为约束 | behavioural harness | 把前两者组织成可执行的约束体系 |
同文中还有一句应当被反复引用的话:
"A good harness should not necessarily aim to fully eliminate human input, but to direct it to where our input is most important."
表述四 · martinfowler.com(人类在环 vs 人类在环上)
《Humans and Agents in Software Engineering Loops》(2026,A 级)提出 "in the loop"(人工修改产物)与 "on the loop"(修改产生该产物的 harness)的区分,并给出界定:
"The collection of specifications, quality checks, and workflow guidance that control different levels of loops inside the how loop is the agent's harness."
这一表述的价值在于:它明确了 Harness 是可被持续改进的中间层,而不是一次性写好的提示词。
3. 词源:从 Test Harness 到 Agent Harness
3.1. 软件工程中的 Test Harness
在软件工程传统中,Test Harness(测试夹具 / 测试支架)指的是外部于被测软件的一套执行环境。它的职责是:
- 准备测试所需的输入与依赖(stub、mock、fixture);
- 驱动被测组件运行;
- 收集输出结果;
- 把结果与预期判据比对,产出通过或失败的判定。
它的关键特征是:不执行被测组件本身的业务逻辑,但让该逻辑可被自动、可重复、可判定地验证。
3.2. 同构性:为什么这个类比成立
把 Test Harness 的结构映射到 AI 场景,可以得到几乎一一对应的关系:
| Test Harness 的组成部分 | AI Harness 中的对应物 | 所属层 |
|---|---|---|
| 测试输入与 fixture | 检索到的上下文、少样本示例、环境快照 | L1 |
| 被测组件的外部依赖(stub / mock) | 工具注册、MCP server、沙箱执行器 | L2 |
| 测试驱动脚本 | 编排循环、状态机、子智能体派发 | L3 |
| 测试间共享的状态 | 会话态、长期记忆、检查点 | L4 |
| 断言与判据 | 评估集、轨迹追踪、回归基准 | L5 |
| 测试隔离与权限边界 | 权限模型、护栏、审计日志、预算约束 | L6 |
Agent Harness 与 Test Harness 的同构性在于:它存在于 agent 推理逻辑的外部,不干预模型内部的决策过程,但确保 agent 的行动在受控环境中被执行、被追踪、被约束。
需要说明的一点:本次调研未能直接抓取 Wikipedia "Test harness" 条目原文,上述描述基于软件工程通行定义并经多篇二手来源交叉印证,具体措辞标 。
3.3. 马具:harness 一词的本义
harness 一词的本义是马具(十二世纪古法语 harneis,本义为"成套战具 / 甲胄")。这个类比同样精确:
- 马决定往哪里跑 —— 对应模型决定输出什么;
- 马具不参与决策 —— 对应 Harness 不干预模型内部推理;
- 马具管控力量如何被传导、约束越界、防止脱轨 —— 对应 Harness 管控上下文、权限与副作用。
Test Harness 强调可验证性,马具强调可控性。两者合起来,恰好覆盖 AI Harness 的两个核心价值。
3.4. 命名确立的时间点
"Harness"作为 AI 领域的术语,其被主流接受经历了三个阶段:
| 时点 | 事件 | 来源等级 |
|---|---|---|
| 2025 年内 | Anthropic 已在官方文档中用 "harness" 描述 Claude Agent SDK | A |
| 2026-02-05 | Mitchell Hashimoto 发表《My AI Adoption Journey》,把 "Engineer the Harness" 列为其 AI 采用六阶段中的第五阶段 | A |
| 2026-02-11 | OpenAI 发布官方博客《Harness engineering: leveraging Codex in an agent-first world》 | A |
| 2026-02 | Birgitta Böckeler 在 martinfowler.com 发表 Harness engineering 体系文章 | A |
Hashimoto 对第五阶段的描述(转述)是:
"每次当你发现 Agent 犯了一个错误,就花时间去工程化一个解决方案,让它永远不会再犯同样的错误。"
这句话揭示了 Harness 工程的本质:不是让模型更强,而是把每一次失败固化成不会再犯的机制。
需要如实说明的是:"Agent Harness"这一术语的首创者与首次出现的一手出处,本次调研未能确认。常被提及的 LangChain《The Anatomy of an Agent Harness》一文,本次未检索到原文与确切发布日。详见第 8 节信息缺口声明。
4. 六层能力模型
4.1. 模型总览
本项目全文统一使用如下六层能力模型。该模型是后续全部文档的公共坐标系。
| 层 | 名称 | 英文 | 职责 | 典型实现 |
|---|---|---|---|---|
| L1 | 上下文工程层 | Context Engineering | 决定模型"看到什么",含检索、压缩、缓存、优先级排序 | RAG、Context Compaction、Prompt Assembly、KV Cache 复用 |
| L2 | 工具与执行层 | Tooling & Execution | 决定模型"能做什么",含工具注册、沙箱、并行/串行调度 | MCP、Function Calling、沙箱执行器、Computer Use |
| L3 | 编排与控制层 | Orchestration & Control | 决定"按什么顺序做",含规划、状态机、子智能体派发、中断与恢复 | Agent Loop、Plan-and-Execute、DAG/Workflow、Sub-agent |
| L4 | 记忆与状态层 | Memory & State | 决定"记住什么",含会话态、长期记忆、工件与检查点 | Session Store、Episodic/Semantic Memory、Checkpoint |
| L5 | 评估与观测层 | Evaluation & Observability | 决定"做得好不好",含轨迹追踪、指标、回归集、A/B | Trace、Eval Set、Golden Dataset、Online Metrics |
| L6 | 治理与安全层 | Governance & Safety | 决定"不能做什么",含权限、审计、护栏、合规、成本控制 | RBAC、护栏模型、审计日志、Budget Guardrail |
4.2. L1 上下文工程层
L1 回答的问题是:在这一步推理之前,模型应该看到哪些 token。
Anthropic 在《Effective context engineering for AI agents》(2025,A 级)中给出的官方定义是:在 LLM 推理期间,策展并维护那组最优 Token(信息)的一整套策略。
该层最关键的两个官方概念是:
- context rot(上下文腐烂):官方明确其为"性能梯度,而非硬性悬崖"——上下文变长时性能是渐进退化,不是到某个长度突然崩塌。这使得上下文治理必须靠工程手段持续进行,而不能依赖"卡一个阈值"。
- 注意力预算(attention budget):由于自注意力的 n² 关联特性,上下文中每增加一个 token 都会稀释模型对其他 token 的注意力。因此上下文是稀缺资源,不是免费容器。
Andrej Karpathy 在 2025-06-25 给出的定义被引用最广:
"Context engineering is the delicate art and science of filling the context window with just the right information for the next step."
他同时指出,context engineering 只是"an emerging thick layer of non-trivial software that coordinates individual LLM calls into full LLM apps"的一小部分——这句话正是"为什么需要六层 Harness 而非只有上下文工程"的最佳注脚。
4.3. L2 工具与执行层
L2 回答的问题是:模型能对环境施加哪些动作,这些动作在哪里执行。
该层包含三类组件:
| 组件类别 | 作用 | 代表 |
|---|---|---|
| 工具注册与描述 | 把外部能力声明为模型可调用的结构化接口 | Function Calling、JSON Schema 工具描述 |
| 连接协议 | 让工具生态与宿主应用解耦 | MCP(Model Context Protocol) |
| 执行环境 | 限定动作的作用范围与副作用边界 | 沙箱(Seatbelt / bubblewrap / Landlock + seccomp) |
该层的一个反直觉发现值得强调:工具数量与表现并非正相关。Vercel 把工具数量从 15 个削减到 2 个后,准确率从 80% 升至 100%,Token 消耗下降 37%,速度提升 3.5 倍(C 级来源,标 )。Anthropic 官方文档亦建议工具应"自包含、对错误健壮、用途极其明确",避免功能过载与决策点含糊(A 级)。
4.4. L3 编排与控制层
L3 回答的问题是:按什么顺序做,谁来做什么,中断后怎么恢复。
主要编排形态包括:
| 形态 | 适用 | 代表 |
|---|---|---|
| 单循环(Agent Loop) | 通用任务,模型自主决策下一步 | ReAct 循环、Claude Code 主循环 |
| 计划-执行(Plan-and-Execute) | 长周期、需要全局规划的任务 | Claude Code Plan Mode |
| 有向无环图 / 工作流 | 确定性要求高的业务流程 | DAG / Workflow 引擎 |
| 子智能体派发 | 可并行探索的复杂研究任务 | Sub-agent 架构、多 agent 研究系统 |
Anthropic 官方给出的子智能体参数是:子 agent 可用数万 token 深入探索,但只回传 1,000~2,000 tokens 的浓缩摘要(A 级)。这是一种典型的"用上下文换并行度"的架构取舍。
4.5. L4 记忆与状态层
L4 回答的问题是:跨会话、跨上下文窗口时,状态如何交接。
Anthropic 在《Effective harnesses for long-running agents》(A 级)中把这一难题表述为:
想象一个由工程师轮班工作的软件项目,每位新工程师上班时,对前一班发生的事情毫无记忆。
其官方解法是 claude-progress.txt 进度文件加 git 历史,并规定 Coding Agent 每次会话开场必做三步:
- 执行
pwd确认当前工作目录; - 读取 git 日志与进度文件;
- 读取功能清单,选出最高优先级的未完成项。
同时规定了结束时的约束:必须把环境留在可合并的干净状态。
该层还需区分两种上下文处理的差异(A 级,来自 Anthropic 三 Agent 架构文章):
| 机制 | 做法 | 优点 | 代价 |
|---|---|---|---|
| Compaction(压缩) | 就地摘要 | 保留连续性 | "上下文焦虑"仍在 |
| Context Reset(重置) | 清空后重新注入 | 给干净白板 | 交接产物必须足够完整 |
4.6. L5 评估与观测层
L5 回答的问题是:做得好不好,如何判定,如何回归。
该层最重要的设计原则来自 Anthropic《Harness design for long-running apps》(A 级):评估者与被评估者必须分离。官方观察到,让 agent 评估自己的作品时它会"自信地称赞"——即便在人类观察者眼中质量明显平庸。官方的原话是:
把一个独立的 Evaluator 调教得怀疑,远比让 Generator 自我批判容易得多。
这一设计的灵感来自生成对抗网络(GAN):Planner / Generator / Evaluator 三角色中,Evaluator 对产品深度、功能性、视觉设计、代码质量四个维度分别设定硬阈值,任一项低于阈值则该迭代失败,并把详细失败原因反馈给 Generator。
4.7. L6 治理与安全层
L6 回答的问题是:什么不能做,做了怎么发现,花多少钱上限是多少。
该层包含权限模型(RBAC)、护栏模型、审计日志与预算护栏(Budget Guardrail)四类组件。
一个必须澄清的常见误解是:治理会拖慢速度。Anthropic 的沙箱实证给出了相反结论——其内部使用发现,沙箱化安全地将权限提示减少了 84%(A 级)。约束不是自主性的对立面,而是自主性的前提。
4.8. 六层之间的依赖与调用关系
图 4-1|六层之间的依赖与调用关系
六层并非并列堆砌,而是存在明确的依赖方向:
┌─────────────────────────────────────────┐
│ L6 治理与安全层(贯穿全层,横向切面) │
└─────────────────────────────────────────┘
▲ 约束与审计
L1 上下文 ──► L2 工具与执行 ──► L3 编排与控制
▲ │ │
│ ▼ ▼
└──────── L4 记忆与状态 ◄──────────┘
│
▼
L5 评估与观测
│
└──► 反馈回 L1(改变下次看到什么) 阅读要点:
- L1 → L2 → L3 是主执行链:先决定看到什么,再决定能做什么,最后决定按什么顺序做。
- L4 为 L1/L3 提供跨会话的状态支撑,是时间维度的横向支撑层。
- L5 观察全链并产出反馈,反馈最终回到 L1(改变下次的上下文组成)。
- L6 是横向切面,对 L1~L5 全部施加约束并记录审计。
5. 与相邻概念的边界
5.1. 边界总表
| 概念 | 与 AI Harness 的关系 |
|---|---|
| Agent(智能体) | 运行在 Harness 之上的执行单元;Harness 是 Agent 的"底盘" |
| Agent Framework(LangGraph 等) | 主要覆盖 L2/L3,是 Harness 的子集 |
| Agent Platform(Dify 等) | Harness 的产品化封装,叠加 UI、租户、计费 |
| AI IDE(Cursor 等) | Harness 在编码场景的垂直集成形态 |
| Model(模型) | Harness 的被承载对象,不属于 Harness 本身 |
| MLOps / LLMOps | 关注模型生命周期;Harness 关注智能体任务生命周期 |
5.2. 与 Agent 的边界
Agent 是执行单元,Harness 是底盘。二者是"车与路"的关系:同一辆车在不同路上表现不同,同一条路也可以跑不同的车。
判据:如果更换它不改变"模型的输出分布如何被约束与验证",它属于 Agent;如果更换它改变了"模型如何被编排、观测、约束与回归验证",它属于 Harness。
中国官方对"智能体"的定义可作为中文语境的口径(中国产业经济信息网《人工智能 智能体互联》系列国家标准解读,2026,A 级):
"智能体是具备自主感知、记忆、决策、交互与执行能力的新型智能系统,已成为人工智能产品与服务的关键载体。"
5.3. 与 Agent Framework 的边界
Agent Framework(如 LangChain / LangGraph)主要覆盖 L2 与 L3——即工具调用与编排。它是 Harness 的子集。
三者的层次关系是:
| 层次 | 提供什么 | 是否解决生产问题 |
|---|---|---|
| Framework | 构建块(building blocks) | 不直接解决 |
| Harness | 有主观立场的基础设施层——为上下文管理、工具执行、状态持久化、验证提供默认架构 | 是 |
| Agent | 定义在 Harness 之上、关注"做什么"的具体业务逻辑 | 是 |
关键区别在于:Framework 中立,Harness 有主张。Harness 会明确告诉你上下文该怎么组织、工具该怎么裁剪、什么算"完成",而 Framework 只提供能力不提供意见。
5.4. 与 Agent Platform 的边界
Agent Platform 是 Harness 的产品化封装,在 Harness 之上叠加了:
- 可视化编排 UI;
- 多租户与权限体系;
- 计费与配额;
- 面向非技术用户的发布与运营能力。
判据:剥离 UI、租户与计费后剩下的那部分运行时,就是 Harness。
5.5. 与 AI IDE 的边界
AI IDE 是 Harness 在编码场景的垂直集成形态。它在通用 Harness 之上叠加了编辑器、终端、diff 视图、LSP 集成等编码专属能力。
Cursor、Claude Code、Codex CLI 等都可归入此类,但其中 Claude Code 与 Codex CLI 更接近"终端形态的 Harness",而 Cursor 更接近"IDE 形态的 Harness"。
5.6. 与 Model 的边界
Model 是 Harness 的被承载对象,不属于 Harness 本身。
这条边界在 2025—2026 年出现了值得注意的模糊化:Anthropic 官方指出,Claude Code / Codex 等产品已在后训练阶段把模型与 Harness 放在一起训练,造成"模型过拟合到特定 Harness 结构"的副作用——改变工具逻辑反而让模型表现变差(A 级)。
这一现象的实践含义是:适合你任务的最佳 Harness,不一定是模型被后训练时使用的那个。
5.7. 与 MLOps / LLMOps 的边界
| 维度 | MLOps / LLMOps | Harness Engineering |
|---|---|---|
| 关注对象 | 模型生命周期:训练、微调、部署、漂移监控 | 智能体任务生命周期:单次任务从意图到验证的闭环 |
| 时间尺度 | 天到月 | 秒到小时 |
| 核心产物 | 模型版本、特征仓库、部署流水线 | 上下文策略、工具集、评估集、护栏规则 |
| 复用手段 | 特征复用、模型复用 | 软件工程手段复用(左移反馈、变异测试、结构测试) |
martinfowler.com 的两篇文章中提到的 "shift feedback left"、mutation testing、structural testing 等软件工程手段被复用进 Harness,这是与 MLOps 方法论的直接分野(A 级)。
5.8. 一个便于记忆的类比:计算机四层栈
业界流传的一组类比(C 级来源转述,类比本身可引用,其中的具体数字与案例标 ):
| 计算机概念 | AI 系统对应物 |
|---|---|
| CPU | 模型(Model) |
| RAM | 上下文窗口(Context Window) |
| 操作系统 | AI Harness |
| 应用程序 | Agent |
这个类比的价值在于:正如操作系统不生产计算能力但决定计算能力如何被使用,Harness 也不生产智能,但决定智能如何被安全、可预期地交付。
6. AI Harness 的价值主张
6.1. 把不确定性转化为可预期性
模型的输出本质上是概率性的。Harness 不改变这一本质,但通过上下文约束、工具边界、评估判据与回归集,把概率分布收窄到工程可接受的区间。
Anthropic 沙箱实证提供了量化锚点:权限提示减少 84%,同时安全性反而提升(A 级)。这说明可预期性的提升并不以牺牲能力为代价。
6.2. 让治理与自主性成为正和
传统观念认为权限管控会降低 agent 的自主性。但三组证据指向相反结论:
| 证据 | 数据 | 来源等级 |
|---|---|---|
| Anthropic 沙箱 | 权限提示减少 84% | A |
| OpenAI 架构约束 | "约束让速度成为可能,且架构不漂移" | A |
| Codex Auto-review | 人工审批停止次数约为手动模式的 1/200,审阅批准率约 99% | B, |
结论:约束即能力。
6.3. 让能力可被回归验证
Harness 的第三重价值是让"模型能力"变成一个可被回归验证的工程对象。
SWE-bench(2023-10-10 发布,2,294 个任务实例、12 个 Python 开源仓库,ICLR 2024 Oral,A 级)确立的原则是程序化判分——没有"看起来不错但测试不过"的部分分。Terminal-Bench 的原则同样是 "either the automated tests pass or they do not"。
Anthropic 官方还给出一个具体建议:给 agent 配备浏览器自动化工具(如 Playwright MCP),让它像真人一样验证自己的产物,这显著提升了表现(A 级)。
7. 总结
AI Harness 不是一个新发明的技术组件,而是对已有工程实践的一次命名与归纳。它的出现有三个必要条件,在 2025 年底至 2026 年初同时满足:
- 模型足够强:强到失败不再主要源于模型智能不足,而源于环境设计不当;
- 工具有了标准:MCP 让工具生态从 N×M 集成问题变为 N+M;
- 治理有了范本:沙箱、权限、审计的实践被头部厂商跑通并量化。
它的核心命题可以压缩为一句话:在模型能力给定的前提下,系统表现的方差主要由 Harness 决定。
后续四篇文档将依次展开:它如何从提示词工程一步步演化而来(02-发展历史)、当代主流实现的分层细节(03-架构演进)、下一步的技术与标准化方向(04-未来发展),以及这些事实共同指向的判断(05-总结)。
8. 信息缺口声明
本文件涉及以下信息缺口,已在正文对应位置标注,此处汇总:
- ISO/IEC 层面的智能体互联国际标准:本次调研未检索到 ISO/IEC 已发布或已立项的智能体互联国际标准编号,暂无权威信息。
- "Agent Harness"术语的首创者与首次出现出处:未找到确切的一手首创文献,暂无权威信息。可确认的是 Anthropic 于 2025 年已用 "harness" 描述 Claude Agent SDK,Mitchell Hashimoto 于 2026-02-05 命名 "Harness Engineering",OpenAI 于 2026-02-11 将其推向主流。更早的溯源(如 LangChain《The Anatomy of an Agent Harness》博客)未检索到原文与确切发布日。
- Wikipedia "Test harness" 条目原文:未直接抓取,仅经二手转述,第 3.1 节具体措辞标 。
- Terminal-Bench 官方榜单当前数据:官方站(tbench.ai)未直接抓取,第 1.3 节所有榜单数字均为第三方转述,标 。
- 第 1.3 节全部对照数据:包括 Factory Droid 77.3%、OpenAI Simple Codex 75.1%、KRAFTON 74.7%、Bigai 71.9%、LangChain 52.8%→66.5%、Vercel 80%→100%,均来自 B/C 级来源,标 。
- Codex Auto-review 的 1/200 与 99%:来自 B 级来源,标 。
- 计算机四层栈类比的原始出处:类比本身经多方转述可引用,但原始出处与其配套的具体数字与案例标 。
9. 参考资料
- Effective context engineering for AI agents — Anthropic,2025。https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Effective harnesses for long-running agents — Anthropic,2025。https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
- Harness design for long-running application development — Anthropic,2026。https://www.anthropic.com/engineering/harness-design-long-running-apps
- Harness engineering: leveraging Codex in an agent-first world — OpenAI,2026-02-11。https://openai.com/index/harness-engineering/
- Harness engineering for coding agent users — Birgitta Böckeler,martinfowler.com,2026。https://martinfowler.com/articles/harness-engineering.html
- Humans and Agents in Software Engineering Loops — martinfowler.com,2026。https://martinfowler.com/articles/exploring-gen-ai/humans-and-agents.html
- My AI Adoption Journey — Mitchell Hashimoto,2026-02-05。https://mitchellh.com/writing/my-ai-adoption-journey
- 2025 Stack Overflow Developer Survey — Stack Overflow,2025-07-29。https://survey.stackoverflow.co/2025/
- Equipping agents for the real world with Agent Skills — Anthropic,2025-10-16。https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues? — Jimenez、Yang 等(Princeton),2023-10(ICLR 2024 Oral)。https://www.swebench.com/;arXiv:2310.06770
- Terminal-Bench — Stanford / Laude Institute,2025。https://www.tbench.ai/
- 《人工智能 智能体互联》系列国家标准解读 — 中国产业经济信息网,2026。https://cinic.org.cn/xw/zcdt/1643418.html
- Agent Harness:2026 年 AI 工程的核心范式 — 腾讯云开发者社区,2026。https://developer.cloud.tencent.com/article/2698416
- Terminal-Bench: The CLI Autonomy Standard — AgentMarketCap,2026-04-09。https://agentmarketcap.ai/blog/2026/04/09/terminal-bench-cli-autonomy-standard-coding-agents
Introduction
图 0-1|AI Harness 六层能力模型与依赖结构
数据来源:基于本文分析绘制的示意图。
1. Background and Problem Statement
1.1. Model capability is rising, but engineering confidence is not keeping pace
Since 2023, the capability metrics of foundation models have continued to climb, with scores on various coding and reasoning benchmarks being refreshed almost every quarter. In stark contrast to the capability curve, however, is the stagnation or even decline of trust on the engineering side.
The Stack Overflow 2025 Developer Survey (published 2025-07-29; 49,000+ responses, covering 177 countries, 62 questions, 314 technologies; the 15th edition; A-level source) provides several key figures:
| Metric | 2024 | 2025 |
|---|---|---|
| Currently using or planning to use AI tools | 76% | 84% |
| Professional developers using it daily | — | 51% |
| Do not trust AI output accuracy | 31% | 46% |
| Highly trust AI output | — | 3.1% |
| Positive sentiment toward AI | 70%+ (2023/2024) | 60% |
Meanwhile, the most striking finding in that survey is this: 66% of respondents cited "an AI solution that is almost right but not quite" as their biggest frustration, and 45.2% said debugging AI-generated code takes longer than writing it themselves.
These figures paint a clear contradiction: adoption has neared saturation, but trust has not kept pace. Enterprises have widely adopted AI coding and agent tools at scale, yet engineering predictability has not been established in tandem.
1.2. The bottleneck has moved from inside the model to outside it
Two leading labs reached the same judgment almost simultaneously in early 2026.
OpenAI writes in Harness engineering: leveraging Codex in an agent-first world (2026-02-11, A level):
"Our most difficult challenges now center on designing environments, feedback loops, and control systems."
Anthropic frames the same judgment in Harness design for long-running application development (2026, A level):
"Harness design is key to performance at the frontier of agentic coding."
The often-quoted remark given by Google DeepMind's Philipp Schmid on 2025-06-30 serves as the most concise expression of this judgment:
"Most agent failures are not model failures anymore, they are context failures."
All three statements point to the same conclusion: once the model is strong enough, what limits a system's performance is no longer the model's own intelligence but the engineering environment in which the model is placed. That environment is called an AI Harness.
1.3. A repeatedly observed phenomenon: the same model, different scores
The phenomenon that best illustrates the value of a Harness is the "same model, different scores" result that recurs in benchmarks.
Terminal-Bench (Stanford + Laude Institute, released 2025; A-level project, C-level data) states this explicitly in its methodology:
"Terminal-Bench does not score a model in isolation. Every result is a model plus an agent harness... the leaderboard is a ranking of systems, not of models."
In other words, what the leaderboard ranks are systems, not models. Below are several publicly available comparison figures, with a source grade of B/C; all of them must be marked [to be verified] before being used for decisions:
| Comparison | Data | Notes |
|---|---|---|
| Factory Droid + GPT-5.3-Codex | 77.3% | Same GPT-5.3-Codex as the table below |
| OpenAI Simple Codex + GPT-5.3-Codex | 75.1% | 2.2 percentage points caused purely by scaffold differences |
| KRAFTON Terminus-KIRA + Claude Opus 4.6 | 74.7% | Same Claude Opus 4.6 as the table below |
| Bigai TongAgents + Claude Opus 4.6 | 71.9% | A 2.8 percentage-point difference |
| LangChain, Harness changed only (same model, same API) | 52.8% → 66.5% | Ranking rose from outside the top 30 into the top 5 |
| Vercel tool count 15 → 2 | Accuracy 80% → 100%, Token −37%, speed 3.5× | Improvement gained by subtraction |
All of the above figures are marked [to be verified]. But the direction they jointly point to is clear and confirmed by A-level sources: differences in Harness design are enough to produce performance differences of several or even a dozen-plus percentage points, an order of magnitude that often exceeds the difference from switching models.
2. Definition of AI Harness
2.1. Unified definition
This project consistently uses the following definition throughout, and it must not be rewritten:
AI Harness (artificial intelligence harness layer / agent runtime framework): a complete engineering carrier layer that sits between the foundation model and the real business system. It is not responsible for improving the model's own intelligence, but rather for converting the model's uncertainty into engineering predictability.
The term "harness" is borrowed from the software-engineering Test Harness: a test harness does not produce functionality, but it makes functionality verifiable automatically, repeatably, and decisively. The same holds for an AI Harness — it makes model capabilities orchestratable, observable, constrainable, and regression-verifiable.
2.2. The four qualifying conditions of the definition
To avoid ambiguity in the documents that follow, the definition comprises four qualifying conditions that must hold simultaneously:
| Condition | Meaning | Counterexample |
|---|---|---|
| Position | Must sit between the foundation model and the business system | Model training and fine-tuning themselves are not part of a Harness |
| Responsibility | Not responsible for improving model intelligence; only for carrying and constraining | A prompt technique used merely to "make the model smarter" is not a core Harness responsibility |
| Goal | The goal is predictability, not capability ceilings | Chasing benchmark scores alone is not a Harness engineering goal |
| Means | Achieved through the four means of orchestration, observation, constraint, and regression verification | A one-off manual review is not a Harness |
2.3. Four official and industry formulations of "Harness"
In addition to this project's unified definition, the following four official formulations offer multi-angle corroboration of the definition:
Formulation 1 · Anthropic (product definition)
In Effective harnesses for long-running agents (2025, A level), Anthropic directly defines the Claude Agent SDK as a harness:
"The Claude Agent SDK is a powerful, general-purpose agent harness adept at coding, as well as other tasks that require the model to use tools to gather context, plan, and execute."
This is direct evidence that the word "Harness" has been written into a leading vendor's product definition.
Formulation 2 · OpenAI (three pillars)
In Harness engineering (2026-02-11, A level), OpenAI gives the core philosophy "Human Steer, Agent Execute" and breaks Harness engineering into three pillars:
| Pillar | English | Meaning |
|---|---|---|
| Context Engineering | Context Engineering | Determines what the model sees |
| Architecture Constraints | Architecture Constraints | Determines how the system can be assembled |
| Garbage Collection | Garbage Collection | Governs entropy growth, preventing documents and rules from rotting |
Formulation 3 · martinfowler.com (methodological framing)
In Harness engineering for coding agent users (2026, A level), Birgitta Böckeler breaks the Harness into three dimensions:
| Dimension | English | Function |
|---|---|---|
| Guides | guides | Feed-forward control — tells the agent what to do before it acts |
| Sensors | sensors | Feedback control — checks after the action whether the result is acceptable |
| Behavioural harness | behavioural harness | Organizes the former two into an executable system of constraints |
The same article also contains a line that deserves to be quoted repeatedly:
"A good harness should not necessarily aim to fully eliminate human input, but to direct it to where our input is most important."
Formulation 4 · martinfowler.com (human-in-the-loop vs. human-on-the-loop)
Humans and Agents in Software Engineering Loops (2026, A level) proposes the distinction between "in the loop" (a human edits the artifacts) and "on the loop" (a human edits the harness that produces the artifacts), and gives this definition:
"The collection of specifications, quality checks, and workflow guidance that control different levels of loops inside the how loop is the agent's harness."
The value of this formulation is that it makes clear that a Harness is a middle layer that can be continuously improved, not a one-off written prompt.
3. Etymology: from Test Harness to Agent Harness
3.1. The Test Harness in software engineering
In the software-engineering tradition, a Test Harness (test fixture / test rig) refers to an execution environment external to the software under test. Its responsibilities are:
- Prepare the inputs and dependencies needed for testing (stubs, mocks, fixtures);
- Drive the component under test to run;
- Collect the output results;
- Compare the results against the expected criteria and produce a pass/fail determination.
Its key characteristic is this: it does not execute the business logic of the component under test itself, but it makes that logic verifiable automatically, repeatably, and decisively.
3.2. Homology: why this analogy holds
Mapping the structure of a Test Harness onto the AI scenario yields an almost one-to-one correspondence:
| Test Harness component | AI Harness counterpart | Layer |
|---|---|---|
| Test inputs and fixtures | Retrieved context, few-shot examples, environment snapshots | L1 |
| External dependencies of the component under test (stub / mock) | Tool registration, MCP servers, sandbox executors | L2 |
| Test driver scripts | Orchestration loops, state machines, sub-agent dispatch | L3 |
| State shared between tests | Session state, long-term memory, checkpoints | L4 |
| Assertions and criteria | Eval sets, trace tracking, regression benchmarks | L5 |
| Test isolation and permission boundaries | Permission models, guardrails, audit logs, budget constraints | L6 |
The homology between an Agent Harness and a Test Harness lies in the fact that it exists outside the agent's reasoning logic, does not intervene in the model's internal decision process, yet ensures that the agent's actions are executed, tracked, and constrained within a controlled environment.
One point worth noting: this research was unable to directly capture the original text of the Wikipedia "Test harness" entry; the description above is based on the common software-engineering definition and cross-corroborated through multiple secondary sources, with the specific wording marked [to be verified].
3.3. Horse tack: the original meaning of the word "harness"
The original meaning of the word "harness" is horse tack (from twelfth-century Old French harneis, originally meaning "a full set of battle gear / armor"). This analogy is equally precise:
- The horse decides where to run — corresponding to the model deciding what to output;
- The tack does not take part in the decision — corresponding to a Harness not intervening in the model's internal reasoning;
- The tack governs how force is transmitted, constrains overreach, and prevents derailment — corresponding to a Harness governing context, permissions, and side effects.
The Test Harness emphasizes verifiability, while horse tack emphasizes controllability. Taken together, the two exactly cover the two core values of an AI Harness.
3.4. The point in time when the term was established
As a term in the AI field, "Harness" went through three stages on its way to mainstream acceptance:
| Time | Event | Source grade |
|---|---|---|
| Within 2025 | Anthropic already used "harness" in its official documentation to describe the Claude Agent SDK | A |
| 2026-02-05 | Mitchell Hashimoto published My AI Adoption Journey, listing "Engineer the Harness" as the fifth of his six stages of AI adoption | A |
| 2026-02-11 | OpenAI published the official blog post Harness engineering: leveraging Codex in an agent-first world | A |
| 2026-02 | Birgitta Böckeler published her body of work on Harness engineering on martinfowler.com | A |
Hashimoto's description of the fifth stage (paraphrased) is:
"Every time you find an Agent making a mistake, spend the time to engineer a solution so that it never makes the same mistake again."
This statement reveals the essence of Harness engineering: not making the model stronger, but turning every failure into a mechanism that will not recur.
It must be stated honestly: this research could not confirm the original coiner of the term "Agent Harness" nor the first-hand source of its first appearance. The frequently cited LangChain article The Anatomy of an Agent Harness could not be retrieved for its original text or exact publication date in this research. See Section 8, the information-gap statement, for details.
4. The Six-Layer Capability Model
4.1. Model overview
This project consistently uses the following six-layer capability model throughout. It is the common coordinate system for all documents that follow.
| Layer | Name | English | Responsibility | Typical implementations |
|---|---|---|---|---|
| L1 | Context Engineering | Context Engineering | Determines what the model "sees," including retrieval, compression, caching, and priority sorting | RAG, Context Compaction, Prompt Assembly, KV Cache reuse |
| L2 | Tooling & Execution | Tooling & Execution | Determines what the model "can do," including tool registration, sandboxes, and parallel/serial scheduling | MCP, Function Calling, sandbox executors, Computer Use |
| L3 | Orchestration & Control | Orchestration & Control | Determines "in what order to do things," including planning, state machines, sub-agent dispatch, and interruption/resume | Agent Loop, Plan-and-Execute, DAG/Workflow, Sub-agent |
| L4 | Memory & State | Memory & State | Determines "what to remember," including session state, long-term memory, artifacts, and checkpoints | Session Store, Episodic/Semantic Memory, Checkpoint |
| L5 | Evaluation & Observability | Evaluation & Observability | Determines "how well it did," including trace tracking, metrics, regression sets, and A/B | Trace, Eval Set, Golden Dataset, Online Metrics |
| L6 | Governance & Safety | Governance & Safety | Determines "what cannot be done," including permissions, audit, guardrails, compliance, and cost control | RBAC, guardrail models, audit logs, Budget Guardrail |
4.2. L1 Context Engineering
The question L1 answers is: before this step of reasoning, which tokens should the model see.
Anthropic's official definition, given in Effective context engineering for AI agents (2025, A level), is: the full set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference.
The two most critical official concepts in this layer are:
- context rot: officially characterized as a "performance gradient, not a hard cliff" — as context grows, performance degrades gradually rather than collapsing suddenly at some length. This means context governance must be maintained continuously through engineering, and cannot rely on "setting a single threshold."
- attention budget: because of the n² coupling property of self-attention, every additional token in the context dilutes the model's attention toward other tokens. Context is therefore a scarce resource, not a free container.
The definition given by Andrej Karpathy on 2025-06-25 is the most widely cited:
"Context engineering is the delicate art and science of filling the context window with just the right information for the next step."
He also pointed out that context engineering is only a small part of "an emerging thick layer of non-trivial software that coordinates individual LLM calls into full LLM apps" — a sentence that is the best annotation for the question "why do we need a six-layer Harness rather than context engineering alone."
4.3. L2 Tooling & Execution
The question L2 answers is: what actions can the model exert on the environment, and where those actions are executed.
This layer contains three categories of components:
| Component category | Function | Representatives |
|---|---|---|
| Tool registration & description | Declares external capabilities as structured interfaces callable by the model | Function Calling, JSON Schema tool descriptions |
| Connection protocol | Decouples the tool ecosystem from the host application | MCP (Model Context Protocol) |
| Execution environment | Bounds the scope of actions and the boundary of side effects | Sandbox (Seatbelt / bubblewrap / Landlock + seccomp) |
One counterintuitive finding in this layer deserves emphasis: the number of tools is not positively correlated with performance. After Vercel cut its tool count from 15 to 2, accuracy rose from 80% to 100%, token consumption fell by 37%, and speed improved 3.5× (C-level source, marked [to be verified]). Anthropic's official documentation likewise recommends that tools be "self-contained, robust to errors, and extremely clear in purpose," avoiding feature overload and ambiguous decision points (A level).
4.4. L3 Orchestration & Control
The question L3 answers is: in what order to do things, who does what, and how to recover after interruption.
The main orchestration forms include:
| Form | Applies to | Representatives |
|---|---|---|
| Agent Loop (single loop) | General tasks, where the model autonomously decides the next step | ReAct loop, Claude Code main loop |
| Plan-and-Execute | Long-horizon tasks that require global planning | Claude Code Plan Mode |
| DAG / Workflow | Business processes with high determinism requirements | DAG / Workflow engines |
| Sub-agent dispatch | Complex research tasks that can be explored in parallel | Sub-agent architectures, multi-agent research systems |
Anthropic's official guidance on sub-agents is that sub-agents may use tens of thousands of tokens to explore deeply, but only return a condensed summary of 1,000–2,000 tokens (A level). This is a typical architectural trade-off of "trading context for parallelism."
4.5. L4 Memory & State
The question L4 answers is: how state is handed over across sessions and across context windows.
In Effective harnesses for long-running agents (A level), Anthropic frames this difficulty as:
Imagine a software project staffed by engineers on shifts, where each new engineer who comes on duty has no memory of what happened in the previous shift.
Its official solution is the claude-progress.txt progress file plus git history, and it stipulates that a Coding Agent must take three steps at the start of every session:
- Run
pwdto confirm the current working directory; - Read the git log and the progress file;
- Read the feature list and select the highest-priority uncompleted item.
It also stipulates a constraint at the end: the environment must be left in a clean, mergeable state.
This layer also requires distinguishing between two context-handling approaches (A level, from Anthropic's three-agent architecture article):
| Mechanism | Approach | Advantage | Cost |
|---|---|---|---|
| Compaction | Summarize in place | Preserves continuity | "Context anxiety" remains |
| Context Reset | Clear, then re-inject | Provides a clean slate | The handoff artifact must be complete enough |
4.6. L5 Evaluation & Observability
The question L5 answers is: how well it did, how that is judged, and how regression is ensured.
The most important design principle in this layer comes from Anthropic's Harness design for long-running apps (A level): the evaluator and the evaluated must be separated. Anthropic observed that when an agent evaluates its own work it will "confidently praise" it — even when the quality is plainly mediocre in the eyes of a human observer. Their exact words are:
Teaching an independent Evaluator to be skeptical is far easier than getting a Generator to criticize itself.
This design is inspired by generative adversarial networks (GANs): among the three roles of Planner / Generator / Evaluator, the Evaluator sets hard thresholds for each of four dimensions — product depth, functionality, visual design, and code quality — and if any dimension falls below the threshold, that iteration fails and the detailed reasons for the failure are fed back to the Generator.
4.7. L6 Governance & Safety
The question L6 answers is: what cannot be done, how violations are discovered, and what the spend ceiling is.
This layer contains four categories of components: the permission model (RBAC), guardrail models, audit logs, and budget guardrails (Budget Guardrail).
A common misconception that must be cleared up is that governance slows things down. Anthropic's sandbox evidence points to the opposite conclusion — its internal usage found that sandboxing safely reduced permission prompts by 84% (A level). Constraint is not the opposite of autonomy; it is the precondition for autonomy.
4.8. Dependencies and call relationships between the six layers
图 4-1|六层之间的依赖与调用关系
The six layers are not stacked in parallel; rather, there is a clear direction of dependency:
Reading notes:
- L1 → L2 → L3 is the main execution chain: first decide what to see, then decide what can be done, and finally decide in what order to do things.
- L4 provides cross-session state support for L1/L3, and is a cross-cutting support layer along the time dimension.
- L5 observes the entire chain and produces feedback, which ultimately returns to L1 (changing the composition of the next context).
- L6 is a cross-cutting slice that imposes constraints on all of L1–L5 and records the audit.
5. Boundaries with Adjacent Concepts
5.1. Boundary overview table
| Concept | Relationship to AI Harness |
|---|---|
| Agent | The execution unit that runs on top of the Harness; the Harness is the Agent's "chassis" |
| Agent Framework (LangGraph, etc.) | Primarily covers L2/L3; a subset of the Harness |
| Agent Platform (Dify, etc.) | The Harness's productized packaging, layering on UI, tenants, and billing |
| AI IDE (Cursor, etc.) | The Harness's vertically integrated form for the coding scenario |
| Model | The object being carried by the Harness; not itself part of the Harness |
| MLOps / LLMOps | Concerned with the model lifecycle; the Harness is concerned with the agent task lifecycle |
5.2. The boundary with Agents
An Agent is the execution unit, and the Harness is the chassis. Their relationship is like "car and road": the same car performs differently on different roads, and the same road can carry different cars.
The criterion: if replacing it does not change "how the model's output distribution is constrained and verified," it belongs to the Agent; if replacing it changes "how the model is orchestrated, observed, constrained, and regression-verified," it belongs to the Harness.
China's official definition of "agent" can serve as a reference point for the Chinese context (from the interpretation of the national standard series Artificial Intelligence — Agent Interconnection by the China Information Economics Network, 2026, A level):
"An agent is a new type of intelligent system with autonomous perception, memory, decision-making, interaction, and execution capabilities, and has become a key carrier of AI products and services."
5.3. The boundary with Agent Frameworks
Agent Frameworks (such as LangChain / LangGraph) primarily cover L2 and L3 — that is, tool invocation and orchestration. They are a subset of the Harness.
The hierarchical relationship among the three is:
| Layer | What it provides | Does it solve production problems? |
|---|---|---|
| Framework | Building blocks | Not directly |
| Harness | An infrastructure layer with a point of view — provides default architectures for context management, tool execution, state persistence, and verification | Yes |
| Agent | Concrete business logic defined on top of the Harness, focused on "what to do" | Yes |
The key difference is that a Framework is neutral, while a Harness takes a stand. A Harness will explicitly tell you how context should be organized, how tools should be trimmed, and what counts as "done," whereas a Framework only provides capabilities, not opinions.
5.4. The boundary with Agent Platforms
An Agent Platform is the Harness's productized packaging, layering on top of the Harness:
- A visual orchestration UI;
- Multi-tenant and permission systems;
- Billing and quotas;
- Publishing and operations capabilities for non-technical users.
The criterion: the portion of the runtime that remains after stripping away the UI, tenants, and billing is the Harness.
5.5. The boundary with AI IDEs
An AI IDE is the Harness's vertically integrated form for the coding scenario. On top of a general Harness it layers coding-specific capabilities such as an editor, terminal, diff view, and LSP integration.
Cursor, Claude Code, and Codex CLI can all be classified here, though among them Claude Code and Codex CLI are closer to "terminal-form Harnesses," while Cursor is closer to an "IDE-form Harness."
5.6. The boundary with Models
A Model is the object being carried by the Harness; it does not itself belong to the Harness.
This boundary saw notable blurring in 2025–2026: Anthropic officially noted that products such as Claude Code / Codex have been trained with the model and the Harness together in the post-training stage, producing the side effect of "the model overfitting to a specific Harness structure" — changing the tool logic actually made the model perform worse (A level).
The practical implication of this phenomenon is: the best Harness for your task is not necessarily the one the model was post-trained with.
5.7. The boundary with MLOps / LLMOps
| Dimension | MLOps / LLMOps | Harness Engineering |
|---|---|---|
| Focus | Model lifecycle: training, fine-tuning, deployment, drift monitoring | Agent task lifecycle: the closed loop of a single task from intent to verification |
| Time scale | Days to months | Seconds to hours |
| Core artifacts | Model versions, feature stores, deployment pipelines | Context strategies, tool sets, eval sets, guardrail rules |
| Reuse means | Feature reuse, model reuse | Reuse of software-engineering means (shift-left feedback, mutation testing, structural testing) |
The "shift feedback left," mutation testing, structural testing, and similar terms mentioned in martinfowler.com's two articles represent software-engineering means being reused in the Harness, which is the direct dividing line from MLOps methodology (A level).
5.8. An easy-to-remember analogy: the four-layer computer stack
A set of analogies circulating in the industry (retold from a C-level source; the analogy itself may be cited, but the specific figures and cases within it are marked [to be verified]):
| Computer concept | AI system counterpart |
|---|---|
| CPU | Model |
| RAM | Context Window |
| Operating system | AI Harness |
| Application | Agent |
The value of this analogy is: just as an operating system does not produce compute power but determines how that compute power is used, a Harness does not produce intelligence but determines how intelligence is delivered safely and predictably.
6. The Value Proposition of AI Harness
6.1. Turning uncertainty into predictability
A model's output is probabilistic by nature. A Harness does not change this nature, but through context constraints, tool boundaries, evaluation criteria, and regression sets it narrows the probability distribution to an engineering-acceptable range.
Anthropic's sandbox evidence provides a quantitative anchor point: permission prompts were reduced by 84% while safety actually improved (A level). This shows that gains in predictability do not come at the cost of capability.
6.2. Making governance and autonomy a positive-sum game
Conventional wisdom holds that permission controls reduce an agent's autonomy. But three lines of evidence point to the opposite conclusion:
| Evidence | Data | Source grade |
|---|---|---|
| Anthropic sandbox | Permission prompts reduced by 84% | A |
| OpenAI architecture constraints | "Constraints make speed possible, and the architecture does not drift" | A |
| Codex Auto-review | Human-approval stops are roughly 1/200 of manual mode; review approval rate is about 99% | B, [to be verified] |
Conclusion: constraint is capability.
6.3. Making capability regression-verifiable
The third value of a Harness is turning "model capability" into an engineering object that can be regression-verified.
SWE-bench (released 2023-10-10; 2,294 task instances across 12 open-source Python repositories; ICLR 2024 Oral; A level) established the principle of programmatic scoring — there is no partial credit for "looks good but fails the tests." Terminal-Bench's principle is likewise "either the automated tests pass or they do not."
Anthropic also offers a concrete recommendation: equip the agent with browser-automation tools (such as Playwright MCP) so it can verify its own artifacts like a human would, which significantly improved performance (A level).
7. Summary
An AI Harness is not a newly invented technical component, but rather a naming and synthesis of existing engineering practice. Its emergence had three necessary conditions, all satisfied simultaneously between late 2025 and early 2026:
- The model is strong enough: strong enough that failures no longer stem mainly from insufficient model intelligence, but from poorly designed environments;
- Tools have a standard: MCP turned the tool ecosystem from an N×M integration problem into N+M;
- Governance has a template: sandbox, permission, and audit practices were proven at scale and quantified by leading vendors.
Its core thesis can be compressed into a single sentence: given model capability, the variance in system performance is determined mainly by the Harness.
The four documents that follow will unfold this in turn: how it evolved step by step from prompt engineering (02–Development History), the layered details of contemporary mainstream implementations (03–Architecture Evolution), the next directions in technology and standardization (04–Future Development), and the judgment that all these facts jointly point to (05–Summary).
8. Information-Gap Statement
This document involves the following information gaps, which are marked at their respective points in the text and summarized here:
- ISO/IEC-level international standards for agent interconnection: this research could not find the number of an ISO/IEC international standard for agent interconnection that has been published or formally initiated, so no authoritative information is available.
- Origin of the term "Agent Harness" and the source of its first appearance: no definitive first-hand origin document was found, so no authoritative information is available. What can be confirmed is that Anthropic was already using "harness" to describe the Claude Agent SDK in 2025, Mitchell Hashimoto named "Harness Engineering" on 2026-02-05, and OpenAI brought it into the mainstream on 2026-02-11. Earlier tracing (such as the LangChain blog post The Anatomy of an Agent Harness) could not retrieve the original text or an exact publication date.
- Original text of the Wikipedia "Test harness" entry: not directly captured, only retold through secondary sources; the specific wording in Section 3.1 is marked
[to be verified]. - Current data on the official Terminal-Bench leaderboard: the official site (tbench.ai) was not directly crawled; all leaderboard figures in Section 1.3 are third-party retellings and are marked
[to be verified]. - All comparison data in Section 1.3: including Factory Droid 77.3%, OpenAI Simple Codex 75.1%, KRAFTON 74.7%, Bigai 71.9%, LangChain 52.8% → 66.5%, and Vercel 80% → 100%, all from B/C-level sources and marked
[to be verified]. - The 1/200 and 99% figures for Codex Auto-review: from B-level sources, marked
[to be verified]. - Original source of the four-layer computer-stack analogy: the analogy itself has been retold by many parties and may be cited, but its original source and the accompanying specific figures and cases are marked
[to be verified].
9. References
- Effective context engineering for AI agents — Anthropic, 2025. https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Effective harnesses for long-running agents — Anthropic, 2025. https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
- Harness design for long-running application development — Anthropic, 2026. https://www.anthropic.com/engineering/harness-design-long-running-apps
- Harness engineering: leveraging Codex in an agent-first world — OpenAI, 2026-02-11. https://openai.com/index/harness-engineering/
- Harness engineering for coding agent users — Birgitta Böckeler, martinfowler.com, 2026. https://martinfowler.com/articles/harness-engineering.html
- Humans and Agents in Software Engineering Loops — martinfowler.com, 2026. https://martinfowler.com/articles/exploring-gen-ai/humans-and-agents.html
- My AI Adoption Journey — Mitchell Hashimoto, 2026-02-05. https://mitchellh.com/writing/my-ai-adoption-journey
- 2025 Stack Overflow Developer Survey — Stack Overflow, 2025-07-29. https://survey.stackoverflow.co/2025/
- Equipping agents for the real world with Agent Skills — Anthropic, 2025-10-16. https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues? — Jimenez, Yang, et al. (Princeton), 2023-10 (ICLR 2024 Oral). https://www.swebench.com/; arXiv:2310.06770
- Terminal-Bench — Stanford / Laude Institute, 2025. https://www.tbench.ai/
- Interpretations of the national standard series "Artificial Intelligence — Agent Interconnection" — China Information Economics Network, 2026. https://cinic.org.cn/xw/zcdt/1643418.html
- Agent Harness: The Core Paradigm of AI Engineering in 2026 — Tencent Cloud Developer Community, 2026. https://developer.cloud.tencent.com/article/2698416
- Terminal-Bench: The CLI Autonomy Standard — AgentMarketCap, 2026-04-09. https://agentmarketcap.ai/blog/2026/04/09/terminal-bench-cli-autonomy-standard-coding-agents