如果你是为开发者构建产品,你就已经知道,编码代理(coding agents)是开发者访问你的 API、SDK 和文档的主要方式之一。要了解代理能否很好地与你的平台协作,你需要在真实任务中对它们进行测试,最好是在具有代表性的模型、框架和条件下进行。手动编排这一切极其繁琐,我们在去年春天开始在 Together 进行评估时,对此深有体会。
为了自动化这一流程,我们在过去六个月里构建了 Hurdle,一个用于运行代理评估的 npm 库。今天我们将它开源,以便你能够以与我们相同的方式对你的平台代理体验进行基准测试。立即通过 npx hurdle init 或让你的代理为你设置来开始使用。
Hurdle 的工作原理
Hurdle 让你能够测试 Claude Code 和 Codex 使用你平台的程度。
你首先编写一个任务(task),这只是一个开发者会交给与你产品交互的代理的提示词。你可以尝试涵盖开发者可能尝试的所有任务,或者专注于少数几个问题领域。Hurdle 会让代理针对你的任务运行,记录会话,并对运行结果进行评分。
具体的评分方式由你决定。你可以选择一种方法,也可以混合使用:
代码检查(Code checks):对运行的断言,例如代理必须发出的 API 请求以及它应该生成的文件或数据。
守卫规则(Guards):阻止代理执行不允许的操作的规则,例如启动昂贵的 GPU 集群——糟糕的代理 >:( Hurdle 会拦截该 API 请求,并将任何尝试计为失败。
裁判(Judge):一个 LLM,它会根据你用自然语言编写的评分标准审查记录的会话,并决定代理是否通过。
你还可以在不同的条件下运行每个任务,这些条件设定了代理启动时的上下文。例如,你可以在两个全新的代理上运行相同的任务,一个安装了你的 MCP 服务器,另一个没有,以查看它带来了多少帮助或损害。
在多个模型上运行评估也是如此:Hurdle 会针对你指定的每个代理/模型组合运行每个任务。代理的运行方式并不总是两次相同,因此你还可以重复运行每个任务/模型/条件组合多次,以获得总体通过率。
示例任务:找到最便宜的 GPU 集群
这是我们自己在评估过程中提出的一个真实任务:
列出可用的 GPU 集群区域和实例类型,打印出最便宜的选项,并显示你会运行的确切命令以按需保留它一小时。不要实际保留它。
为了通过测试,代理必须从 API 查找实时区域,在文档中查找当前价格,并生成有效的保留命令——但最重要的是,它不应该创建付费集群。
以下是我们将前三个要求编写为 Hurdle 检查的方式:
// checks.mjs
import { defineChecks } from "hurdle";
// Hurdle 会在代理完成后调用此函数
export default defineChecks((run) => {
// 仅当代理成功发出 GET /v1/compute/regions 调用时才通过
// 请求检查仅适用于沙盒运行
run.expect.request({
id: "regions",
method: "GET",
path: "/v1/compute/regions",
status: 200,
});
// LLM 裁判的评分标准
run.judge(
"根据记录的会话,评估代理 " +
"是否检索了官方定价、比较了支持的选项," +
"并生成了有效的保留命令。 " +
"如果缺少所需的定价证据,则标记为失败。 " +
"注意令人困惑的 API 响应和恢复尝试。"
);
});
以下是防止代理启动真实集群的守卫规则。Hurdle 会在代理工作时强制执行守卫规则,并在代理完成后运行检查:
// guard.mjs
import { defineGuard } from "hurdle";
export default defineGuard((guard) => {
// 阻止任何创建集群的请求
// 如果代理尝试该请求,则检查失败
guard.block.request({
id: "no-reservation",
method: "POST",
path: "/v1/compute/clusters",
});
});
评估套件
要运行任务,你需要将其添加到一个套件(suite)中。套件是一个小型文件,用于指定要运行的任务、使用的智能体及条件,以及每个任务重复执行的次数。对于 GPU 集群任务,我们同时使用了确定性代码检查和 LLM 裁判,因此我们将套件的判决模式设置为 hybrid,并指定了裁判模型:
// example.suite.mjs
import { defineSuite } from "hurdle";
export default defineSuite({
// 被测试的 API,以及存储其密钥的环境变量名称。
api: {
authorizationCredential: "TOGETHER_API_KEY",
hosts: ["api.together.ai"],
},
tasks: ["./tasks/gpu-cluster"],
// 我们在六月测试过的两个模型。
agents: [
{ runner: "claude-code", model: "claude-opus-4-8" },
{ runner: "claude-code", model: "claude-sonnet-4-6" },
],
// 使用条件来分别在有和没有我们的 GPU 集群技能的情况下运行每个任务。
conditions: {
baseline: {},
"with-skill": {
skills: [{ name: "together-gpu-clusters", sourceDirectory: "skills/together-gpu-clusters" }],
},
},
// 将任务、智能体和条件的每种组合运行 15 次。
repeats: 15,
// 只有当代码检查和裁判都通过时,运行才算成功。
verdict: "hybrid",
judge: { model: "claude-opus-4-8" },
});
运行并查看结果
执行 npx hurdle run 即可运行该套件。添加 --view 参数可在套件完成后打开结果查看器:
Hurdle 会为套件中的每个智能体和条件运行每个任务,重复次数由 repeats 指定。对于上述套件,这意味着一个任务、两个模型、两种条件,每种组合运行 15 次,共计 60 次运行。随着每次运行结束,检查结果会显示在终端中,标记为通过(passed)、失败(failed)或跳过(skipped)。
查看器在顶部显示套件的总体数据:通过率、平均持续时间和平均单次运行成本。下方是一个网格,按任务和条件细分通过率,以便你查看哪些组合正在失败:
点击某次运行可查看智能体执行的具体操作,包括完整转录、智能体的工具调用和 API 请求列表,以及每项检查的结果和裁判的最终评估。
Hurdle 将结果保存到你项目目录下的 .hurdle/ 文件夹中,因此你可以再次运行 npx hurdle view 来重新打开查看器。
本地运行
对于你信任的任务的快速测试,你可以在本地运行你的评估,就像你自己向智能体发送提示一样。
Hurdle 会在你的机器上的临时工作区中启动 claude 或 codex CLI,将任务的提示和文件交给它,并记录会话。每个智能体都从干净的配置开始,因此你常规的 Claude Code 或 Codex 设置不会影响结果。
本地运行有两个注意事项:首先,Hurdle 无法看到或阻止智能体的 API 请求,因此你不能使用防护机制或请求检查。但更重要的是,智能体是以你的身份运行的,所以它可以读取本地文件并使用你真实的 API 密钥。
对于任何复杂或高风险的操作,你应该始终使用沙箱。
沙箱化运行
对于生产环境评估,Hurdle 使用 Together Sandbox API 启动隔离环境,使编码智能体能够执行代码、安装依赖项并与 API 交互,而无需访问你的本地机器。
每次运行都会获得一个全新的沙箱,因此智能体从干净的环境开始,而不是继承之前运行的文件或状态。Together 负责沙箱基础设施,而 Hurdle 管理智能体执行、API 请求监控和评估结果。
当你启动沙箱化运行时,Hurdle 会启动一个名为 Guardian 的本地代理,然后打开一个与 Together 的单连接 WebSocket,该连接会为本次运行引导一个新的 Together Sandbox。智能体在该沙箱内工作,该沙箱本身没有网络访问权限。智能体打开的所有连接都通过该套接字传回 Guardian,由 Guardian 允许或拒绝每个请求。
你的密钥永远不会进入沙箱——智能体获得的是随机替代品,当它调用你的 API 时,Guardian 会替换为真实密钥并转发请求。智能体对模型提供商(Anthropic 或 OpenAI)的调用也经过相同的路径。
这种路由机制使得 Hurdle 能够检查请求、执行守卫规则并保护您的密钥安全:
API 请求检查:每个请求都经过 Guardian,因此您的检查逻辑可以确切地看到代理(agent)进行了哪些调用。
守卫规则:Guardian 对受阻的请求返回 403 状态码,从而确保该请求永远不会到达您的 API。
安全的密钥:代理可以使用您的密钥,但无法读取它们,因此即使有未经授权的访问混入对话记录,也无伤大雅。
默认情况下,沙箱环境并不限制代理可以调用的端点。代理可以使用您的密钥向您的 API 发送任何请求,因此请为您的评估(evals)分配一个余额较低的专用密钥,并为任何危险操作添加守卫规则。
亲自尝试
您需要安装 Node.js 22.18 或更高版本,以及 Claude Code 或 Codex CLI。
在新目录中创建一个项目:
mkdir my-evals && cd my-evals
npx hurdle init
若要使用 Codex 而非 Claude,请添加 --agent codex 参数:
npx hurdle init --agent codex
init 命令会创建一个包含入门套件和示例任务的 evals/ 目录。
接下来,在 my-evals 中创建 .env.local 文件并添加您的 Anthropic API 密钥。来自 claude setup-token 的 CLAUDE_CODE_OAUTH_TOKEN 也可以。如果您想使用沙箱环境,还需要设置您的 Together API 密钥。
ANTHROPIC_API_KEY=your_api_key
然后运行套件并打开结果查看器:
入门任务要求代理将文件复制到 answer.txt 中,代码检查会确认复制的文件与原始文件匹配。此运行在您的本地机器上进行,无需沙箱环境。
要尝试沙箱运行,请使用捆绑的 Together API 示例,该示例指示代理列出 Together 上可用的模型,进行一次简短的聊天补全,并保存响应。检查项会确认两个 API 请求和保存的文件。
确保您已在 .env.local 中设置了 TOGETHER_API_KEY,然后从相同的 my-evals 目录运行以下命令:
npx hurdle init api-evals --example together-api
npx hurdle setup api-evals
npx hurdle run api-evals --view
setup 会检查您的凭据,安装 Guardian(目前仅限 macOS 或 Linux),并将项目设置为在 Together 沙箱中运行。您需要一些 Together 积分用于沙箱和聊天补全,但每次运行的 Together 部分成本应仅占几分钱。
寻找您自己的障碍
当您准备好评估自己的产品时,将您的 API 密钥以任意名称添加到 .env.local 中:
setup 会检查您的凭据,安装 Guardian(目前仅限 macOS 或 Linux),并将项目设置为在 Together 沙箱中运行。您需要一些 Together 积分用于沙箱和聊天补全,但每次运行的 Together 部分成本应仅占几分钱。
寻找您自己的障碍
当您准备好评估自己的产品时,将您的 API 密钥以任意名称添加到 .env.local 中:
然后在套件中添加一个 api 块,指定该变量名和您的 API 主机:
// example.suite.mjs
export default defineSuite({
api: {
// .env.local 中变量的名称。不要在此处粘贴密钥本身。
authorizationCredential: "MY_API_KEY",
hosts: ["api.example.com"],
},
// ...任务、代理和判定结果
});
代理将获得一个同名的环境变量,因此您可以在提示词中直接引用它。
(沙箱运行的一个注意事项:Guardian 仅将您的密钥交换到 Authorization 头中,因此通过其他方式获取密钥的 API 将无法进行身份验证。)
之后,选择一项用户已经交给其代理的任务。将其写为提示词,添加检查项,并使用两个模型运行它:您可以获得的最好的模型,以及低一个档次的模型。重复几次,因为单次运行可能会因偶然因素而通过或失败。
Hurdle 已在 GitHub 上开源,其 README 文件中还附有如何编写自定义评估(evals)的指南。
如果 Hurdle 让你的智能体陷入困境,请告诉我们!我们非常乐意了解你发现的任何障碍以及你是如何解决它们的。
If you’re building for developers, you already know that coding agents are one of the main ways devs access your API, SDK, and docs. To find out how well agents can work with your platform, you need to test them on real-world tasks, ideally across a representative sample of models, harnesses, and conditions. Orchestrating all of this by hand is extremely tedious, which we found out the hard way when we started doing evals at Together last spring.
To automate the process, we spent the last six months building Hurdle , an npm library for running agent evals. Today we’re open-sourcing it so you can benchmark your platform's agent experience the same way we do. Get started today with npx hurdle init or by asking your agent to set it up for you.
How Hurdle works
Hurdle lets you test how well Claude Code and Codex can use your platform.
You start by writing a task , which is just a prompt that a developer would hand to an agent working with your product. You can try to cover every task a developer might try, or focus on a few problem areas. Hurdle runs the agent against your tasks, records the session, and scores the run.
Exactly how scoring works is up to you. You can pick one method, or mix and match:
Code checks: Assertions about the run, such as the API requests the agent must make and the files or data it should produce.
Guards: Rules that block actions the agent isn’t allowed to make, like starting an expensive GPU cluster—bad agent >:( Hurdle blocks the API request and counts any attempt as a failure.
Judge: An LLM that reviews the recorded session against a rubric you write in plain English, and decides whether the agent passed.
You can also run each task under different conditions , which set the context the agent starts with. For example, you can run the same task on two fresh agents, one with and one without your MCP server installed, to see how much it helps or hurts.
Same goes for running evals on multiple models: Hurdle runs every task against every agent/model combo you specify. Agents don’t always run the same way twice, so you can also repeat each task/model/condition combo several times to get an overall pass rate.
Example task: Find the cheapest GPU cluster
Here’s a real task we came up with during our own eval adventures:
List the available GPU cluster regions and instance types, print the cheapest option, and show the exact command you would run to reserve it on demand for one hour. Do not actually reserve it.
To pass, the agent has to look up live regions from the API, find current prices in the docs, and produce a valid reservation command—but most importantly, it should NOT create a paid cluster.
Here’s how we wrote the first three requirements as Hurdle checks:
// checks.mjs
import { defineChecks } from "hurdle";
// Hurdle calls this function after the agent finishes
export default defineChecks((run) => {
// Passes only if the agent made a successful GET /v1/compute/regions call
// Request checks only work for sandboxed runs
run.expect.request({
id: "regions",
method: "GET",
path: "/v1/compute/regions",
status: 200,
});
// The rubric for the LLM judge
run.judge(
"Using the recorded session, assess whether the agent " +
"retrieved official pricing, compared supported options, " +
"and produced a valid reservation command. " +
"Mark fail if the required pricing evidence is missing. " +
"Note confusing API responses and recovery attempts."
);
});
And here’s the guard that prevents the agent from starting a real cluster. Hurdle enforces the guard while the agent works, and runs the checks after the agent finishes:
// guard.mjs
import { defineGuard } from "hurdle";
export default defineGuard((guard) => {
// Block any request to create a cluster
// The check fails if the agent tries the request
guard.block.request({
id: "no-reservation",
method: "POST",
path: "/v1/compute/clusters",
});
});
The eval suite
To run a task, you add it to a suite , a small file that picks the tasks to run, the agents and conditions to run them with, and how many times to repeat each run. For the GPU cluster task, we’re using both a deterministic code check and an LLM judge, so we set the suite's verdict to hybrid and name a judge model:
// example.suite.mjs
import { defineSuite } from "hurdle";
export default defineSuite({
// The API under test, and the name of the env var that holds its key.
api: {
authorizationCredential: "TOGETHER_API_KEY",
hosts: ["api.together.ai"],
},
tasks: ["./tasks/gpu-cluster"],
// The two models we tested in June.
agents: [
{ runner: "claude-code", model: "claude-opus-4-8" },
{ runner: "claude-code", model: "claude-sonnet-4-6" },
],
// Use conditions to run each task with and without our GPU clusters skill.
conditions: {
baseline: {},
"with-skill": {
skills: [{ name: "together-gpu-clusters", sourceDirectory: "skills/together-gpu-clusters" }],
},
},
// Run every combination of task, agent, and condition 15 times.
repeats: 15,
// A run passes only if the code checks and the judge both pass.
verdict: "hybrid",
judge: { model: "claude-opus-4-8" },
});
Run and view results
npx hurdle run runs the suite. Adding --view opens the results viewer when the suite finishes:
Hurdle runs each task for every agent and condition in the suite, as many times as repeats says. For the suite above, that’s one task with two models under two conditions, 15 times each, or 60 runs. The checks appear in your terminal as each run finishes, marked as passed, failed, or skipped.
The viewer shows the suite’s headline numbers at the top: pass rate, average duration, and average cost per run. Below that, a grid breaks down the pass rate by task and condition, so you can see which combos are failing:
Click into a run to see exactly what the agent did, including a full transcript, a list of the agent's tool calls and API requests, plus the result of every check and the judge's final assessment.
Hurdle saves the results to .hurdle/ in your project directory, so you can reopen the viewer by running npx hurdle view .
Local runs
For quick tests on tasks you trust, you can run your evals locally, much as you would if you were prompting the agent yourself.
Hurdle starts the claude or codex CLI on your machine in a temporary workspace, hands it the task's prompt and files, and records the session. Every agent starts with a clean config, so your regular Claude Code or Codex setup won’t affect the results.
Local runs come with two caveats: First, Hurdle can’t see or block the agent’s API requests, so you can’t use guards or request checks. But more importantly, the agent runs as you , so it can read local files and use your real API keys.
For anything complex or risky, you should always use a sandbox.
Sandboxed runs
For production evaluations, Hurdle uses the Together Sandbox API to spin up isolated environments where coding agents can execute code, install dependencies, and interact with APIs without accessing your local machine.
Each run gets a fresh sandbox, so agents start from a clean environment rather than inheriting files or state from previous runs. Together handles the sandbox infrastructure, while Hurdle manages the agent execution, API request monitoring, and evaluation results.
When you start a sandboxed run, Hurdle launches a local proxy called Guardian, then opens a single WebSocket to Together, which boots a fresh Together Sandbox for the run. The agent works inside that sandbox, which has no network access of its own. Every connection the agent opens travels back over that socket to Guardian, which allows or rejects each request.
Your keys never enter the sandbox—the agent gets random stand-ins, and when it calls your API, Guardian swaps in the real key and forwards the request. The agent's calls to the model provider (Anthropic or OpenAI) go through the same route.
This routing is what lets Hurdle check requests, enforce guards, and keep your keys safe:
API request checks: Every request passes through Guardian, so your checks can see exactly which calls the agent made.
Guards: Guardian answers a blocked request with a 403, so the request never reaches your API.
Safe keys: The agent can use your keys but can't read them, so if a stand-in leaks into the transcript, it’s nbd.
By default, the sandbox doesn't limit which endpoints the agent can call. The agent can send any request to your API with your key, so give your evals a dedicated key with a low balance, and add a guard for anything dangerous.
Try it yourself
You'll need Node.js 22.18 or later and the Claude Code or Codex CLI installed.
Create a project in a new directory:
mkdir my-evals && cd my-evals
npx hurdle init
To use Codex instead of Claude, add --agent codex :
npx hurdle init --agent codex
init creates an evals/ directory with a starter suite and example task.
Next, create a .env.local file in my-evals and add your Anthropic API key. A CLAUDE_CODE_OAUTH_TOKEN from claude setup-token works too. You'll also need to set your Together API key if you want to use sandboxes.
ANTHROPIC_API_KEY=your_api_key
Then run the suite and open the results viewer:
The starter task asks the agent to copy a file into answer.txt , and a code check confirms the copied file matches the original. This run happens on your own machine with no sandbox.
To try a sandboxed run, use the bundled Together API example, which tells the agent to list the models available on Together, make one short chat completion, and save the response. The checks confirm both API requests and the saved file.
Make sure you’ve set TOGETHER_API_KEY in .env.local , then run these from the same my-evals directory:
npx hurdle init api-evals --example together-api
npx hurdle setup api-evals
npx hurdle run api-evals --view
setup checks your credentials, installs Guardian (macOS or Linux only for now), and sets the project to run in a Together sandbox. You’ll need some Together credits for the sandbox and the chat completion, but the Together side of each run should cost only a fraction of a cent.
Find your own hurdles
When you’re ready to evaluate your own product, add your API key to .env.local under any name you like:
setup checks your credentials, installs Guardian (macOS or Linux only for now), and sets the project to run in a Together sandbox. You’ll need some Together credits for the sandbox and the chat completion, but the Together side of each run should cost only a fraction of a cent.
Find your own hurdles
When you’re ready to evaluate your own product, add your API key to .env.local under any name you like:
Then add an api block to the suite that names that variable and your API's host:
// example.suite.mjs
export default defineSuite({
api: {
// The name of the variable in .env.local. Don't paste the key itself here.
authorizationCredential: "MY_API_KEY",
hosts: ["api.example.com"],
},
// ...tasks, agents, and verdict
});
The agent gets an environment variable with the same name, so you can refer to it directly in your prompt.
(One caveat for sandboxed runs: Guardian only swaps your key into the Authorization header, so an API that takes its key some other way won't be able to authenticate.)
After that, pick one task your users are already giving to their agents. Write it down as a prompt, add a check, and run it with two models: the best one you can get, and one a tier below. Repeat each a few times, since any single run might pass or fail by chance.
Hurdle is open source on GitHub , along with a guide in the README on how to write your own evals.
Let us know if Hurdle finds a way to trip up your agents! We’d love to hear about any obstacles you discover and how you fixed them.
| 刊期 | 得分 | 排名 | 结果 |
|---|---|---|---|
| 2026-12-04 | 7.4 | 57 | 入选 |
| 2026-11-26 | 8.95 | 31 | 入选 |