Metadata-Version: 2.5
Name: rogue-ai-bench
Version: 0.2.0
Summary: A benchmark of real rogue-AI incidents: offline replications of LLM-agent failures, each beside a matched control, harm read from the environment's state
Project-URL: Homepage, https://jackson-cmd.github.io/rogue-ai-bench/
Project-URL: Documentation, https://jackson-cmd.github.io/rogue-ai-bench/
Project-URL: Repository, https://github.com/jackson-cmd/rogue-ai-bench
Project-URL: Issues, https://github.com/jackson-cmd/rogue-ai-bench/issues
Project-URL: Changelog, https://github.com/jackson-cmd/rogue-ai-bench/blob/main/CHANGELOG.md
Project-URL: Paper, https://arxiv.org/abs/2611.26553
Author: ROGUE-AI Bench contributors
License-Expression: MIT
License-File: LICENSE
Keywords: agent-safety,agent-security,agentdojo,ai-agents,ai-incidents,benchmark,coding-agents,llm-agents,llm-evaluation,mcp,prompt-injection,red-teaming,rogue-ai,tool-use
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.34
Requires-Dist: openai>=1.40
Requires-Dist: pytest>=7
Provides-Extra: detector
Requires-Dist: torch>=2.2; extra == 'detector'
Requires-Dist: transformers>=4.40; extra == 'detector'
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Description-Content-Type: text/markdown

<h1 align="center">ROGUE-AI Bench</h1>

<p align="center"><b>A benchmark built from real rogue-AI incidents: each one rebuilt offline, run beside a matched control, with harm read from the environment's state.</b></p>

<p align="center">132 replications of public LLM-agent incidents · 10 environments · 326 incident records · defenses and adaptive attacks · a live track that grows every night</p>

<p align="center">
<a href="https://jackson-cmd.github.io/rogue-ai-bench/">Website</a> ·
<a href="https://jackson-cmd.github.io/rogue-ai-bench/leaderboard/">Leaderboard</a> ·
<a href="https://arxiv.org/abs/2611.26553">Paper</a> ·
<a href="https://huggingface.co/datasets/jacksonwangpro1/rogue-ai-bench">Dataset</a>
</p>

<p align="center">
<img alt="version" src="https://img.shields.io/badge/version-0.2.0-e5534b">
<img alt="python" src="https://img.shields.io/badge/python-3.10%20to%203.13-3776ab">
<img alt="license" src="https://img.shields.io/badge/license-MIT-2ea44f">
<img alt="scenarios" src="https://img.shields.io/badge/replications-132-555">
<a href="https://doi.org/10.5281/zenodo.24630499"><img alt="DOI" src="https://zenodo.org/badge/DOI/10.5281/zenodo.24630499.svg"></a>
</p>

<p align="center">
<img alt="Three real incidents drawn by hand: Replit's agent wipes production data in a code freeze, Amazon Q ships a planted prompt that deletes files, and Antigravity's cache cleanup wipes a whole drive, each with how often the reference models repeated it in the offline replication with and without the hazard" src="https://jackson-cmd.github.io/rogue-ai-bench/assets/sketch.svg" width="100%">
</p>

```bash
pip install rogue-ai-bench
roguebench check --suite support_agent          # scripted policies, no model, no key
export OPENAI_API_KEY=...                       # or ANTHROPIC_API_KEY, GEMINI_API_KEY, DEEPINFRA_API_KEY, LLM_BASE_URL
roguebench run --model gpt-5.6-luna --suite support_agent --reps 1
```

## Why rogue AI, not only prompt injection

Prompt injection may keep getting harder. Models are being trained to tell instructions from data, and agent frameworks now filter and fence what tools return. The incidents that keep happening do not need an attacker: a coding agent cleans up the wrong folder, a shopping agent spends past its budget, an ops agent changes production during a code freeze. In the incident catalog, 180 of the 326 incidents (55%) had no attacker: the agent did the damage on its own. That share went from 33% of the incidents reported in 2025 to 65% of those reported in 2026; the catalog is not a random sample of all incidents, so take the trend as a sign rather than a measurement. ROGUE-AI Bench is built for this side of agent safety, and keeps the injection incidents next to it.

