跳到主内容
@wquguru
精选86Hacker News Best(web_list)技巧与观点

AI Agent Harness 解析:系统提示、工具与循环机制

什么是 Harness:AI 评测框架解析

原文
发到 X
推荐理由

Agent 开发者的必读基础课,清晰拆解了 Harness 的四大核心组件与运行机制,帮你建立可复用的工程认知框架。

What is a Harness?

什么是 Harness?

Date:Thu, 20 Aug 2026

日期:2026年8月20日,星期四

From:Earendil Product <[email protected]>

发件人:Earendil Product <[email protected]>

To:You

收件人:您

Subject:What is a Harness?

主题:什么是 Harness?

Harness – definition by the Cambridge Dictionary

Harness —— 剑桥词典定义

Noun. a piece of equipment with straps and belts, used to control or hold in place a person, animal, or object

名词。带有带子和皮带的设备,用于控制或将人、动物或物体固定在某处

Verb. to control something, usually in order to use its power

动词。控制某物,通常是为了利用其力量

–

When I think of a harness, I think first of the set of straps and belts that I put on in middle school before scrambling up the walls of my school. I was a mediocre climber at best.

当我想到 Harness 时,我首先想到的是我在中学时攀爬学校墙壁前穿戴的那套带子和皮带。充其量,我是个平庸的攀岩者。

Royal Robbins on El Capitan, his harness racked with the tools of the ascent. Photo by Tom Frost.

皇家罗宾斯(Royal Robbins)在酋长岩(El Capitan)上,他的 Harness 上挂满了攀登工具。照片由 Tom Frost 拍摄。

If you’re main-lining into the AI newsfeed these days however, your archetypal harness may already be an agent harness. And, this post was not written for you.

然而,如果你最近主要沉浸在 AI 新闻feed中,你心目中的典型 Harness 可能已经是 Agent Harness(智能体框架)。而且,这篇文章不是为你写的。

This was written for those who may be curious to know what an agent harness is, but don’t, and have been too embarrassed to ask.

这篇文章是写给那些可能对了解什么是 Agent Harness 感到好奇,但又不清楚,并且因不好意思提问而一直未问的人。

Let’s get back to climbing.

让我们回到攀岩上来。

Why do you strap on a harness when you go climbing? Well, firstly, the harness supports you and keeps you safe. It does that by connecting you to carabiners and ropes that secure you from falls, moderate your pace, and govern your route. You can also attach other tools to your harness like a chalk bag, nut tools and quickdraws.

为什么你去攀岩时要系上 Harness?嗯,首先,Harness 支撑着你并确保你的安全。它通过将你连接到快挂和绳索上来实现这一点,这些装备能防止你坠落、调节你的节奏并掌控你的路线。你还可以将其他工具挂在 Harness 上,比如粉袋、塞子工具和快挂。

And when you go climb different mountains or make different ascents you can take your harness with you. Depending on the terrain, you can even modify your harness and what goes on your gear loops. Climbing harnesses are adaptable. They are used by acrobats and arborists. The people who own them can make them their own.

当你去攀登不同的山峰或进行不同的攀登活动时,你可以带上你的 Harness。根据地形不同,你甚至可以修改你的 Harness 以及挂在 gear loops(装备环)上的物品。攀岩 Harness 具有适应性。杂技演员和树木修剪师也使用它。拥有它的人可以根据自己的需求对其进行定制。

There are similarities between climbing harnesses and agent harnesses both in terms of structure and function.

攀岩 Harness 和 Agent Harness 在结构和功能方面都有相似之处。

Agent Harnesses

Agent Harness(智能体框架)

Others have written (simplistically) that Agent = Model + Harness. Here the word Harness refers to an Agent Harness. But what is an agent harness? Agent harnesses use AI models to create AI agents, and their first application was for coding. Now, agent harnesses sit at the core of all types of AI agents and understanding how an agent harness works will help you understand what an AI agent is.

其他人曾(简单地)写道:Agent = Model + Harness。这里的 Harness 指的是 Agent Harness。但什么是 Agent Harness 呢?Agent Harness 使用 AI 模型来创建 AI 智能体,其最初的应用场景是编程。现在,Agent Harness 位于所有类型 AI 智能体的核心位置,理解 Agent Harness 的工作原理将有助于你理解什么是 AI 智能体。

An agent harness is a piece of software that provides an environment for an AI model to operate within. Unlike most AI models, you as an end user can own your own agent harness.

Agent Harness 是一种为 AI 模型提供运行环境的软件。与大多数 AI 模型不同,作为终端用户,你可以拥有自己的 Agent Harness。

Often, users like software engineers interact directly with harnesses like Pi using the Terminal application on their computer. But, harnesses like OpenClaw also use different user interfaces like iMessage, a chat app, or email. Our harness Lefos was built primarily to interact via email. Regardless of the interface, harnesses generally do four things: Firstly, they provide a set of instructions that help govern how the AI model responds. This set of instructions is typically called a “system prompt”. Secondly, they describe and provide a set of tools that are made available to the AI model to use in service of responding to requests from the user. Thirdly, the harness establishes a framework that governs how the model behaves. This framework does a lot of different things, but one of the main things it does is establish the “agentic loop”. Finally, most harnesses provide a crucial translation layer that enables the harness to work with a variety of different AI models.

通常,像软件工程师这样的用户会直接使用电脑上的终端应用程序与 Pi 等工具集进行交互。但是,像 OpenClaw 这样的工具集也使用不同的用户界面,例如 iMessage(一款聊天应用)或电子邮件。我们的工具集 Lefos 主要是为了通过电子邮件进行交互而构建的。无论使用何种界面,工具集通常都会做四件事:首先,它们提供一组指令,帮助规范 AI 模型如何响应。这组指令通常被称为“系统提示词”(system prompt)。其次,它们描述并提供一组可供 AI 模型使用的工具,以响应用户的请求。第三,工具集建立了一个规范模型行为的框架。这个框架做了很多不同的事情,但其中主要的一项就是建立“智能体循环”(agentic loop)。最后,大多数工具集提供了一个关键的翻译层,使工具集能够与各种不同的人工智能模型协同工作。

I. System Prompt

一、系统提示词

Most AI models come with an embedded set of rules and guidelines that has been refined and arrived at during the training process. Most famously, Claude Opus 4.5 had a widely publicized “soul document” that explained to the AI model what it was and how it should act. The System Prompt in an AI harness is similar to this but is less embedded into the model. It’s more like a set of instructions a new employee might get on their first day of a job. It hasn’t internalized the instructions but it knows it should follow them when performing that work. System prompts are injected into the conversation together with every prompt and play an important role in ensuring that the AI model acts appropriately in the context of that harness.

大多数 AI 模型都内置了一套规则和指南,这些规则和指南是在训练过程中经过不断打磨和完善而成的。最著名的例子是 Claude Opus 4.5,它有一份广泛宣传的“灵魂文档”,向 AI 模型解释了它是什么以及应该如何行事。AI 工具集中的系统提示词与此类似,但不那么深入地嵌入到模型中。它更像是一份新员工入职第一天可能会收到的操作指南。它尚未将这些指令内化,但它知道在执行工作时应该遵循这些指令。系统提示词会与每个提示词一起注入对话中,并在确保 AI 模型在该工具集的上下文中行为适当方面发挥着重要作用。

II. Tools

二、工具

Tools are a set of capabilities, written in code, that the model can “call”. The harness describes the tools and also provides the software that is the tool itself. Examples of these tools might include a web search tool, a tool that allows the model to write and execute software code, or a tool that allows the model to compose an email. Critically, the harness usually does not dictate when and how the AI model should use the tool. Instead, it simply makes the tools available, describes them clearly, and allows the AI model itself to decide when and how it should use them.

工具是一组用代码编写的能力,模型可以“调用”它们。工具集描述了这些工具,并提供了作为工具本身的软件。这些工具的示例可能包括网络搜索工具、允许模型编写和执行软件代码的工具,或者允许模型撰写电子邮件的工具。关键在于,工具集通常不会规定 AI 模型何时以及如何使用这些工具。相反,它只是提供这些工具,清晰地描述它们,并允许 AI 模型本身决定何时以及如何使用它们。

