Standard library only · runs in your browser
'It worked when I tried it' isn't an evaluation. Build the harness that runs your agent over a suite of cases and reports the numbers teams actually track: task success, tool-call accuracy, steps, and why each failure failed.
Implement evaluate_agent(cases). Each case has name, task, script, expected_answer_contains, expected_tools (a list), and an optional max_steps (default 8).
For each case, call the provided run_agent(case["task"], case["script"], max_steps=...) (your stage-6 agent). Then classify it, checking in this order:
answer is None: failure reason "no_answer:" + stop_reasontools_called != expected_tools: "wrong_tools"expected_answer_contains isn't in the answer (case-insensitive): "wrong_answer"Return:
{"pass_rate": passed / n, rounded to 3 places
"tool_accuracy": exact-tool-match cases / n, rounded to 3 places
"avg_steps": mean steps, rounded to 2 places
"failures": {case name: reason}}Raise ValueError for an empty list of cases.
evaluate_agent(cases: list[dict]) -> dict