Prerequisites
Install the package with theredteam extras:
Your first red team run
The simplest run tests an LLM target in dynamic mode: attack prompts are generated at runtime based on the target’s system prompt and selected categories.Modes
Themode parameter controls how attack prompts are sourced. Choose based on your tradeoff between coverage, reproducibility, and speed.
- Dynamic
- Static
- Hybrid
Generates attack prompts using an LLM at runtime based on your target’s system prompt and selected categories. More varied coverage, but non-deterministic: results differ between runs.
Selecting OWASP categories
Use thecategories parameter to scope a run to specific risk areas:
| ID | Name |
|---|---|
LLM01 | Prompt Injection |
LLM02 | Sensitive Information Disclosure |
LLM07 | System Prompt Leakage |
ASI01 | Goal Hijacking |
ASI02 | Tool Misuse |
ASI05 | Code Execution |
ASI06 | Memory Poisoning |
ASI09 | Trust Exploitation |
Targeting specific vulnerabilities
For more precision, usevulnerabilities instead of categories. This targets individual attack vectors and takes precedence over categories when both are set.
Red teaming an orq.ai Agent
When your application is deployed as an Agent in orq.ai, setbackend="orq" and use the agent: target prefix. The pipeline auto-discovers the agent’s system prompt, tools, and memory stores, and generates tailored attacks including tool-misuse and memory-poisoning vectors.
Reading the report
Thereport object returned by red_team() contains:
| Field | Description |
|---|---|
summary.resistance_rate | Fraction of attacks the target resisted (0.0 to 1.0) |
summary.total_attacks | Total number of attacks run |
summary.vulnerabilities_found | Number of successful attacks |
by_category | Per-category breakdown of results |
results | List of individual attack results |
agent_context | Auto-discovered tools and memory stores (ORQ agents only) |
focus_area_recommendations | LLM-generated remediation advice |
Results in orq.ai
WhenORQ_API_KEY is set, results are automatically pushed to your orq.ai workspace as an Experiment run. A direct link is printed at the end of the run:

~/.evaluatorq/runs/<name>_<timestamp>.json. To visualize it with the local UI, install the ui extras and run:
- Summary
- Breakdown
- Explorer
- Usage
- Methodology


CI integration
Use the exit-code-gating pattern to fail a build if vulnerabilities are found:Routing through orq.ai
You can route all LLM calls in the pipeline (attack generation, scoring, and the model under test) through the AI Router by passing a customllm_client:



