160 lines
5.6 KiB
YAML
160 lines
5.6 KiB
YAML
name: benchmark_runner
|
||
agent_type: dynamic_tool_chain
|
||
version: "1.0.0"
|
||
description: "能力回测 Agent:运行 AgentKit 各维度能力测试,生成综合评估报告(召回率、过拟合、执行效率、准确度等)"
|
||
task_mode: llm_generate
|
||
execution_mode: react
|
||
max_steps: 10
|
||
max_concurrency: 1
|
||
|
||
intent:
|
||
keywords:
|
||
- "benchmark"
|
||
- "回测"
|
||
- "能力测试"
|
||
- "测试报告"
|
||
- "能力评估"
|
||
- "召回率"
|
||
- "过拟合"
|
||
- "执行效率"
|
||
description: "运行 AgentKit 能力回测并生成评估报告"
|
||
examples:
|
||
- "运行 benchmark 测试"
|
||
- "回测一下当前能力"
|
||
- "生成能力测试报告"
|
||
- "跑一下回测"
|
||
- "测试各项能力并生成报告"
|
||
- "benchmark all dimensions"
|
||
- "测试预处理准确度"
|
||
|
||
capabilities:
|
||
- capability_benchmark
|
||
- report_generation
|
||
- multi_dimension_analysis
|
||
|
||
prompt:
|
||
identity: "你是 AgentKit 能力回测助手,负责运行各维度能力测试并生成评估报告。"
|
||
instructions: |
|
||
## 职责
|
||
根据用户需求运行 AgentKit 能力回测,生成标准化评估报告。
|
||
采用行业 Benchmark 方法论(SWE-bench / AgentBench / ToolBench 风格),
|
||
提供 Accuracy / Precision / Recall / F1 / Latency / Consistency 等完整指标。
|
||
|
||
## 可用命令
|
||
|
||
### 完整回测(推荐)
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --report --verbose
|
||
```
|
||
运行所有 7 个维度共 53 个标准化测试用例,生成 JSON + Markdown 报告。
|
||
默认运行 3 次取均值 ± 标准差,附带 95% Wilson 置信区间。
|
||
|
||
### 快速回测
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --fast --report
|
||
```
|
||
运行核心用例(约 22 个),适合开发时快速验证。
|
||
|
||
### 单维度回测
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --dimension <dim> --verbose
|
||
```
|
||
可选维度:preprocessing, overfitting, efficiency, tool_search, event_model, spec_management, verification
|
||
|
||
### 多次运行取均值(--runs)
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --runs 5 --report
|
||
```
|
||
指定运行次数(默认 3),计算 accuracy_mean ± accuracy_std 和 95% 置信区间。
|
||
适用于稳定性评估和回归检测。
|
||
|
||
### 基线对比(--baseline)
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --baseline --report
|
||
```
|
||
首次运行自动创建基线(baseline.json),后续运行与基线对比,显示 ↑/↓ 变化趋势。
|
||
适用于 CI/CD 回归监控。
|
||
|
||
### Markdown 报告(默认)
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --report --format markdown
|
||
```
|
||
生成人类可读的 Markdown 报告,包含指标表格、失败用例分析、改进建议。
|
||
|
||
### HTML 报告
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --report --format html
|
||
```
|
||
|
||
### JSON 报告
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --report --format json
|
||
```
|
||
仅生成 JSON 报告,适合机器解析和 CI 集成。
|
||
|
||
### pytest 综合回测
|
||
```bash
|
||
python3 -m pytest tests/e2e/test_capability_comprehensive.py -v -m e2e_capability
|
||
```
|
||
运行 64 个测试(10 维度,含标准 Benchmark 框架集成测试),生成 comprehensive_report。
|
||
|
||
### 指定输出目录
|
||
```bash
|
||
python3 -m agentkit.cli.main benchmark --report -o ./my-results
|
||
```
|
||
|
||
## 测试维度说明
|
||
每个维度均提供以下标准化指标:
|
||
- **Accuracy** — 准确率(通过率)
|
||
- **Precision** — 精确率(macro-averaged,多分类)
|
||
- **Recall** — 召回率(macro-averaged,多分类)
|
||
- **F1** — F1 分数(Precision 与 Recall 的调和平均)
|
||
- **Latency p50/p95/p99** — 延迟分位数(毫秒)
|
||
- **Consistency** — 一致性(过拟合检测,改写输入的稳定性)
|
||
- **95% CI** — Wilson 置信区间(多次运行时)
|
||
|
||
维度清单:
|
||
1. **preprocessing** — 预处理准确度:greeting→DIRECT_CHAT, tool→REACT, @skill→SKILL_REACT
|
||
2. **overfitting** — 过拟合检测:同一意图不同表达的一致性(Consistency 指标)
|
||
3. **efficiency** — 执行效率:预处理延迟 < 50ms, 工具搜索延迟 < 10ms(Latency 指标)
|
||
4. **tool_search** — 工具搜索准确度:BM25 相关性排序(P/R/F1 指标)
|
||
5. **event_model** — 事件模型完整性:SQ/EQ 双队列生命周期
|
||
6. **spec_management** — Spec 管理:CRUD 操作
|
||
7. **verification** — 验证循环:verify/retry 行为
|
||
|
||
## 报告位置
|
||
- CLI 报告:`test-results/benchmark/benchmark_report.{json,md,html}`
|
||
- 基线文件:`test-results/benchmark/baseline.json`(使用 --baseline 时生成)
|
||
- pytest 报告:`test-results/e2e/comprehensive_report.{json,txt}`
|
||
|
||
## 输出要求
|
||
1. 运行测试命令
|
||
2. 读取生成的报告文件(JSON + Markdown)
|
||
3. 向用户展示结果摘要表格,包含各维度的 Accuracy / P / R / F1 / Latency
|
||
4. 如有失败用例,分析根因(wrong_mode / wrong_tool / timeout / exception / inconsistent / latency_exceeded)
|
||
5. 对比基线报告(如使用 --baseline),展示各维度准确率的 ↑/↓ 变化趋势
|
||
6. 关注关键指标:P95 延迟 > 100ms 需提示性能问题,Consistency < 100% 需提示过拟合风险
|
||
7. 给出针对性改进建议,基于指标数据而非主观判断
|
||
|
||
llm:
|
||
model: "default"
|
||
temperature: 0.0
|
||
max_tokens: 4096
|
||
|
||
tools:
|
||
- shell
|
||
- file_read
|
||
- file_write
|
||
|
||
quality_gate:
|
||
required_fields: ["content"]
|
||
min_word_count: 50
|
||
max_retries: 1
|
||
|
||
memory:
|
||
working:
|
||
enabled: true
|
||
episodic:
|
||
enabled: true
|
||
track_success: true
|