跳转到内容
GitHub

Agent 自动化操作手册

This guide is for AI coding agents that set up and run DynBench for a user, or contribute to this repository. Every command below is non-interactive and outputs structured JSON.

  1. Install. From a checkout: python -m pip install -e '.[data]'. From a wheel: pip install 'dynbench[data]'. Docker is required for code, terminal, Harbor, and SWE tasks.
  2. Store keys safely. Write API keys to .env as NAME=value (chmod 600 .env), or export them in the shell. Never pass a key on the command line and never print it. Config files only reference the variable name via key_env.
  3. Find benchmarks. dynbench bench search <words> lists matching benchmarks with roles (such as judge), model_needs (text, image, audio), and host_needs (docker, x86_64, kvm, gpu).
  4. Discover models. dynbench models scan --url <base_url> --key-env NAME --write-config .local/models.toml queries /models, probes callable capabilities (text, image, tools), and writes a local model config. Limit scope with --models to control requests. Report any model returning upstream_policy_refusal or auth_error to the user.
  5. Preflight check. dynbench setup --non-interactive --select <id> ... --url <base_url> --key-env NAME --judge <model> writes .local/dynbench-setup.json and reports per-benchmark readiness and blocking problems.
  6. Pull data & environments on demand. dynbench data pull --select <id> downloads pinned dataset slices into gitignored data/benchmarks/. dynbench env pull --select <id> ... pulls or builds required grader/task images and reports skipped or failed items cleanly.
  7. Run evaluations. dynbench bench run --select <id> ... --config .local/models.toml --models <config_id> --journal .local/run.jsonl
    • Pass --role judge=<config_id> (or --judge) for benchmarks declaring a judge role.
    • Use --jobs N for parallel execution (respecting requests_per_minute), --resume to skip completed rows and retry unscored ones, and --cache SALT to replay identical replies locally.
    • Use --harness bundle.json to inject external agents into task containers or run stdio v2 harnesses (see docs/arch/harnesses.md and examples/harnesses/).
  8. Inspect results. Rows are appended to the journal JSONL. passed: null means unscored (model, harness, or environment/grader error), never a model failure. Always report task sample size alongside pass counts. Use --attempts N for multi-attempt runs and --keep-answers when local answer auditing is required.
  9. Screen SOTA-Fail & sync state.
    • dynbench sota panel --journal ... --panel <ids> --min-attempts N --output .local/panel.json freezes panel protocol fingerprints and output budgets.
    • dynbench sota screen --journal ... --frozen-panel .local/panel.json screens unanimous failures with 95% Wilson intervals; sota verify audits false negatives.
    • dynbench sota sync-state --journal ... --frozen-panel .local/panel.json [--export-hf-dir DIR] updates the sharded dynamic state machine and optionally stages Hugging Face Parquet tables.
    • Never approve dynbench review or publish releases on your own; those require a human maintainer.

dynbench serve exposes an MCP server over stdio with tools search_benchmarks, scan_models, check_setup, start_run, run_status, and screen. dynbench serve --http PORT serves the same tools on http://localhost:PORT/tools/<name>. Never pass literal API keys as tool arguments; always pass the environment variable name.

  • Never commit .env, .local/, data/benchmarks/, raw benchmark payloads, or any credential.
  • Never approve reviews, publish collections, or push releases; those are maintainer-only actions.
  • Start small (--limit 2) and state the expected request count before launching a large run.
  • x86_64-only task images (such as official SWE-bench images) run under amd64 emulation on ARM hosts; rows record emulated: true and timeout budgets scale accordingly. Note this when reporting timing.
  • Desktop benchmarks require a compatible VM or container backend (see docs/platform/desktop_platform.md and docs/arch/lite_environments.md). If setup reports a missing desktop backend, report it clearly instead of improvising an unsupported hypervisor setup.
  • Tests & contracts: python -m pytest -q and python scripts/ci/check_contracts.py. After changing a dataclass in src/dynbench/core/contracts.py or models.py, run dynbench schema export.
  • Developer skills (single source of truth): Canonical skills live under skills/<name>/SKILL.md (add-benchmark, verify-benchmark, sota-fail-screen) and are mirrored to all 4 coding-agent roots (.claude/skills/, .codex/skills/, .agents/skills/, .cursor/skills/ + .cursor/rules/dynbench.mdc). After editing any skill under skills/, run python scripts/harness/sync_agent_skills.py and verify parity with python scripts/harness/sync_agent_skills.py --check.
  • Onboarding benchmarks: Use dynbench bench queue to inspect ready work and follow the add-benchmark skill (skills/add-benchmark/SKILL.md) and docs/arch/onboarding_sop.md. Each benchmark lives in configs/benchmarks/entries/<id>.json and benchmarks/<id>/ and must pass dynbench bench certify <id> and python scripts/ci/certify_changed.py --base dev. Do not edit configs/benchmarks/catalog.json, configs/sources.json, or unrelated entries.
  • Documentation & i18n: Site text is Chinese-first. When adding or updating Chinese strings in configs/inventory.json or configs/benchmarks/tracker.json, add matching English entries in configs/i18n/en.json (preserving {tokens} and `code` spans) and run python scripts/site/site_sync.py to confirm zero untranslated and zero unused strings.