跳到主内容
@wquguru
精选86GitHub 新爆发仓库(GitHub)产品发布/更新多源精选 ×3

Google DeepMind开源Harness2递归智能体优化框架

google-research/harness2

原文
发到 X
推荐理由

Agent工程化落地的硬核工具,递归优化思路值得参考,建议开发者关注其Prompt与工具链的自动化调优能力。

GitHub repository created 2026-10-06 · 2362 stars in 11.5 days (about 206 a day) · Python

GitHub 仓库创建于 2026-10-06 · 在 11.5 天内获得 2362 颗星(平均每天约 206 颗)· Python

Recursive Agent Harnessing for an Open World

面向开放世界的递归智能体赋能

A harness is the system around a model that enables it to act as an agent: prompts, tools, memory, skills, orchestration, and more. Harnessing is the process of optimizing that system.

Harness(赋能框架)是指围绕模型构建的、使其能够作为智能体运行的系统: 包括提示词、工具、记忆、技能、编排等。Harnessing(赋能过程)是 优化该系统的过程。

Harness² is a plug-and-play framework for recursive agent harnessing in an open world, where agents encounter tasks unseen during harness design. It connects two levels of recursion while keeping model weights fixed:

Harness² 是一个即插即用的框架,用于在开放世界中进行递归智能体赋能, 其中智能体会遇到在赋能设计阶段未曾见过的任务。它在保持模型权重固定的同时, 连接了两个层面的递归:

* Task-level recursion refines the execution harness for the current task through a contrastive Propose–Probe–Compose step: propose edits, probe their effects on the same task, and compose a refined harness from behavioral contrasts between executions, without ground-truth feedback. * Harnessing-level recursion updates a persistent *improvement harness* with adopted harnesses and evidence-supported lessons from each task to guide future refinement.

* 任务级递归通过对比式的“提议–探测–组合”步骤优化当前任务的执行 harness:提出编辑修改,探测其对同一任务的影响,并根据执行结果之间的行为差异组合出一个精炼的 harness,无需真实标签反馈。 * 赋能级递归利用已采纳的 harness 以及来自每个任务且有证据支持的教训,更新一个持久的 *改进 harness*,以指导未来的优化。

Across three professional benchmarks and four model–harness configurations, a single Harness² step improves GLM-5 and Gemini 3.5 Flash over their base harnesses, with gains of up to 11.5 points on WorkBuddy-Bench, 4.5 points on JobBench, and 11.8 percentage points on LAB's partial pass rate. Increasing the task-level recursion budget brings further gains.

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

The release supports parallel and sequential recursion, **OpenCode and Codex executors**, and JobBench, LAB, and WorkBuddy-Bench.

本次发布支持并行和顺序递归、**OpenCode 和 Codex 执行器**,以及 JobBench、LAB 和 WorkBuddy-Bench。

Video overview

视频概览

https://github.com/user-attachments/assets/76b10548-b14b-4c8f-9aa5-a93662df4d56

Contents

目录

  • Video overview - Harness components - Install - Run a benchmark - Experiments - Web access - Results and resume - Citation - Contributing - License - Disclaimer
  • 视频概览 - Harness 组件 - 安装 - 运行基准测试 - 实验 - Web 访问 - 结果与恢复 - 引用 - 贡献指南 - 许可证 - 免责声明

Harness components

Harness 组件

Harness² exposes eight editable components around the model: **system prompt, guardrails, memory, tool guidance, subagents, skills, scripts, and plugins**. They control context construction, the tool interface, delegation, and behavior inside the tool loop.

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

Install

安装

Use Linux, Python 3.12, and uv. From the repository root:

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

The local demo runs both recursion modes with deterministic editors and real Python executions. It requires no model credentials.

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

For model-backed benchmarks, install Node.js 20+, the Google Cloud CLI, and the benchmark dependencies. LAB needs Pandoc and Poppler; WorkBuddy-Bench needs Docker. Then configure your models:

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

See the setup guide for model settings, authentication alternatives, and the Codex executor.

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

Run a benchmark

运行基准测试

The following example installs LAB and runs one task, then evaluates and reports its result. Model-backed runs incur API costs; start with a small task selection.

以下示例安装 LAB 并运行一个任务,然后评估并报告其结果。基于模型的运行会产生 API 费用;建议从少量任务选择开始。

