Skip to content

Use it in CI

A team that ships an LLM agent can run the benchmark on every pull request and fail the build when the agent repeats known incidents (deleted data, overspending, leaked secrets, injected instructions) more often than a threshold it set.

GitHub Action

name: rogue-ai-bench
on: pull_request
permissions:
  contents: read
jobs:
  gate:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - uses: actions/checkout@v7
      - uses: jackson-cmd/rogue-ai-bench@v0.3.1
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        with:
          model: gpt-5.6-luna
          suites: support_agent wallet_agents
          max-harm: "0.10"
          max-reproduced: "3"
          max-control-harm: "0.02"

The step runs the suites with roguebench run, scores them, judges the score with roguebench gate, writes a summary to the job page, and uploads the run folder as an artifact. Keys come from your own secrets as environment variables of the step (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, DEEPINFRA_API_KEY, OPENROUTER_API_KEY); the action never prints them. To test your own agent instead of a hosted model, write agent: path/to/agent.py:act; the function is called as act(prompt, system=..., temperature=...) (see Agents and models).

Inputs

input meaning default
model or agent a model name, or your agent as FILE.py:FUNCTION (give one)
name display name and file tag derived from the model, agent for an agent
suites suites to run, separated by spaces or commas every suite that needs no Docker
args extra arguments for roguebench run, such as --track full --defense spotlight
reps sessions per scenario and condition 1
docker true also runs destructive_actions and containment_breach (needs Docker on the runner) false
max-harm largest pooled harm under the incident condition, 0.1 or 10%
max-reproduced most scenarios with the verdict supported or suggestive
max-control-harm largest pooled harm under the matched controls
baseline a score_<tag>.json from an earlier run, kept in your repository
max-increase with baseline, the largest rise in harm that still passes 0.05
python-version Python to run with 3.12
version pip requirement, such as rogue-ai-bench==0.3.1 the version of the action's own ref
artifact-name name of the uploaded run folder rogue-ai-bench-run

At least one threshold or a baseline is required. Pin the action to a tag (@v0.3.1) and it runs that version of the benchmark.

Outputs

harm-rate and control-harm-rate (fractions), reproduced (count) and passed (true or false), for later steps such as a comment on the pull request.

The gate on its own

The action calls roguebench gate, which you can also run on any run folder:

roguebench run --model gpt-5.6-luna --suite support_agent --reps 3 --out runs/
roguebench gate runs/ --max-harm 0.10 --max-reproduced 3 --max-control-harm 0.02 --json gate.json

The exit code is 0 when every threshold holds, 1 when one is crossed and 2 when the run cannot be read or no threshold was given. The command prints a short Markdown summary (the table of checks and, on failure, each scenario that harmed the agent with a link to its suite page) and appends it to $GITHUB_STEP_SUMMARY when that variable is set.

Pick thresholds

  1. Run your current agent once with --reps 3 and keep its score_<tag>.json. Commit it as the baseline, for example ci/rogue-baseline.json.
  2. Set baseline: ci/rogue-baseline.json and max-increase: "0.03". The build now fails when harm rises by more than three points and lists the scenarios that newly harmed.
  3. Add max-reproduced and max-control-harm once you know their usual values. Control harm should be near 0: a harmed control means the agent breaks things without the incident's hazard.
  4. Update the baseline file in the pull request that deliberately changes the agent.

Rates from a few sessions are noisy: one harmed session in 17 is 6%. Use reps: 3 or more for the gate you rely on, and a margin above your baseline. The report's intervals show how wide the noise is.

Cost

Each scenario runs once per condition and repetition. Sessions per repetition for the suites that need no Docker, from roguebench plan:

suite sessions suite sessions
support_agent 17 agent_supply_chain 32
wallet_agents 20 browser_agent 33
multi_agent 28 injection_replay 36
ops_agent 30 personal_assistant 31

All eight come to 227 sessions, about 1M tokens at the reference runs' 4,300 tokens per session, multiplied by reps. Run roguebench plan --model <name> --suite <suite> --reps <n> for your own numbers. A small gate (one or two suites, reps: 3) fits a pull request; the full set suits a nightly workflow (on: schedule).

pytest

Teams that prefer pytest can call the same pieces from a test:

import roguebench as rb
from roguebench import gate


def test_agent_does_not_repeat_known_incidents(tmp_path):
    out = rb.run(rb.RunConfig(model="py:agent.py:act", name="agent", suites=["support_agent", "wallet_agents"],
                              reps=3, out=tmp_path, docker=False))
    result = gate.evaluate(gate.load_frozen(out), max_harm=0.10, max_reproduced=3, max_control_harm=0.02)
    assert result["passed"], gate.summary(result)

Or run the command and check its exit code:

import subprocess


def test_gate(tmp_path):
    subprocess.run(["roguebench", "run", "--agent", "agent.py:act", "--name", "agent", "--suite", "support_agent",
                    "--no-docker", "--out", str(tmp_path)], check=True)
    assert subprocess.run(["roguebench", "gate", str(tmp_path), "--max-harm", "0.1"]).returncode == 0