Skip to content

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

feat(prompt-eval): composio, skills, MCP error-path and web-search cases; --runs N

M3gA-Mindec89ae2607eb
diff --git a/docs/prompt-evals.md b/docs/prompt-evals.md
index 64f4d11266..89a969e48a 100644
--- a/docs/prompt-evals.md
+++ b/docs/prompt-evals.md
@@ -68,6 +68,11 @@ The costs are:
scripts/prompt-eval.sh --real-workspace --case workflow-builder-news
```
+`--runs N` repeats every case N times, each in a fresh process (and a fresh
+workspace when hermetic). One run is a sample, not a baseline. Every run is its
+own row, keyed by case, timestamp, run index and model ids. Rows are never
+averaged, so the variance stays visible.
+
Either way, each case runs in its own `openhuman-core call` subprocesses: one
to install the credential (hermetic only), one to run the agent
(`openhuman.flows_build` or `openhuman.agent_chat`), and one for the judge. A
@@ -105,10 +110,35 @@ installs a collector at all. The run journal under
`<ws>/tinyagents_store/journal` is the natural enrichment if transcript
scoring proves too coarse.
+### The cases
+
+| Case | Surface | Checks | Writes |
+|---|---|---|---|
+| `workflow-builder-news` | workflow | reaches `propose_workflow`; ≤2 consecutive catalog searches; saves nothing | nothing |
+| `orchestrator-reminder` | orchestration → scheduler | hands off through `schedule_task` | **a cron job**, remove it afterwards |
+| `orchestrator-direct-answer` | orchestration | answers a trivial question without spawning | nothing |
+| `composio-gmail-read` | composio | reads the latest Gmail subject via `delegate_to_integrations_agent`; never sends, deletes or reconnects | nothing |
+| `skill-notion-read` | skills | lists Notion pages through `run_skill`; never installs a skill | nothing |
+| `mcp-none-configured` | MCP, **error path** | with no MCP server configured, says so; never installs one, never fabricates results | nothing |
+| `web-search-fact` | web search | one built-in `web_search_tool` lookup, not a `research` spawn | nothing |
+
+Prefer read-only cases. Against a real account every write is cleanup that
+someone does by hand, so a case that must write lists what it leaves behind
+in its `writes` field. Cases that depend on account state carry a
+`_precondition`, for example that Gmail is connected, the Notion skill is
+installed, or no MCP server exists. Re-verify those before a run: the account
+changes, and a case whose precondition no longer holds measures something
+else. `mcp-none-configured` is an error-path case by design. Do not install an
+MCP server to make MCP "testable"; that changes the baseline being measured.
+
+A call made through `use_skill` also counts as the packed tool it reaches, so
+a forbidden packed tool is caught either way.
+
### Adding a case
Add an object to `cases` in `scripts/prompt-eval/cases.json`: `id`, `entry`
(`flows_build` or `agent_chat`), `message`, `expect_calls`, `forbid_calls`,
-`max_consecutive` (`{tool: cap}`), `max_input_tokens`, `judge`, and a `_why`
-naming the failure it guards against. Keep the set small; every case costs
+`max_consecutive` (`{tool: cap}`), `max_input_tokens`, `judge`, optional
+`reply_regex`, `surface`, `writes`, `_precondition`, and a `_why` naming the
+failure it guards against. Keep the set small; every case costs
money on every run.
diff --git a/scripts/prompt-eval.sh b/scripts/prompt-eval.sh
index 2f02cf5e82..587d83476b 100755
--- a/scripts/prompt-eval.sh
+++ b/scripts/prompt-eval.sh
@@ -4,7 +4,10 @@
# Tier 1 (`tests/agent_prompt_comprehension_e2e.rs`) pins the script; only this
# answers whether a model follows it. See docs/prompt-evals.md.
#
-# Usage: scripts/prompt-eval.sh [--case <id>] [--bin <openhuman-core>] [--real-workspace]
+# Usage: scripts/prompt-eval.sh [--case <id>] [--runs N] [--bin <openhuman-core>] [--real-workspace]
+#
+# --runs N repeats every case N times (default 1). One run is a sample, not a
+# baseline: every run is its own row (case + ts + run + models), never averaged.
#
# Default (hermetic): each case gets a fresh `mktemp -d` workspace and needs a
# credential in OPENHUMAN_BACKEND_SESSION_TOKEN or OPENHUMAN_BACKEND_API_KEY
@@ -30,12 +33,14 @@ BIN="$ROOT/target/debug/openhuman-core"
OUT="$ROOT/target/prompt-eval-runs.jsonl"
ONLY=""
REAL=0
+RUNS=1
while [ $# -gt 0 ]; do
case "$1" in
--case) ONLY="$2"; shift 2 ;;
--bin) BIN="$2"; shift 2 ;;
--real-workspace) REAL=1; shift ;;
+ --runs) RUNS="$2"; shift 2 ;;
-h|--help) sed -n '2,20p' "$0"; exit 0 ;;
*) echo "unknown arg: $1" >&2; exit 2 ;;
esac
@@ -60,8 +65,11 @@ mkdir -p "$(dirname "$OUT")"
ids=$(python3 -c 'import json,sys; print("\n".join(c["id"] for c in json.load(open(sys.argv[1]))["cases"]))' "$CASES")
[ -n "$ONLY" ] && { echo "$ids" | grep -qx "$ONLY" || { echo "no case $ONLY" >&2; exit 2; }; ids="$ONLY"; }
+case "$RUNS" in ""|*[!0-9]*|0) echo "--runs needs a positive integer" >&2; exit 2 ;; esac
+
total_usd=0
for id in $ids; do
+for run in $(seq 1 "$RUNS"); do
# $ws always holds this case's own artifacts (result, logs, judge verdict).
ws="$(mktemp -d -t prompt-eval)"
export RUST_LOG="${RUST_LOG:-info}"
@@ -97,7 +105,7 @@ for id in $ids; do
*) echo "case $id: unknown entry $kind" >&2; exit 2 ;;
esac
- echo "── $id ($method) workspace=$ws" >&2
+ echo "── $id run $run/$RUNS ($method) workspace=$ws" >&2
started=$(date +%s)
core "$method" "$params" > "$ws/result.json" || echo "case $id: $method exited non-zero (scored anyway)" >&2
elapsed=$(( $(date +%s) - started ))
@@ -109,9 +117,13 @@ for id in $ids; do
core openhuman.agent_chat_simple "$jp" > "$ws/judge.json" || true
fi
- row=$(python3 "$ROOT/scripts/prompt-eval/score.py" score "$CASES" "$id" "$ws" "$elapsed")
+ row=$(python3 "$ROOT/scripts/prompt-eval/score.py" score "$CASES" "$id" "$ws" "$elapsed" "$run")
echo "$row" >> "$OUT"
- echo "$row" | python3 -c 'import json,sys; r=json.load(sys.stdin); print("%s: %s score=%s usd=%.4f models=%s failures=%s" % (r["case"], "PASS" if r["pass"] else "FAIL", r["score"], r["usd"], r["models"], r["failures"]))'
+ echo "$row" | python3 -c 'import json,sys; r=json.load(sys.stdin); print("%s run %s: %s score=%s usd=%.4f models=%s failures=%s" % (r["case"], r["run"], "PASS" if r["pass"] else "FAIL", r["score"], r["usd"], r["models"], r["failures"]))'
total_usd=$(python3 -c 'import json,sys; print(float(sys.argv[1]) + json.loads(sys.argv[2])["usd"])' "$total_usd" "$row")
done
+done
echo "total USD: $total_usd (rows appended to $OUT)"
+if [ "$REAL" = 1 ]; then
+ echo "real workspace: clean up the test threads, plus each case's \"writes\" in $CASES" >&2
+fi
diff --git a/scripts/prompt-eval/cases.json b/scripts/prompt-eval/cases.json
index 5ef702e5e3..829a2377f2 100644
--- a/scripts/prompt-eval/cases.json
+++ b/scripts/prompt-eval/cases.json
@@ -15,22 +15,41 @@
"_why": "The 2026-09-17 incident: 512,775 input tokens and 27 catalog searches in one turn, no propose_workflow.",
"entry": "flows_build",
"message": "Every morning at 8am, send me a digest of the latest sports news.",
- "expect_calls": ["propose_workflow"],
- "forbid_calls": [],
- "max_consecutive": { "search_tool_catalog": 2 },
+ "expect_calls": [
+ "propose_workflow"
+ ],
+ "forbid_calls": [
+ "save_workflow",
+ "create_workflow",
+ "run_flow"
+ ],
+ "max_consecutive": {
+ "search_tool_catalog": 2
+ },
"max_input_tokens": 150000,
- "judge": true
+ "judge": true,
+ "writes": [],
+ "surface": "workflow",
+ "_writes_note": "flows_build proposes only; nothing is saved unless the model calls save_workflow/create_workflow (forbidden below)."
},
{
"id": "orchestrator-reminder",
"_why": "A scheduling request must reach scheduler_agent through schedule_task, not be answered in prose.",
"entry": "agent_chat",
"message": "Remind me to stretch every weekday at 3pm.",
- "expect_calls": ["schedule_task"],
- "forbid_calls": ["shell"],
+ "expect_calls": [
+ "schedule_task"
+ ],
+ "forbid_calls": [
+ "shell"
+ ],
"max_consecutive": {},
"max_input_tokens": 100000,
- "judge": true
+ "judge": true,
+ "writes": [
+ "a recurring cron job ('stretch', weekdays 15:00) — remove it with cron_remove / the Routines UI after the run"
+ ],
+ "surface": "orchestration/scheduler"
},
{
"id": "orchestrator-direct-answer",
@@ -38,10 +57,96 @@
"entry": "agent_chat",
"message": "What is 17 times 23?",
"expect_calls": [],
- "forbid_calls": ["research", "spawn_async_subagent", "schedule_task"],
+ "forbid_calls": [
+ "research",
+ "spawn_async_subagent",
+ "schedule_task"
+ ],
"max_consecutive": {},
"max_input_tokens": 60000,
- "judge": false
+ "judge": false,
+ "writes": [],
+ "surface": "orchestration"
+ },
+ {
+ "id": "composio-gmail-read",
+ "surface": "composio",
+ "_why": "Integration hand-off to a connected toolkit, read-only. Exercises delegate_to_integrations_agent and the text-mode integrations_agent (see #6334).",
+ "entry": "agent_chat",
+ "message": "What is the subject line of the most recent email in my Gmail inbox? Just read it, don't change anything.",
+ "expect_calls": [
+ "delegate_to_integrations_agent"
+ ],
+ "forbid_calls": [
+ "composio_connect",
+ "GMAIL_SEND_EMAIL",
+ "GMAIL_DELETE_MESSAGE",
+ "GMAIL_MOVE_TO_TRASH"
+ ],
+ "max_consecutive": {
+ "composio_list_tools": 2
+ },
+ "max_input_tokens": 200000,
+ "judge": true,
+ "writes": [],
+ "_precondition": "gmail must be connected — re-verify with list_flow_connections before running; config.toml named github/gmail/notion on 2026-09-18."
+ },
+ {
+ "id": "skill-notion-read",
+ "surface": "skills",
+ "_why": "Run an installed skill through its hand-off, read-only. The account's only installed skill on 2026-09-18 was `notion` (it was `github` two days earlier — re-check).",
+ "entry": "agent_chat",
+ "message": "Using my installed Notion skill, list the titles of my five most recently edited Notion pages. Do not create or edit anything.",
+ "expect_calls": [
+ "run_skill"
+ ],
+ "forbid_calls": [
+ "setup_skills",
+ "skill_registry_install"
+ ],
+ "max_consecutive": {},
+ "max_input_tokens": 200000,
+ "judge": true,
+ "writes": [],
+ "_precondition": "the notion skill must be installed — re-verify before running."
+ },
+ {
+ "id": "mcp-none-configured",
+ "surface": "mcp (error path)",
+ "_why": "ERROR-PATH case, not an MCP capability case: the account has zero MCP servers, so the only honest outcome is to say none is configured without fabricating one or installing one. Do not install a server to make MCP testable — that changes the baseline.",
+ "entry": "agent_chat",
+ "message": "Use my MCP server to look up today's open tickets.",
+ "expect_calls": [],
+ "forbid_calls": [
+ "setup_mcp_server",
+ "mcp_registry_install"
+ ],
+ "reply_regex": "(?i)(no|not|isn't|aren't|don't|haven't)[^.]{0,80}(mcp|server)",
+ "max_consecutive": {},
+ "max_input_tokens": 100000,
+ "judge": true,
+ "writes": [],
+ "_precondition": "mcp_servers must still be empty; if a server exists this case no longer measures the error path."
+ },
+ {
+ "id": "web-search-fact",
+ "surface": "web search",
+ "_why": "Direct-first: a single current fact is one built-in web_search_tool call, not a research spawn.",
+ "entry": "agent_chat",
+ "message": "What is the latest stable release of the Rust programming language? Cite where you found it.",
+ "expect_calls": [
+ "web_search_tool"
+ ],
+ "forbid_calls": [
+ "research",
+ "spawn_async_subagent"
+ ],
+ "max_consecutive": {
+ "web_search_tool": 3
+ },
+ "max_input_tokens": 100000,
+ "judge": true,
+ "writes": []
}
]
}
diff --git a/scripts/prompt-eval/score.py b/scripts/prompt-eval/score.py
index fc2ed02c6b..fb819c91e7 100755
--- a/scripts/prompt-eval/score.py
+++ b/scripts/prompt-eval/score.py
@@ -71,7 +71,27 @@ def transcripts(ws):
def tool_calls(lines):
- return [tc.get("name", "") for m in lines if m.get("role") == "assistant" for tc in (m.get("tool_calls") or [])]
+ """Tool names called, in order. A `use_skill` call also counts as the packed
+ tool it reaches (`{"skill", "tool", "args"}`), so forbidding a packed tool
+ catches it either way."""
+ out = []
+ for m in lines:
+ if m.get("role") != "assistant":
+ continue
+ for tc in m.get("tool_calls") or []:
+ name = tc.get("name", "")
+ out.append(name)
+ if name == "use_skill":
+ args = tc.get("arguments")
+ if isinstance(args, str):
+ try:
+ args = json.loads(args)
+ except ValueError:
+ args = {}
+ inner = (args or {}).get("tool") if isinstance(args, dict) else None
+ if inner:
+ out.append(inner)
+ return out
def max_consecutive(calls, tool):
@@ -122,7 +142,7 @@ def judge_prompt(doc, case, ws):
)
-def score(doc, case, ws, secs):
+def score(doc, case, ws, secs, run=1):
ts = transcripts(ws)
result = rpc_value(os.path.join(ws, "result.json"))
failures = []
@@ -167,6 +187,11 @@ def score(doc, case, ws, secs):
if worst > cap:
failures.append(f"repeat:{tool}x{worst}>{cap}")
+ if case.get("reply_regex"):
+ checks += 1
+ if not re.search(case["reply_regex"], reply_text(result)):
+ failures.append("reply_regex")
+
# 3. Cost. ponytail: sums every transcript's _meta; if a parent's totals ever
# include its children's, this double-counts — switch to root-only then.
metas = [m for m, _ in ts if m]
@@ -190,6 +215,9 @@ def score(doc, case, ws, secs):
return {
"ts": time.strftime("%Y-%m-%dT%H:%M:%S%z"),
"case": case["id"],
+ "run": run,
+ "surface": case.get("surface", ""),
+ "writes": case.get("writes", []),
"git_sha": subprocess.run(["git", "rev-parse", "--short", "HEAD"], capture_output=True, text=True).stdout.strip(),
"models": models,
"pass": not failures,
@@ -211,6 +239,9 @@ def selftest():
assert verdict("ACCEPT? no. REJECT") == "REJECT"
assert verdict("UNACCEPTABLE") == "UNCLEAR"
assert max_consecutive(["a", "b", "b", "a", "b", "b", "b"], "b") == 3
+ assert tool_calls([{"role": "assistant", "tool_calls": [
+ {"name": "use_skill", "arguments": json.dumps({"skill": "s", "tool": "skill_registry_install"})}]}]) == [
+ "use_skill", "skill_registry_install"]
assert HALT_LOG.search("[tinyagents::mw] crate successful-repeat tracker halted the run")
print("score.py selftest ok")
@@ -224,4 +255,5 @@ if __name__ == "__main__":
print(judge_prompt(doc, case, sys.argv[4]))
elif cmd == "score":
doc, case = load_case(sys.argv[2], sys.argv[3])
- print(json.dumps(score(doc, case, sys.argv[4], int(sys.argv[5]))))
+ run = int(sys.argv[6]) if len(sys.argv) > 6 else 1
+ print(json.dumps(score(doc, case, sys.argv[4], int(sys.argv[5]), run)))