Harness²
面向开放世界的递归智能体驾驭

Paper Website Benchmark guides License

Install, set up, and run JobBench: uv pip install -e '.[render]', harness2-setup jb, then harness2 --bench jb --k 1 --mode parallel. Click for prerequisites and commands.

Aharness是围绕模型构建的系统,使其能够作为智能体行动:提示词、工具、记忆、技能、编排等。Harnessing是对该系统进行优化的过程。

Harness² 是一个即插即用的框架,用于递归智能体驾驭在开放世界中,智能体在驾驭设计期间会遇到未见过的任务。它在保持模型权重固定的同时连接两个层级的递归:

  • 任务级递归通过对比式的Propose–Probe–Compose步骤为当前任务精炼执行 harness:提出编辑、探测其对同一任务的效果,并基于多次执行之间的行为对比组合出精炼后的 harness,无需真实反馈。
  • 驾驭级递归用已采用的 harness 和来自每个任务的有证据支持的教训来更新一个持久的改进 harness以指导未来的精炼。

Harness² pipeline. Task-level recursion: an agent executor runs the initial harness, a harness editor proposes invariant and domain edits, candidate probes execute them, and a harness composer combines them into the final harness. Harnessing-level recursion: an experience reflector reflects on the step and updates the improvement harness used for the next task.

在三个专业基准测试和四种模型–harness 配置上,单次 Harness² 步骤即可让 GLM-5 和 Gemini 3.5 Flash 超越其基础 harness,在 WorkBuddy-Bench 上提升最高 11.5 分,在 JobBench 上提升 4.5 分,在 LAB 的部分通过率上提升 11.8 个百分点。增加任务级递归预算可带来进一步提升。

该发布支持并行与串行递归,OpenCode 和 Codex 执行器,以及JobBench、LAB 和 WorkBuddy-Bench。

视频概览

harness2-video.mp4

目录

Harness 组件

Harness² 围绕模型暴露八个可编辑组件:系统提示词、护栏、记忆、工具指引、子智能体、技能、脚本和插件。它们控制上下文构建、工具接口、委派以及工具循环内部的行为。

Eight harness components grouped by runtime role: system prompt, guardrails, memory, and skills construct context; tool guidance and scripts define the tool interface; subagents orchestrate delegated work; plugins control middleware.

安装

使用Linux、Python 3.12 和uv。从仓库根目录:

uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e '.[render]'
harness2-demo --output runs/demo --k 2

本地演示使用确定性编辑器和真实 Python 执行来运行两种递归模式。它不需要模型凭据。

对于由模型驱动的基准测试,请安装Node.js 20+、Google Cloud CLI,以及基准测试依赖。LAB 需要 Pandoc 和 Poppler;WorkBuddy-Bench 需要 Docker。然后配置你的模型:

cp .env.example .env
#用你的 Vertex AI 项目和模型 ID 编辑 .env。
gcloud auth application-default login

参见设置指南了解模型设置、身份验证替代方案,以及Codex 执行器。

运行基准测试

以下示例安装 LAB 并运行一个任务,然后评估并报告其结果。由模型驱动的运行会产生 API 费用;请从较小的任务选择开始。

harness2-setup lab
harness2-check --bench lab
harness2 --bench lab --k 1 --mode parallel \
  --only-domains antitrust-competition --max-tasks 1
harness2-judge --bench lab --k 1 --mode parallel
harness2-report --bench lab --k 1 --mode parallel

顺序递归使用相同的命令运行,并配合--mode sequential。--k是任务级递归预算;参见实验。评判和报告必须使用与细化运行相同的基准测试、执行器、子集、--k、--mode和随机种子。添加--dry-run到harness2以在不调用模型的情况下预览任务选择。

基准测试 任务 安装 指南
JobBench 专业工作 harness2-setup jb JobBench
LAB 法律工作 harness2-setup lab LAB
WorkBuddy-Bench 办公、网页和代码 harness2-setup wb WorkBuddy

每条命令选择一个基准测试。WorkBuddy 在设置后的每条命令上还接受--subset office、--subset web或--subset code。基准测试指南涵盖各自的数据、领域和评分。

实验

通过两种方式扩展任务级递归:并行递归探索多个候选 harness,并根据它们的执行证据组合细化;顺序递归通过连续的 Propose–Probe–Compose 步骤携带细化后的 harness 和累积的证据。

Two ways to scale task-level recursion. Parallel: probe k general and k domain-specific candidate harnesses, then produce k compositions from the shared evidence. Sequential: carry the refined harness and accumulated evidence through k Propose–Probe–Compose steps.

并行递归探索更广;顺序递归细化更深。

选项 行为
--k 1 一个 Propose–Probe–Compose 步骤
--k K --mode parallel ProbeK通用和领域特定的候选,然后生成K组合K通过连续步骤细化 harness
--k K --mode sequential Refine the harness throughKsuccessive steps
--substrate cx 使用 Codex 代替默认的 OpenCode 执行器

每个任务之后,harness 级递归会保留采用的 harness 和有证据支持的教训,以指导未来的细化。参见实验指南了解任务选择、并发、可复现性和基线比较。

网络访问

执行器的网络访问不受限制,Codex 在其沙箱禁用的情况下运行。公开的基准测试评分标准可能可以在线访问。在评估之前,配置网络限制以防止访问基准测试答案和评分标准。

结果与恢复

结果保存在runs/下,按基准测试和子集(如适用)组织。它们包括任务摘要、交付物、采用的 harness、反思笔记和评估结果。

重复相同的命令以恢复。在更改模型或任务选择时使用新的HARNESS2_RUNS_DIR。参见结果与恢复详情请见;每条命令也支持--help。

引用

@article{xu2026harness2,
  title   = {Harness$^2$: Recursive Agent Harnessing for an Open World},
  author  = {Xu, Ruiyao and Chen, Yanfei and CuiZhu, Zhongying and Dalvi Mishra, Bhavana and Ming, Yifei and Yu, Han and Han, Rujun and Lee, Chen-Yu and Pfister, Tomas},
  journal = {arXiv preprint arXiv:2610.14224},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.14224}
}

贡献

参见CONTRIBUTING.md。

许可证

Harness² 采用以下许可证授权Apache 2.0。以下第三方代码third_party/、基准测试和数据集保留其上游许可证;参见第三方声明。

免责声明

这不是 Google 官方支持的产品。本项目不符合Google 开源软件漏洞奖励计划的资格。