$git clone https://github.com/KeyValueSoftwareSystems/agent-opforOPFOR is short for _Opposition Force_ — a military term for the unit that plays the enemy in training, so the rest of the army learns what real attacks feel like before they come. We named the tool after that idea: to defend AI agents better, you have to attack them first.
| 1 | <p align="center"> |
| 2 | <picture> |
| 3 | <source media="(prefers-color-scheme: dark)" srcset="assets/Opfor_white%20text.svg" /> |
| 4 | <source media="(prefers-color-scheme: light)" srcset="assets/Opfor_black%20text.svg" /> |
| 5 | <img src="assets/Opfor_black%20text.svg" alt="OPFOR" width="250" /> |
| 6 | </picture> |
| 7 | </p> |
| 8 | |
| 9 | <p align="center"> |
| 10 | <strong>Open-source adversary emulation for AI agents, LLM apps, and MCP servers.</strong><br/> |
| 11 | Test your AI like a real attacker would — from your CLI, your IDE, or a browser extension that anyone on your team can use. |
| 12 | </p> |
| 13 | |
| 14 | <p align="center"> |
| 15 | <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-444441?style=flat&labelColor=3d3d3a" alt="License: Apache 2.0"></a> |
| 16 | <a href="https://github.com/KeyValueSoftwareSystems/agent-opfor/stargazers"><img src="https://img.shields.io/github/stars/KeyValueSoftwareSystems/agent-opfor?style=flat&labelColor=3d3d3a&color=444441" alt="GitHub stars"></a> |
| 17 | <a href="https://discord.gg/Sb8xfmrjjW"><img src="https://img.shields.io/badge/Discord-join-5865F2?style=flat&logo=discord&logoColor=white&labelColor=3d3d3a" alt="Discord"></a> |
| 18 | <a href="#evaluator-coverage"><img src="https://img.shields.io/badge/OWASP-LLM%20%2B%20Agentic%20%2B%20MCP%20%2B%20API-185FA5?style=flat&labelColor=3d3d3a" alt="OWASP coverage"></a> |
| 19 | </p> |
| 20 | |
| 21 | <p align="center"> |
| 22 | <a href="https://trendshift.io/repositories/75655?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-75655" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/75655/daily?language=TypeScript" alt="KeyValueSoftwareSystems%2Fagent-opfor | Trendshift" width="250" height="55"/></a> |
| 23 | </p> |
| 24 | |
| 25 | <p align="center"> |
| 26 | <a href="https://agentopfor.ai/">Website</a> · |
| 27 | <a href="https://docs.agentopfor.ai">Docs</a> · |
| 28 | <a href="https://github.com/KeyValueSoftwareSystems/agent-opfor">GitHub</a> · |
| 29 | <a href="https://chromewebstore.google.com/detail/blkflfeicejfnbecanjaolbllmoobenp">Browser Extension</a> · |
| 30 | <a href="https://discord.gg/Sb8xfmrjjW">Discord</a> |
| 31 | </p> |
| 32 | |
| 33 | OPFOR is short for _Opposition Force_ — a military term for the unit that plays the enemy in training, so the rest of the army learns what real attacks feel like before they come. We named the tool after that idea: to defend AI agents better, you have to attack them first. |
| 34 | |
| 35 | <p align="center"> |
| 36 | <img src="assets/opfor-high-level.svg" alt="How OPFOR works" width="860" /> |
| 37 | </p> |
| 38 | |
| 39 | ## Why we built this |
| 40 | |
| 41 | We've shipped 130 products for 90 startups over the last ten years. In the last 18 months, almost every one of them had an AI agent in it — and every one of those teams hit the same wall when it came to testing. |
| 42 | |
| 43 | So we built OPFOR. For ourselves first. Now open source. |
| 44 | |
| 45 | Apache 2.0. Built from India. |
| 46 | |
| 47 | ## Quick Start |
| 48 | |
| 49 | ```bash |
| 50 | npm install -g @keyvaluesystems/agent-opfor-cli |
| 51 | export OPENAI_API_KEY=your-key # or GEMINI_API_KEY, ANTHROPIC_API_KEY, etc. |
| 52 | ``` |
| 53 | |
| 54 | **One-shot** — runs the setup wizard and immediately starts the scan: |
| 55 | |
| 56 | ```bash |
| 57 | opfor run |
| 58 | ``` |
| 59 | |
| 60 | **Two-step** — save a config you can reuse or commit to CI: |
| 61 | |
| 62 | ```bash |
| 63 | opfor setup # wizard saves a config to .opfor/configs/ |
| 64 | opfor run --config .opfor/configs/<file> # run any time against the saved config |
| 65 | ``` |
| 66 | |
| 67 | https://github.com/user-attachments/assets/a6a3cff2-2cf9-4486-944e-ac0163e7ea04 |
| 68 | |
| 69 | ## What opfor does |
| 70 | |
| 71 | Opfor red-teams the full AI agent surface — prompts, tools, MCP servers, memory, and multi-turn reasoning. It generates targeted attacks for OWASP LLM Top 10, OWASP Agentic AI Top 10, OWASP MCP Top 10, OWASP API Security, and EU AI Act bias suites, fires them at your target, and judges each response with an LLM. |
| 72 | |
| 73 | Most red-team tooling in this space is excellent at one thing — a probe library, a developer evaluator, a programmatic framework. Opfor covers more ground in one tool: |
| 74 | |
| 75 | - **Browser extension for non-developers** — anyone on your team can red-team a deployed chatbot, no code, no env vars, no YAML |
| 76 | - **Run opfor as |