Skip to main content
Red teaming sends adversarial prompts at an agent or model to find exploitable weaknesses before they reach production. evaluatorq automates the loop. Three roles work together in every scan:
  • 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.
This page covers running red team scans and reading the results in Orq.ai. For the full library reference, per-framework integrations, and the complete example set, see the evaluatorq red teaming guide.

Prerequisites

  • Python 3.10 or later
  • Install the package with the redteam extras:
Set the API key for the target:
The attacker and evaluator models follow the same key path as the target. Provider-prefixed model IDs (for example 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
Or run it from the CLI:
Both examples pass 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.
Scans run with parallelism=10 by default. Lower it if the target’s rate limits are strict, for example red_team(..., parallelism=3), or raise it for faster runs.

Modes

The mode parameter controls how attack prompts are sourced. Choose based on the tradeoff between coverage, reproducibility, and speed.
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 the categories parameter to scope a run to specific risk areas:
Python
The supported categories are:
LLM10 (Unbounded Consumption) is not available. It covers infrastructure-level risks that prompt-based red teaming cannot exercise.
Categories also accept an OWASP- prefix, so OWASP-LLM01 and LLM01 are equivalent. To list categories at runtime:
Python

Targeting specific vulnerabilities

For more precision, use vulnerabilities instead of categories. This targets individual attack vectors and takes precedence over categories when both are set.
Python
To see all available vulnerability IDs:
Python

Red teaming an Orq agent

When the application is deployed as an Agent in Orq.ai, pass the agent: 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
Pass a list of targets to run several agents in one scan and merge the results into a single report:
Python
To target a Deployment instead, use the deployment: prefix:
Python
Find the agent key in the Agents section of Orq.ai and deployment keys in the Deployments section. See Agents and Deployments for more.

Red teaming an OpenAI model

To test a raw OpenAI model without an agent wrapper, use OpenAIModelTarget, 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 to red_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

The report 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

When ORQ_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:
Each attack is logged as a datapoint with its category, vulnerability, prompt, response, and verdict, so runs can be filtered, compared, and tracked for resistance rate over time.

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:
The dashboard serves on 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
Or as a CLI one-liner, where the exit code gates the build:
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 0 to 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.