- Attacker: writes attacks mapped to the OWASP LLM Top 10 and Agentic Security Initiative (ASI) categories
- Target: the system under test responds to each attack
- Judge: scores whether each attack succeeded
Result semantics: the scoring model marks
passed=True when the target was resistant (the attack failed) and passed=False when it was vulnerable (the attack succeeded). Individual results expose the inverse: vulnerable is False for a resistant target and True for a vulnerable one.Prerequisites
- Python 3.10 or later
- Install the package with the
redteamextras:
openai/..., anthropic/...) route through the Orq.ai router and use ORQ_API_KEY. Unprefixed IDs call the provider directly with OPENAI_API_KEY.
First red team run
The simplest run tests an Orq.ai agent in dynamic mode: attack prompts are generated at runtime based on the target’s system prompt and the selected categories.Python
generate_strategies=False (CLI: --no-generate-strategies) to run only the built-in attack strategies.
The parameter defaults to True, which adds LLM-authored strategies for each category. The -y flag skips the interactive confirmation prompt.
Modes
Themode parameter controls how attack prompts are sourced. Choose based on the tradeoff between coverage, reproducibility, and speed.
- Dynamic
- Static
- Hybrid
An LLM generates attacks at runtime, tailored to the target’s system prompt, tools, and memory stores. More varied coverage, but non-deterministic: results differ between runs.
Python
Selecting attack categories
Use thecategories parameter to scope a run to specific risk areas:
Python
LLM10 (Unbounded Consumption) is not available. It covers infrastructure-level risks that prompt-based red teaming cannot exercise.OWASP- prefix, so OWASP-LLM01 and LLM01 are equivalent. To list categories at runtime:
Python
Targeting specific vulnerabilities
For more precision, usevulnerabilities instead of categories. This targets individual attack vectors and takes precedence over categories when both are set.
Python
Python
Red teaming an Orq agent
When the application is deployed as an Agent in Orq.ai, pass theagent: target prefix.
The pipeline resolves the target from the prefix, auto-discovers the agent’s system prompt, tools, and memory stores, and generates tailored attacks including tool-misuse and memory-poisoning vectors.
Use deployment:<key> to target a Deployment instead.
Python
Python
deployment: prefix:
Python
Red teaming an OpenAI model
To test a raw OpenAI model without an agent wrapper, useOpenAIModelTarget, exported directly from evaluatorq.redteam. The model is the system under test; its system_prompt is prepended to every attack.
Python
Red teaming other frameworks
evaluatorq ships dedicated targets for agents built outside Orq.ai. Each one is installed through its own extra and passed tored_team() in place of a target string.
Each target handles tool and memory introspection, isolated conversation state per attack, and per-call token usage tracking.
A CrewAI crew exposes only its final output, so tool-misuse (ASI) attacks cannot be scored for it; use LLM-tier categories instead. For setup and per-framework options, see Custom Evaluators and Frameworks in the evaluatorq guides.
Reading the report
Thereport object returned by red_team() contains:
resistance_rate is None when no attack could be evaluated at all, for example when a gateway guardrail rejected every judge call. Check evaluated_attacks against total_attacks before trusting a rate.
Individual results follow the same rule: vulnerable is None, not False, when that attack could not be evaluated.
Iterating over results:
Python
A failed judge call is recorded on
result.evaluation_error (the attack ran, no verdict). A failed attack is recorded on result.error (it never ran). Do not treat either as a passed attack.Results in Orq.ai
WhenORQ_API_KEY is set, results are automatically pushed to the workspace as an Experiment run. A direct link is printed at the end of the run:
Exploring runs locally
Every run is also saved to.evaluatorq/runs/ in the working directory.
Control persistence with save= on red_team() ("none", "final", or "detail" with artifacts_dir=). The CLI equivalent is --save with --artifacts-dir for detail.
The evaluatorq dashboard reads that store and renders the saved runs:
http://127.0.0.1:8080 by default.
Unlike a single-run view, it indexes every saved run, so scans can be compared over time. List saved runs from the command line with eq redteam runs.
The dashboard is a preview and still under active development. Its layout and options may change between releases. The legacy
eq redteam ui command remains callable but is deprecated.CI integration
Use the exit-code-gating pattern to fail a build if the target regresses. Static mode replays a fixed dataset, so a failure means the target regressed rather than the attacker generating a different set of prompts.Python
eq redteam run exits 1 in two cases, both read off report.summary:
- No verdict: attacks ran but not one could be evaluated. Always fails, there is no setting that disables this
- Coverage below the floor: fewer than 80% of attacks got a verdict (
summary.coverage_below_minimum). Pass--min-evaluation-coverage 0to warn instead of failing, or a higher value to be stricter
Advanced LLM configuration
By default,red_team() uses gpt-5-mini for both the attacker and evaluator roles. To override per-role models, temperature, or token limits, pass an LLMConfig:
Python
Going further
The evaluatorq documentation covers the parts of red teaming that sit outside Orq.ai:Red teaming guide
Attack strategies, delivery methods, custom evaluators, and framework integrations.
Red teaming examples
Runnable examples covering static datasets, category filtering, and multi-target scans.
Python API reference
Full signatures for
red_team(), targets, and report contracts.CLI reference
Every
eq redteam command and flag.Red Teaming cookbook
Step-by-step walkthrough: run one scan, read the finding, fix the instructions, and replay the same attacks.