agent-regression-evals
它能做什么
这项技能让智能体用统计方法而不是单次运行,来测试 AI 智能体在修改后变好还是变差。适合向 AI 智能体发布变更、并需要在发布前得到明确结论的团队。
适用场景
- ✓当你即将发布对智能体所用提示词、模型或工具的修改的时候。
- ✓当智能体的通过率下降、你需要确认下降是否真实的时候。
- ✓当某些测试案例时而通过、时而失败、需要找出原因的时候。
技能链接
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/agent-regression-evals/skills/agent-regression-evals/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们更换了客服智能体背后的模型。请运行几次测试,并告诉我新版本是否真的变差了。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在旧版本和新版本上对每个测试案例运行多次,并检查智能体通过工具执行的步骤。它会找出不稳定的案例,然后由统计关卡逐案比较两个版本并给出结论。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Agent Regression Evals — prove the change did not make it worse
Portability: 3 stdlib scripts, no APIs, no LLM calls. You run the agent; these grade, count and gate.
"Pass rate went from 82% to 79%" is not a finding until you know whether three points is outside the noise. Agents are non-deterministic, so one trial per case cannot tell a regression from a coin flip, and a final answer can be right while the path to it called a tool it never should have.
Workflow
# 0 - Run every case k times (k >= 3) on baseline and candidate, from a clean
# environment per trial. Write one JSONL row per trial:
# {"case_id": "refund-lookup", "trial": 1, "passed": true, "critical": true,
# "cost_usd": 0.012, "trajectory": [{"tool": "get_order", "args": {...}}]}
# 1 - Grade the path where the path matters (safety, required lookups).
python scripts/trajectory_checker.py --spec cases.json --results candidate.jsonl
# 2 - Separate flaky cases from stable ones before trusting any comparison.
python scripts/flake_detector.py --results candidate.jsonl --k 3 --quarantine-out q.json
# 3 - Gate: paired per-case comparison against baseline. Exit 4 blocks the merge.
python scripts/regression_gate.py --baseline baseline.jsonl --candidate candidate.jsonl --quarantine q.json
Step 1 uses match modes strict | unordered | subset | superset. Default to
superset (required steps present, harmless exploration allowed); grade the
outcome, not the path, unless order is the requirement. forbidden tools block
in every mode.
Step 2 reports pass@k (succeeds at least once in k) and pass^k (succeeds all k times). A user meets every trial, so pass^k is the reliability number. Cases marked critical are never quarantine candidates.
Step 3 averages trials within each case first (trials of one case are correlated), then tests paired per-case differences with a t-based 95% CI and a one-sided exact McNemar test. When the drop is real but the sample is too small to show it, the gate says how many cases it would take.
The gate blocks on
- A statistically significant drop (CI upper bound below zero, or McNemar p < 0.05).
- A critical case that passed every baseline trial and failed any candidate trial.
- A baseline case missing from the candidate run. Dropping a case is the cheapest fake fix.
- A quarantine entry with no owner or expiry, or covering a critical case.
- A forbidden tool call (trajectory checker, exit 4).
It warns, and a human decides, on an underpowered drop above --tolerance or a
cost rise above --max-cost-increase.
Hard rules
- Never compare single trials. Under 3 trials per case the flake detector refuses (exit 4).
- Never pool trials as independent samples. Average per case, then compare cases.
- Never quarantine without owner and expiry. An expired entry re-enters the gate automatically.
- Never delete a failing case to go green. The gate counts what is missing.
- Never call "no significant drop" a pass on 8 cases. Report the power note with the verdict.
- Start the suite from real failures (20-50 cases), balanced between "should do" and "should not do".
Scripts
| Script | Role | Exit codes |
|---|---|---|
scripts/trajectory_checker.py |
Grades tool-call paths: match modes, args modes, forbidden tools, call ceilings | 0 · 2 deviations · 3 bad input · 4 forbidden tool |
scripts/flake_detector.py |
STABLE_PASS / STABLE_FAIL / FLAKY per case, Wilson CI, pass@k, pass^k, quarantine stubs | 0 · 2 flaky · 3 · 4 too few trials |
scripts/regression_gate.py |
Paired CI, exact McNemar, critical cases, dropped cases, quarantine validity, cost | 0 PASS · 2 WARN · 3 · 4 BLOCK |
All support --sample and --output json.
References and assets
references/eval_statistics.md— pass@k vs pass^k, per-case averaging, paired CI, McNemar, power (7 sources)references/trajectory_grading.md— outcome vs path, match modes, grader types (6 sources)references/flaky_cases_and_quarantine.md— flake causes, quarantine with expiry, clean trials (6 sources)assets/eval_case_spec.example.json— trajectory spec for step 1assets/sample_baseline.jsonl,assets/sample_candidate.jsonl— results format- [
assets/ci_eval_gate.example.yml
常见问题
为什么每个案例要运行多次?
智能体在不同运行中的答案可能不同,因此单次试验无法证明真正的退步。
它会检查智能体如何得出答案吗?
会。它会检查工具调用路径,例如是否进行了必要的查询。
失败的检查能阻止合并吗?
能。关卡会返回失败代码,从而阻止合并。
详情
作者的原始描述
Use before shipping any agent, prompt, model or tool change, or when a pass-rate drop needs a verdict. Runs repeated trials, gates candidate vs baseline with paired statistics in regression_gate.py, checks tool-call trajectories and finds flaky cases.
热度
- GitHub 星标
- 29k
- 排名
- #9526
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-launcher-orchestrator
29k帮你的智能体从一个清晰的目标出发,逐步规划、构建、测试并定时运行你自己账户中的 Claude 托管智能体。
grade-iterate
29k让你的智能体按评分标准为托管 AI 智能体的工作打分,并在固定的轮次内改进,因此它永远不会无限循环。
interview
29k让你的智能体就一个 AI 智能体的想法对你进行访谈,并在任何上线之前,把你的回答整理成一份简单的构建计划。
run-without-you
29k帮你的智能体设置托管 AI 智能体,使其按计划或在某个事件发生时运行,并在启动前检查定时设置。