III. Agentic Loops

三、智能体循环

Now we have an AI model sitting within an agent harness with a set of instructions and a set of tools. Let us assume our harness was built to work within email, had the tools we described above (WebSearch, WriteCode, ComposeEmail), and that the user has asked the agent to compare rankings and test scores of local primary schools and provide recommendations. How will the agent behave? Firstly, it will try to understand the request (or, "prompt"). It will use its pre-training and weights to understand what a "primary school" is, what "the local area" means, and what rankings the user likely cares about. It will then construct web search queries to fetch recent data. What does it do with those results? Sitting within a harness, the AI model can review them in the context of the initial request. It may determine that the first search did not fetch the right information, or enough of it, and on its own, decide to search again. This decision to call the tool again based on its own assessment is the first clear example of the "loop". Now let's assume it collected all the relevant data. The AI model decides to make a spreadsheet using the "write code" tool. All spreadsheets are just code, after all. It can use that tool to do math and format the results so they are intelligible. It then compares the spreadsheet to the original prompt. If the data doesn't satisfy it, it may “loop” and go back and search again. When it decides it has enough, it calls ComposeEmail, a tool that allows the AI to review its findings, summarize them, write an email, and include attachments like the spreadsheet. The model reviews this final work and decides the job is done. The "agentic loop" closes. Within seconds, the user gets an email with a summary and recommendations in the body, and a spreadsheet presenting the findings attached. To see what an agentic loop looks like in practice, you can explore a Pi session here.

现在,我们有一个 AI 模型位于智能体框架(agent harness)之中,该框架包含一组指令和一组工具。假设我们的框架是为在电子邮件环境中工作而构建的,具备上述提到的工具(WebSearch、WriteCode、ComposeEmail),并且用户要求智能体比较当地小学的排名和测试成绩并提供建议。智能体会如何表现?首先,它会尝试理解请求(或“提示”)。它将利用其预训练数据和权重来理解什么是“小学”,“当地地区”意味着什么,以及用户可能关心的排名指标。然后,它会构造网络搜索查询以获取最新数据。它如何处理这些结果?由于处于框架之内,AI 模型可以在初始请求的上下文中审查这些结果。它可能会确定第一次搜索未获取到正确的信息或信息不足,并自主决定再次进行搜索。这种基于自身评估决定再次调用工具的行为,是“循环”的第一个清晰示例。现在假设它收集了所有相关数据。AI 模型决定使用“编写代码”工具制作电子表格。毕竟,所有电子表格本质上都是代码。它可以利用该工具进行数学计算并对结果进行格式化,使其易于理解。随后,它将电子表格与原始提示进行比较。如果数据未能满足要求,它可能会“循环”回去再次搜索。当它认为数据足够时,它会调用 ComposeEmail 工具,该工具允许 AI 审查其发现、总结内容、撰写电子邮件,并附上如电子表格之类的附件。模型会审查这份最终作品并判定任务完成。“智能体循环”随之闭合。几秒钟内,用户就会收到一封电子邮件,正文中包含总结和推荐,并附带展示研究结果的电子表格。若要了解智能体循环在实际中的样子,你可以在此处探索一个 Pi 会话。

IV. Translation Layer

四、翻译层

The translation layer is what allows a harness to work with different AI models. In some cases, a harness may decide to use different models within the same agentic loop, because different AI models may excel at different tasks. The translation layer is also a crucial aspect of harnesses because they deliver control to the end user. It means that someone can take their AI harness and use it with a model from Anthropic, or OpenAI, or explore one of the open weight AI models that often deliver great value-for-money (measured by cost-per-task).

翻译层使得框架能够与不同的 AI 模型协同工作。在某些情况下,框架可能会决定在同一智能体循环中使用不同的模型,因为不同的 AI 模型可能在不同的任务上表现出色。翻译层也是框架的一个关键方面,因为它们将控制权交付给最终用户。这意味着用户可以将其 AI 框架与来自 Anthropic 或 OpenAI 的模型配合使用,或者探索那些通常能提供高性价比(以每项任务的成本衡量)的开源权重 AI 模型。

更进一步:量化金融体系

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

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件