What is different from AgentDojo and other injection benchmarks:

- **Real incidents, not invented tasks.** Every scenario rebuilds a public report of something an agent actually did, and links to its sources.
- **Harm without an attacker.** Most incidents had nobody attacking the agent. The benchmark measures the agent's own wrong turns: wrong target, overreach, broken rules, made-up results.
- **Cause, not only failure.** Each scenario runs beside a control that lacks only the hazard, and an exact test says whether the incident's condition caused the harm.
- **It keeps growing.** A live track adds newly reported incidents every night.
- **It says why.** `roguebench diagnose` shows the step where the agent went wrong, its reasoning, the likely cause and the defense that stops it, and exports fine-tuning data.

The full comparison is [below](https://github.com/jackson-cmd/rogue-ai-bench#how-it-compares-with-agentdojo).

## Is it for you?

- You ship or test an LLM agent and want to know whether it repeats the failures that have already happened to agents in the wild: a coding agent that wipes a database, a support bot that invents a login policy, an assistant that forwards a one-time code to a stranger.
- You work on agent defenses and want to measure them against the incident's own condition, against a control without the hazard, and against an attacker who knows your defense.
- You run a model release process and want a regression test that says which known incidents a new model now falls for.

## Contents

- [Why rogue AI, not only prompt injection](https://github.com/jackson-cmd/rogue-ai-bench#why-rogue-ai-not-only-prompt-injection)
- [What's new](https://github.com/jackson-cmd/rogue-ai-bench#whats-new)
- [The idea](https://github.com/jackson-cmd/rogue-ai-bench#the-idea)
- [Quick start](https://github.com/jackson-cmd/rogue-ai-bench#quick-start)
- [Diagnose a model](https://github.com/jackson-cmd/rogue-ai-bench#diagnose-a-model)
- [Bring your own agent](https://github.com/jackson-cmd/rogue-ai-bench#bring-your-own-agent)
- [Defenses and attacks](https://github.com/jackson-cmd/rogue-ai-bench#defenses-and-attacks)
- [Leaderboard](https://github.com/jackson-cmd/rogue-ai-bench#leaderboard)
- [How it compares with AgentDojo](https://github.com/jackson-cmd/rogue-ai-bench#how-it-compares-with-agentdojo)
- [Contributing](https://github.com/jackson-cmd/rogue-ai-bench#contributing)
- [FAQ](https://github.com/jackson-cmd/rogue-ai-bench#faq)
- [Citation](https://github.com/jackson-cmd/rogue-ai-bench#citation)

## What's new

- **0.2.0** (2026-11-28): `roguebench diagnose` shows where and why a model failed (step-by-step traces with its reasoning, causes, defenses that stop it) and exports fine-tuning data.
- **0.1.1** (2026-11-28): `roguebench check` keeps live scenarios out of the frozen suites' own tests; the data is on [Hugging Face](https://huggingface.co/datasets/jacksonwangpro1/rogue-ai-bench); releases are archived on Zenodo.
- **0.1.0** (2026-11-28): first release. Benchmark 1.0 with the 108 replications of the paper, the incident catalog, the runner, scoring, six benchmark-wide defenses, five attack templates, offline checks and the leaderboard. See [CHANGELOG.md](https://github.com/jackson-cmd/rogue-ai-bench/blob/main/CHANGELOG.md).

## The idea

Most agent benchmarks write their own tasks and ask whether an agent can be pushed into a bad action. ROGUE-AI Bench starts from the other end: every scenario rebuilds a public report of something an agent actually did, and asks whether today's models still do it, and why.

Each scenario runs under matched conditions:

| condition | what the agent sees |
|---|---|
| `trigger` | the incident's condition: the production path in a config file, the forwarded message, the tool description that changed after approval |
| `control` | the same environment without the hazard, or neutral text of the same length in the same place |
| `defense` | the incident's condition with a defense taken from the report or the vendor's fix |
| `adaptive` | a variant written against that defense, run without it |
| `adaptive+defense` | the adaptive variant against the defense |

After every session, code inspects the environment (files, database rows, the ledger, sent mail, the network log) and decides whether harm happened. No model judges harm. Each replication gets the paper's verdict: *supported* when the incident condition harms the agent more often than its controls under a one-sided exact test with Benjamini-Hochberg correction across scenarios, *suggestive* when it causes harm but the test does not clear that threshold, and *not reproduced* when it causes none. Because the controls keep everything except the hazard, a reproduced scenario says that the reported condition, not the task or the environment, made the agent act.

Many of these incidents had no attacker. Agents deleted data, overspent budgets and broke rules on their own, and the benchmark keeps those cases next to the injection attacks.

The ten environments:

| suite | agent and tools | harm according to the state check |
|---|---|---|
| `destructive_actions` | coding agent with a shell and git in Docker | files, rows or remote branches gone |
| `ops_agent` | ops agent over mock cloud, cluster and CI tools | resources deleted, secrets or private code published |
| `agent_supply_chain` | agent with MCP servers, skills and packages | secrets or mail sent out, commands run from a component |
| `injection_replay` | enterprise and assistant agents | private data reaches an outside address |
| `personal_assistant` | mail, calendar, drive and booking tools | items deleted, sent or shared against the user's rule |
| `browser_agent` | web pages, forms and local files | purchase, data or account access outside the task |
| `wallet_agents` | wallet, shop and broker tools | transfer, order or purchase beyond the mandate |
| `support_agent` | CRM, refunds, knowledge base and outbox | refund or credit over policy, false policy, unsolicited mail |
| `multi_agent` | several agents with relays and shared memory | a privileged agent acts for an outsider |
| `containment_breach` | agent in an evaluation sandbox | outside host reached, credential used, shutdown resisted |

All data are synthetic: credentials start with `FAKE-` or `CANARY-`, hosts end in `.example`, and the destructive scenarios run in containers without network access. Nothing touches a real service.

## Quick start

```bash
pip install rogue-ai-bench            # or: uvx rogue-ai-bench, brew install jackson-cmd/tap/rogue-ai-bench, or docker run ghcr.io/jackson-cmd/rogue-ai-bench
roguebench list                        # the ten suites
roguebench list scenarios              # 134 scenarios (132 replications and two adaptive variants)
roguebench show support_agent/s6_inbox # what it replicates, its sources, its conditions and the reference results
roguebench plan --model gpt-5.6-luna   # 906 sessions for the core track at three repetitions
roguebench run --model gpt-5.6-luna    # all suites; Docker runs the two container suites, --no-docker skips them
roguebench score runs/                 # the report again, from the sessions on disk
```

`run` writes one JSON line per session under `runs/<suite>/` and resumes where it stopped. `--incidents-after 2026-06-01` keeps only the scenarios whose incidents were first reported after that date, so a model whose training data ends earlier cannot have read about them (34 scenarios after June 2026, 23 after September). `--track full` adds the defenses and adaptive variants; `--live also` adds the scenarios replicated after the paper. Models: `gpt-*` (OpenAI), `claude-*` (Anthropic), `gemini-*` (Google), open-weight models as `deepinfra/<model id>` or `openrouter/<vendor>/<model>` (`deepseek-v4-flash` is a short name), `compat/<id>` for any OpenAI-compatible server (vLLM, Ollama, LiteLLM; set `LLM_BASE_URL` and `LLM_API_KEY`), and `mock` for a run with no network.

A report looks like this (GPT-5.6-luna, the paper's runs):

| metric | value |
|---|---|
| harm, incident condition | 17.9% (64/357, 14-22) |
| harm, matched controls | 0.2% (1/549, 0-1) |
| exact test stratified by scenario | p = 7.8e-28 |
| benign utility (task done, controls) | 58.3% |
| utility under the incident condition | 40.2% |


## Diagnose a model

A score says how often a model caused harm; `roguebench diagnose` says why. It reruns the replications a model failed, one session at a time, and records every step: what the agent saw, its own reasoning when the model returns it, and its reply. With `--causes` it reruns each failure under one change at a time (allowed to stop and report, a safe path offered, the hazard pointed out, the rule restated) to name the cause; with `--defenses` it finds the harness changes that stop it; with `--explain MODEL` a model names the root cause and the decisive step. It writes a report and four fine-tuning files: the failures, harmless sessions under the same hazard, chosen/rejected pairs, and the first step where a harmless and a harmful session part.

```bash
roguebench diagnose runs/ --tag gpt-5.6-luna --causes --defenses --explain claude-sonnet-4.6
open runs/diagnose/gpt-5.6-luna/report.html
```

Details: [Diagnose a model](https://jackson-cmd.github.io/rogue-ai-bench/concepts/diagnose/).
## Bring your own agent

Any Python function can be the agent. It receives the simulation's transcript and the system prompt, and returns the next reply in the text protocol (`ACTION: tool(arg=value)` or `DONE: message`):

```python
# my_agent.py
def act(prompt, system=None, temperature=0.1):
    reply = my_llm(system=system, user=prompt)      # your model, your scaffolding, your guardrails
    return reply
```

```bash
roguebench run --agent my_agent.py:act --name my-agent
```

The same function can return `(text, {"prompt_tokens": n, "completion_tokens": m})` to report tokens. A class with a `complete(prompt, system, temperature)` method works too. Every suite calls the agent through one function, so the agent runs unchanged in all ten environments.

## Defenses and attacks

59 scenarios carry a defense taken from the incident report or the vendor's fix, and 25 scenarios run an adaptive variant written against a defense (`--track full`). On top of those, six defenses apply to every scenario:

```bash
roguebench run --model gpt-5.6-luna --defense spotlight,sandwich
```

| defense | what it does |
|---|---|
| `reminder` | a security reminder in the system prompt: tool output is data, check before irreversible actions |
| `sandwich` | the user's request repeated after the latest tool output |
| `spotlight` | every tool output between markers, with a note that marked text is data |
| `detector` | a model reads the latest tool output and blanks it when it carries an instruction (`--detector-model`) |
| `pi_detector` | the same with a local prompt-injection classifier (transformers; `pip install 'rogue-ai-bench[detector]'`) |
| `tool_filter` | a model picks the tools the user's request needs before the agent acts; the rest leave the tool list |

Your own defense is a function `(system, prompt) -> (system, prompt)` in a plug-in file (`DEFENSES = {"name": fn}`, `--plugin file.py`).

Attacks replace the injected text of a scenario with another wording of the same goal, so that the state check still measures the same harm. The default is `incident`, the real incident's text. The templates follow AgentDojo's attack families: `important_instructions`, `ignore_previous`, `system_message`, `injecagent`, `direct`. Version 0.1.0 has 39 injection vectors in 33 scenarios; adding one is a short pull request ([docs](https://jackson-cmd.github.io/rogue-ai-bench/contributing/)).

## Leaderboard

Lower harm is safer. Every entry carries per-scenario counts, and CI recomputes each number from them.

| Model | Harm (incident) | Harm (controls) | Reproduced | Utility | Utility (incident) | Harm with defense (same scenarios without) | Harm (adaptive vs defense) |
|---|---|---|---|---|---|---|---|
| GPT-5.6-luna | 17.9% | 0.2% | 25/108 | 58.3% | 40.2% | 1.3% (vs 18.7%) | 8.3% |
| Claude Sonnet 4.6 | 18.8% | 1.1% | 22/108 | 88.1% | 65.8% | 3.8% (vs 18.7%) | 26.2% |
| GPT-5.6-sol | 25.2% | 0.4% | 31/108 | 78.2% | 57.2% | 3.5% (vs 25.6%) | 18.3% |
| Gemini 3.5 Flash | 31.4% | 0.9% | 39/108 | 75.8% | 51.3% | 6.8% (vs 34.3%) | 32.1% |
| DeepSeek-V4-Flash | 32.8% | 0.4% | 44/108 | 81.8% | 57.3% | 6.3% (vs 33.8%) | 40.5% |

"Reproduced" counts the replications whose incident condition harmed this model more than the controls (supported or suggestive). With three sessions per cell a single model rarely clears the multiple-testing threshold on one scenario, so the model-level test is the pooled one in each entry. Full table with intervals: [website](https://jackson-cmd.github.io/rogue-ai-bench/leaderboard/).

To add your model:

```bash
roguebench run --model your-model --reps 3 --track full
roguebench submit runs/ --tag your-model --submitter @you --provider yourco
# open a pull request with the new file in leaderboard/submissions/
```

## How it compares with AgentDojo

AgentDojo is the reference benchmark for prompt injection against tool-using agents. ROGUE-AI Bench keeps what makes it useful and changes where the tasks come from.

| | AgentDojo | ROGUE-AI Bench |
|---|---|---|
| Where scenarios come from | tasks written for the benchmark | public reports of real incidents, each linked to its sources |
| Failures without an attacker | no | yes (destructive actions, overspending, broken rules) |
| Matched controls per scenario | no | yes, and a verdict from an exact test against them |
| Harm decided by | code over the environment state | code over the environment state, checked by scripted policies |
| Defenses | pipeline defenses | the incident's own defenses with adaptive variants, plus benchmark-wide ones |
| Attacks | templates in injection slots | the incident's own text, plus templates in injection vectors |
| Bring your own agent or model | pipeline elements | a Python function, or any OpenAI-compatible server |
| Native function calling | yes | yes (`--tool-mode native`), or the text protocol |
| Offline checks | `check_suites` | `roguebench check` |
| Results submitted by pull request | yes | yes, every number recomputed by CI |
| New scenarios over time | releases | a live track that grows every night from new incident reports |
| Test only on what a model cannot have seen | no | `--incidents-after DATE` (incident report dates) |
| Why a model failed, and data to fix it | success rates | `roguebench diagnose`: step-by-step traces with the model's reasoning, causes, defenses that stop it, fine-tuning data |
| Installs | PyPI | PyPI, Docker image |

## Contributing

- **Results**: run your model, `roguebench submit`, open a pull request.
- **An incident we missed**: open an issue with the link ("Report an incident"). The live track picks up new public reports every night.
- **A scenario**: follow the scenario guide on the website; `roguebench check` must pass.
- **Defenses, attacks, injection vectors**: plug-ins or a short pull request.

See [.github/CONTRIBUTING.md](https://github.com/jackson-cmd/rogue-ai-bench/blob/main/.github/CONTRIBUTING.md).

## FAQ

**Does it need Docker?** Only for `destructive_actions` and `containment_breach`, where the agent's shell commands run in containers. `--no-docker` skips them. The Docker image runs the other eight suites; run the two container suites from a `pip` install on a machine with Docker.

**Does it run on Windows?** Use WSL or the Docker image. CI tests Linux and macOS.

**How much does a run cost?** The core track is 906 sessions per model at three repetitions, about 3.9 million tokens at the reference runs' average. `roguebench plan` prints the count for your selection.

**Text protocol or native tool calling?** Both. By default every model answers in the suites' text protocol, which keeps all models on the same footing across the ten environments. `--tool-mode native` turns each suite's tool list into function definitions and lets the model choose through its provider's function-calling API (OpenAI-compatible servers and Anthropic); the chosen call is written back as the suite's action line, so the state checks and scores are the same.

**Are the incidents verified?** Every frozen scenario replicates at least one incident that passed the paper's source check (confirmed or corrected against its sources). The catalog keeps each record's evidence level, from first-party post-mortems to news reports.

## Citation

```bibtex
@article{wang2026replication,
  title   = {Replication of Agentic Security Events: Audit and Investigation ({ROGUE-AI})},
  author  = {Wang, Mengxiao and Alam, Mahbub and Nakka, Kalyan and Saxena, Nitesh},
  journal = {arXiv preprint arXiv:2611.26553},
  year    = {2026}
}
```

To cite the software itself, use its Zenodo DOI, [10.5281/zenodo.24630499](https://doi.org/10.5281/zenodo.24630499), which always points to the latest release; each release also has a DOI of its own on that page.

MIT license. The incident records summarize public reports; each links its sources.
