Skip to content

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

chore(bench): update viewer benchmark harness

Steven Enamakelc5df188b5f7d
diff --git a/bench/harnesses/viewer/index.html b/bench/harnesses/viewer/index.html
index 511e2f0b33..ab4f2db4ae 100644
--- a/bench/harnesses/viewer/index.html
+++ b/bench/harnesses/viewer/index.html
@@ -45,7 +45,7 @@ const h = (tag, attrs = {}, ...kids) => {
};
const api = async (p) => { const r = await fetch(p); if (!r.ok) throw new Error(`${p}: ${r.status}`); return r.json(); };
const e = encodeURIComponent;
-// Rough token estimate for text sizes (chars / 3); the table's measured o200k counts stay as they are.
+// Rough token count for a text of `chars` characters (about 3 per token); the tables' measured o200k counts stay as they are.
const estTok = (chars) => (chars == null ? null : Math.round(chars / 3));
const pct = (a, b) => (a == null || !b ? "–" : `${((100 * a) / b).toFixed(1)}%`);
const fmt = (n, d = 0) => n == null ? "–" : Number(n).toLocaleString(undefined, { maximumFractionDigits: d });
@@ -91,7 +91,7 @@ async function run(id) {
const d = await api(`/api/runs/${e(id)}`);
const kids = [h("h1", {}, id), crumbs(link("#/", "runs"), id), h("h2", {}, "Harnesses (from the meter proxy, on the wire)")];
kids.push(table(
- ["harness", "tasks", "turns", "prompt tok", "completion tok", "cached %", "cost $", "system tok", "tool schema tok", "tools", "errors", "overridden", "system prompt (est.)"],
+ ["harness", "tasks", "turns", "prompt tok", "completion tok", "cached %", "cost $", "system tok", "tool schema tok", "tools", "errors", "overridden", "system prompt"],
d.harnesses.map((x) => [
x.harness, x.tasks, x.calls, fmt(x.prompt_tokens), fmt(x.completion_tokens), fmt(x.cache_pct, 1), fmt(x.cost_usd, 4),
fmt(x.system_prompt_tokens), fmt(x.tool_schema_tokens), fmt(x.tool_count),
@@ -122,13 +122,13 @@ async function task(id, harness, t) {
h("h2", {}, "Full task transcript (Markdown)"),
transcriptBox(`/api/runs/${e(id)}/transcript/${e(harness)}/${e(t)}/last`),
h("p", { class: "mut" }, "A turn is one request to the model and its response; a task is made of several. ‘prefix reused’ is how many of the previous call’s messages this call re-sent byte-for-byte; below the previous count, history was rewritten and provider prefix caching is lost from there."),
- table(["turn", "status", "messages", "prefix reused", "system", "tools", "cache ctl", "prompt tok", "cached tok", "cached %", "completion", "first token ms", "total ms", "cost $", "req KB"],
+ table(["turn", "status", "messages", "prefix reused", "system", "tools", "cache ctl", "prompt tok", "cached tok", "cached %", "completion", "first token ms", "total ms", "cost $"],
calls.map((c, i) => [
link(`#/call/${e(id)}/${e(harness)}/${e(t)}/${c.seq}`, i + 1), c.status ?? "–", c.messages,
c.prefix_reused_messages == null ? "–" : `${c.prefix_reused_messages}/${c.prev_messages}`,
flag(c.same_system_as_prev), flag(c.same_tools_as_prev), c.cache_control_markers,
fmt(c.usage?.prompt_tokens), fmt(c.usage?.cached_tokens), pct(c.usage?.cached_tokens, c.usage?.prompt_tokens), fmt(c.usage?.completion_tokens),
- fmt(c.first_token_ms ?? c.ttfb_ms), fmt(c.total_ms), fmt(c.cost_usd, 5), fmt(c.request_bytes / 1024, 1),
+ fmt(c.first_token_ms ?? c.ttfb_ms), fmt(c.total_ms), fmt(c.cost_usd, 5),
])));
}
@@ -211,7 +211,7 @@ async function call(id, harness, t, seq) {
["cache_control markers", c.cache_control_markers], ["prompt_cache_key", c.prompt_cache_key]].map(([k, v]) => h("span", { class: "tag" }, `${k}: ${v ?? "–"}`))),
h("h2", {}, "Raw transcript (Markdown)"),
transcriptBox(`/api/runs/${e(id)}/transcript/${e(harness)}/${e(t)}/${seq}`),
- h("h2", {}, `System prompt (~${fmt(estTok(c.system_chars))} tokens est. from ${fmt(c.system_chars)} chars ÷ 3)`), pre(c.system || "(no system prompt)"),
+ h("h2", {}, `System prompt (~${fmt(estTok(c.system_chars))} tokens)`), pre(c.system || "(no system prompt)"),
h("h2", {}, "Sampling & provider params"), pre(c.params),
h("h2", {}, "Request headers"), pre(c.headers),
h("h2", {}, `Tools (${c.tool_count})`),
diff --git a/bench/harnesses/viewer/transcript.mjs b/bench/harnesses/viewer/transcript.mjs
index b533d4b4e6..a878785d2c 100644
--- a/bench/harnesses/viewer/transcript.mjs
+++ b/bench/harnesses/viewer/transcript.mjs
@@ -85,13 +85,13 @@ export function toMarkdown(call) {
`# ${call.harness} · ${call.task} · turn ${call.seq}`,
"",
`- run: \`${call.run_id}\` format: \`${call.format}\` status: \`${call.status ?? "?"}\``,
- `- messages: ${call.messages.length}, tools: ${call.tool_count}, request: ${((call.request_bytes ?? 0) / 1024).toFixed(1)} KB`,
+ `- messages: ${call.messages.length}, tools: ${call.tool_count}, prompt: ${call.usage?.prompt_tokens?.toLocaleString("en-US") ?? "n/a"} tokens (${call.usage?.cached_tokens?.toLocaleString("en-US") ?? "n/a"} cached)`,
`- cache: system ${call.same_system_as_prev === null ? "n/a" : call.same_system_as_prev ? "same" : "CHANGED"}, tools ${call.same_tools_as_prev === null ? "n/a" : call.same_tools_as_prev ? "same" : "CHANGED"}, prefix reused ${call.prefix_reused_messages ?? "n/a"}/${call.prev_messages ?? "n/a"}`,
"",
"## Request parameters (as the harness sent them)",
fence(JSON.stringify(call.params ?? {}, null, 2), "json"),
"",
- `## System prompt (~${Math.round((call.system_chars ?? call.system?.length ?? 0) / 3).toLocaleString("en-US")} tokens est., chars ÷ 3)`,
+ `## System prompt (~${Math.round((call.system_chars ?? call.system?.length ?? 0) / 3).toLocaleString("en-US")} tokens)`,
call.system ? fence(call.system) : "_none_",
"",
`## Tools (${call.tool_count})`,