Use scripts/model_tester.py to run repeatable test prompts and compare requested vs actual model usage from OpenClaw logs.
Run
From the skill directory (or pass absolute paths):
CODEBLOCK0
Inputs
- -
--agent <name>: Target agent (chat, menial, coder, etc.) - INLINECODE2 : Requested model alias/name to test
- INLINECODE3 : Case from
references/test-cases.json or INLINECODE5 - INLINECODE6 : Per-case timeout (default
120) - INLINECODE8 : Optional JSON output file
Require at least one of --agent or --model.
What the runner does
- 1. Load test cases from
references/test-cases.json. - Start
openclaw logs --follow --json in parallel. - Run
openclaw agent --json with a bounded test prompt (asks agent to use a subagent for the task). - Parse response + tailed logs.
- Emit machine-readable JSON and a short human summary.
Output format
Top-level JSON:
- - INLINECODE14
- INLINECODE15
- INLINECODE16
- INLINECODE17
- INLINECODE18
Each result entry returns:
- - INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22 (parsed from logs when available)
- INLINECODE23 (
ok/error) - INLINECODE26
- INLINECODE27
- INLINECODE28 (when discoverable)
- INLINECODE29
Privacy & Safety
The tester spawns isolated subagent tasks with predefined test prompts only — no user data is passed to models. It tails OpenClaw logs to extract:
- - which model was actually selected (routing validation)
- token usage statistics
- runtime metrics
Log extraction uses regex patterns to find model/token fields. No personally identifiable information or arbitrary log content is captured — only structured fields related to the test execution.
Notes
- - Model extraction and token extraction are best-effort because log fields may vary by OpenClaw/provider version.
- If
openclaw config is invalid or gateway is unavailable, the script returns status=error with stderr details. - Edit
references/test-cases.json to add custom prompts for your benchmark set. - All test cases are generic; no workspace or user data is baked in.
技能名称: model-tester
详细描述:
使用 scripts/model_tester.py 运行可重复的测试提示,并从 OpenClaw 日志中比较请求的模型使用情况与实际模型使用情况。
运行
从技能目录(或传递绝对路径):
bash
python3 scripts/model_tester.py --agent menial --case extract-emails
python3 scripts/model_tester.py --model openai/gpt-4.1 --case math-reasoning
python3 scripts/model_tester.py --agent chat --model openai/gpt-4.1 --case all --out /tmp/model-test.json
输入参数
- - --agent <名称>: 目标代理(chat、menial、coder 等)
- --model <名称>: 要测试的请求模型别名/名称
- --case : 来自 references/test-cases.json 的测试用例或 all
- --timeout <秒>: 每个用例的超时时间(默认 120)
- --out <文件>: 可选的 JSON 输出文件
至少需要 --agent 或 --model 中的一个。
运行器执行的操作
- 1. 从 references/test-cases.json 加载测试用例。
- 并行启动 openclaw logs --follow --json。
- 使用受限的测试提示运行 openclaw agent --json(要求代理为任务使用子代理)。
- 解析响应 + 尾部日志。
- 输出机器可读的 JSON 和简短的人类可读摘要。
输出格式
顶层 JSON:
- - tool
- timestamp
- agent
- requested_model
- results[]
每个结果条目返回:
- - testcase
- agent
- requestedmodel
- actualmodel(从日志中解析,如果可用)
- status(ok/error)
- resultsummary
- runtime_seconds
- tokens(如果可发现)
- errors[]
隐私与安全
测试器仅使用预定义的测试提示生成隔离的子代理任务——不会向模型传递任何用户数据。它会跟踪 OpenClaw 日志以提取:
- - 实际选择的模型(路由验证)
- 令牌使用统计
- 运行时指标
日志提取使用正则表达式模式查找模型/令牌字段。不会捕获任何个人身份信息或任意日志内容——仅捕获与测试执行相关的结构化字段。
注意事项
- - 模型提取和令牌提取是尽力而为的,因为日志字段可能因 OpenClaw/提供商版本而异。
- 如果 openclaw 配置无效或网关不可用,脚本将返回 status=error 并附带 stderr 详细信息。
- 编辑 references/test-cases.json 以添加自定义提示到您的基准测试集。
- 所有测试用例都是通用的;不包含任何工作区或用户数据。