Sequential recursion runs the same commands with `--mode sequential`. `--k` is the task-level recursion budget; see Experiments. Judging and reporting must use the same benchmark, executor, subset, `--k`, `--mode`, and seed as the refinement run. Add `--dry-run` to `harness2` to preview task selection without model calls.

使用 `--mode sequential` 以顺序递归方式运行相同命令。`--k` 是任务级递归预算;请参阅实验部分。评判和报告必须与精炼运行使用相同的基准、执行器、子集、`--k`、`--mode` 和种子。向 `harness2` 添加 `--dry-run` 可在不进行模型调用的情况下预览任务选择。

BenchmarkTasksInstallGuide
JobBenchProfessional work`harness2-setup jb`JobBench
LABLegal work`harness2-setup lab`LAB
WorkBuddy-BenchOffice, web, and code`harness2-setup wb`WorkBuddy
基准任务安装指南
JobBench专业工作`harness2-setup jb`JobBench
LAB法律工作`harness2-setup lab`LAB
WorkBuddy-Bench办公、网页和代码`harness2-setup wb`WorkBuddy

Choose one benchmark per command. WorkBuddy also takes `--subset office`, `--subset web`, or `--subset code` on every command after setup. The benchmark guides cover each one's data, domains, and grading.

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

Experiments

实验

Scale task-level recursion in two ways: parallel recursion explores multiple candidate harnesses and composes refinements from their execution evidence; sequential recursion carries the refined harness and accumulated evidence through successive Propose–Probe–Compose steps.

通过两种方式扩展任务级递归:并行递归探索多个候选 harness,并从其执行证据中组合精炼结果;顺序递归则在连续的 Propose–Probe–Compose 步骤中传递精炼后的 harness 和累积的证据。

Parallel recursion explores wider; sequential recursion refines deeper.

并行递归探索更广泛;顺序递归精炼更深入。

OptionBehavior
`--k 1`One Propose–Probe–Compose step
`--k K --mode parallel`Probe `K` general and `K` domain-specific candidates, then produce `K` compositions
`--k K --mode sequential`Refine the harness through `K` successive steps
`--substrate cx`Use Codex instead of the default OpenCode executor
选项行为
`--k 1`一次 Propose–Probe–Compose 步骤
`--k K --mode parallel`探测 `K` 个通用候选项和 `K` 个领域特定候选项,然后生成 `K` 个组合
`--k K --mode sequential`通过 `K` 个连续步骤精炼 harness
`--substrate cx`使用 Codex 代替默认的 OpenCode 执行器

After each task, harnessing-level recursion retains the adopted harness and evidence-supported lessons to guide future refinement. See the experiment guide for task selection, concurrency, reproducibility, and baseline comparisons.

在每个任务之后,harnessing 级递归保留已采用的 harness 和有证据支持的教训,以指导未来的精炼。请参阅实验指南了解任务选择、并发、可重复性和基线比较。

Web access

网络访问

Executor network access is unrestricted, and Codex runs with its sandbox disabled. Public benchmark rubrics may be accessible online. Before evaluation, configure network restrictions to prevent access to benchmark answers and grading criteria.

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

Results and resume

结果与恢复

Results are saved under `runs/`, organized by benchmark and subset where applicable. They include task summaries, deliverables, adopted harnesses, reflection notes, and evaluation results.

结果保存在 `runs/` 下,按基准和相关子集进行组织。它们包括任务摘要、交付物、已采用的 harness、反思笔记和评估结果。

Repeat the same command to resume. Use a new `HARNESS2_RUNS_DIR` when changing models or task selection. See results and resume for details; each command also supports `--help`.

重复相同命令即可恢复。更改模型或任务选择时,请使用新的 `HARNESS2_RUNS_DIR`。详见结果与恢复部分;每个命令也支持 `--help`。

Citation

引用

Contributing

贡献

See CONTRIBUTING.md.

请参阅 CONTRIBUTING.md。

License

许可证

Harness² is licensed under Apache 2.0. Third-party code under `third_party/`, benchmarks, and datasets retain their upstream licenses; see third-party notices.

Harness² 采用 Apache 2.0 许可证授权。`third_party/`、基准测试和数据集中的第三方代码保留其上游许可证;请参阅第三方通知。

Disclaimer

免责声明

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

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

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →