Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(bench): update micro benchmark harness

Steven Enamakel098226d9e8f8
diff --git a/bench/harnesses/micro/Dockerfile b/bench/harnesses/micro/Dockerfile
new file mode 100644
index 0000000000..9329b24b72
--- /dev/null
+++ b/bench/harnesses/micro/Dockerfile
@@ -0,0 +1,8 @@
+# Task image for the micro suite. Ubuntu 22.04 to match the official SWE-bench
+# instance images, so a single harness bundle (built on 22.04) runs in both.
+FROM ubuntu:22.04
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ git ca-certificates python3 curl make build-essential \
+ && rm -rf /var/lib/apt/lists/*
+WORKDIR /work
diff --git a/bench/harnesses/tasks/micro.mjs b/bench/harnesses/tasks/micro.mjs
new file mode 100644
index 0000000000..600b2ce05b
--- /dev/null
+++ b/bench/harnesses/tasks/micro.mjs
@@ -0,0 +1,85 @@
+// micro.mjs — generates the micro suite: five small fixed tasks that exercise
+// cold start, a read, an edit, a shell run and a multi-step change. Each task
+// is a directory {prompt.txt, setup.sh, check.sh} mounted at /bench/task.
+// Checks are deterministic shell tests, so "passed" never needs a judge.
+
+import fs from "node:fs";
+import path from "node:path";
+
+export const MICRO_TASKS = [
+ {
+ id: "m1-hello",
+ prompt: "Reply with the single word READY and do not touch any files.",
+ setup: "echo seed > seed.txt",
+ // nothing should change
+ check: 'test "$(cat seed.txt)" = seed && test -z "$(git status --porcelain | grep -v bench)"',
+ },
+ {
+ id: "m2-read",
+ prompt:
+ "Read config.json and write the value of the key \"port\" (just the number) into answer.txt.",
+ setup: 'echo \'{"name":"svc","port":4817,"debug":false}\' > config.json',
+ check: 'test "$(tr -d "[:space:]" < answer.txt)" = 4817',
+ },
+ {
+ id: "m3-edit",
+ prompt:
+ "In greet.py the function greet() prints the wrong word. Fix it so running `python3 greet.py` prints exactly: Hello, World",
+ setup: 'printf \'def greet():\\n print("Goodbye, World")\\n\\ngreet()\\n\' > greet.py',
+ check: 'test "$(python3 greet.py)" = "Hello, World"',
+ },
+ {
+ id: "m4-shell",
+ prompt:
+ "Count the lines of every .txt file in the data/ directory and write the total to total.txt (just the number).",
+ setup:
+ "mkdir data && seq 1 7 > data/a.txt && seq 1 5 > data/b.txt && seq 1 3 > data/c.txt && echo skip > data/d.log",
+ check: 'test "$(tr -d "[:space:]" < total.txt)" = 15',
+ },
+ {
+ id: "m5-multistep",
+ prompt:
+ "The tests in test_calc.py fail. Fix calc.py so `python3 -m unittest test_calc` passes. Do not edit test_calc.py.",
+ setup: `cat > calc.py <<'PY'
+def add(a, b):
+ return a - b
+
+def mul(a, b):
+ return a + b
+PY
+cat > test_calc.py <<'PY'
+import unittest
+from calc import add, mul
+
+class T(unittest.TestCase):
+ def test_add(self):
+ self.assertEqual(add(2, 3), 5)
+ def test_mul(self):
+ self.assertEqual(mul(4, 5), 20)
+
+if __name__ == "__main__":
+ unittest.main()
+PY`,
+ check:
+ "python3 -m unittest test_calc >/dev/null 2>&1 && git diff --quiet bench-baseline -- test_calc.py 2>/dev/null; python3 -m unittest test_calc >/dev/null 2>&1",
+ },
+];
+
+export function writeMicroSuite(outDir) {
+ const tasks = [];
+ for (const t of MICRO_TASKS) {
+ const dir = path.join(outDir, t.id);
+ fs.mkdirSync(dir, { recursive: true });
+ fs.writeFileSync(path.join(dir, "prompt.txt"), `${t.prompt}\n`);
+ fs.writeFileSync(path.join(dir, "setup.sh"), `set -e\n${t.setup}\n`);
+ fs.writeFileSync(path.join(dir, "check.sh"), `${t.check}\n`);
+ tasks.push({ id: t.id, image: "bench-micro:latest", workdir: "/work", dir });
+ }
+ fs.writeFileSync(path.join(outDir, "tasks.json"), JSON.stringify(tasks, null, 2));
+ return tasks;
+}
+
+if (import.meta.url === `file://${process.argv[1]}`) {
+ const out = process.argv[2] ?? "tasks/generated/micro";
+ console.log(`wrote ${writeMicroSuite(out).length} micro tasks to ${out}`);
+}