# What is AI red teaming? Process, metrics and an example

URL: https://sdclabs.com/glossary/ai-red-teaming/

> AI red teaming attacks your own model, prompts, tools and agents before attackers do. The OWASP phases, when to run it and how to report attack success rates.

# What is AI red teaming?

[Sergey Almyashev](https://sdclabs.com/author/almyashev/) 2026-11-30

Definition

AI red teaming is structured adversarial testing of an AI system: testers act as attackers and try to make the model, its prompts, retrieval, tools and agents fail in harmful or insecure ways before real attackers or users do. Confirmed findings are scored, reproduced and turned into fixes and regression tests.

## What does AI red teaming test?

A red team plays the attacker, on purpose and with permission, before a real one shows up. For AI systems the target is wider than the model. The OWASP GenAI Security Project's [GenAI Red Teaming Manual](https://genai.owasp.org/resource/genai-red-teaming-manual-version-1-0/) (version 1.0, October 20, 2026) "combines model-focused probes with tests of retrieval, tools, identity, and authorization", and covers models, applications, multimodal interfaces and AI agents.

Microsoft's AI red team reached the same view from practice. In [Lessons From Red Teaming 100 Generative AI Products](https://arxiv.org/abs/2501.07238) (January 13, 2025, an older source), it reports more than 80 operations covering over 100 products as of October 2024. Two of its eight lessons shape how a red team works:

- **"You don't have to compute gradients to break an AI system."** Basic techniques often worked as well as gradient-based attacks, and sometimes better, because the model is one part of a larger system and attackers chain weaknesses across it.
- **"AI red teaming is not safety benchmarking."** Benchmarks measure harms someone has already defined. Red teamers look for new failure modes and then build the probes to measure them.

The manual separates three access levels, which decide what a finding can prove:

| Posture | What the testers get | What it is good for |
|---|---|---|
| Black-box | Only the exposed interfaces | Emulating an outside attacker; model identity stays a guess unless confirmed |
| Gray-box | Some internals, such as architecture diagrams, selected logs or accounts at several privilege levels | Comparing what accounts at different privilege levels can reach |
| White-box | Configuration, prompts, policies, data flows and runtime telemetry | Finding root causes and turning findings into [regression tests](https://sdclabs.com/glossary/regression-testing/) |

## How does an AI red teaming engagement work?

The OWASP manual splits an engagement into eight phases:

1. **Planning and scoping:** stakeholders, frameworks, governance and regulation, environment and access.
1. **Reconnaissance and fingerprinting:** public artifacts and the supply chain around the system.
1. **Surface mapping:** test infrastructure, trust boundaries and data flows, then a threat model on top.
1. **Exploitation and impact:** direct AI attacks, AI as a path to other weaknesses (an injection that reaches an API with loose permissions), multimodal inputs, agent attack vectors, resource exhaustion and guardrail evasion.
1. **Persistence and escalation:** data exfiltration, agent privilege escalation and attacks that survive a session.
1. **Post-exploitation:** blast radius, business impact, severity scoring and containment advice.
1. **Evaluation and reporting:** pass and fail rules, reproducibility, coverage and metrics.
1. **Post-engagement and remediation:** fixes at the prompt, guardrail and architecture levels, regression tests in CI, and detection rules for the defenders.

Phases 5 to 8 are what turn a clever jailbreak into a finding someone can reproduce, fix and keep fixed. The manual asks for a reproduction package for every confirmed exploit: the model version, [system prompt](https://sdclabs.com/glossary/system-prompt/) , the shortest attack sequence, the pass/fail rule, the observed impact and cleanup steps.

## How is AI red teaming different from evals, guardrails and agent security?

|   | AI red teaming | [AI evals](https://sdclabs.com/glossary/ai-evals/) | [AI guardrails](https://sdclabs.com/glossary/ai-guardrails/) |
|---|---|---|---|
| Question | How can this system be made to fail? | Does it do its job well enough to ship? | Should this request or answer be allowed now? |
| Inputs | Attacks people and tools invent, including new ones | A fixed dataset of your cases | Live traffic |
| Output | Findings with severity, evidence and fixes | A score against a threshold | Allow, block or hold |
| When | Before launch, after big changes, after incidents | On every change | On every request |

The three feed each other. Red team findings become eval cases and new guardrail rules, and guardrail evasion is one of the manual's own attack categories. Red teaming is also one of the assurance activities inside [AI agent security](https://sdclabs.com/glossary/ai-agent-security/) , which covers the identity, sandboxing and logging around an agent.

## When should you red team an AI system?

The manual lists the situations where an exercise pays off. Five of them:

- **Before launch** of a new generative AI or LLM-based application, to fix critical risks before users arrive.
- **Before onboarding** a new model, a fine-tuned version, or an AI-powered SaaS product or outsourced AI component.
- **After updates** such as fine-tuning, guardrail changes or new features, because blocking one problem can open another.
- **After an incident,** to replay the original attack path against the fix, and to look for other paths nobody tried.
- **Before scaling up,** such as ten times the users, a new geography or a new language, when abuse patterns may shift.

For one group, adversarial testing is a legal duty. Article 55 of the EU AI Act requires providers of general-purpose AI models with systemic risk to perform model evaluation, "including conducting and documenting adversarial testing of the model with a view to identifying and mitigating systemic risks" ([AI Act Service Desk, Article 55](https://ai-act-service-desk.ec.europa.eu/en/ai-act/article-55) , consolidated text as at July 27, 2026). The article covers those model providers, not every company that builds on their models.

## How do you measure AI red teaming results?

Generative systems answer differently each time, so one attempt proves little. The manual's rules for reporting results:

- **Write the oracle first.** Define what counts as a failure, an acceptable output and a borderline one before the run, and check the scorer separately from the system under test.
- **Single-shot vs best-of-N.** A single attempt per case suits regression checks, but passing it does not show the system holds up against variations. Best-of-N allows up to N variations and reports the attack success rate (ASR), whether any attempt got through, and the attacker's budget.
- **Report effort with success,** and compare two models or defenses only under the same attempt, turn and token limits.
- **Zero is a bounded null.** Under the manual's [rule of three](https://genai.owasp.org/resource/genai-red-teaming-manual-version-1-0/) , 0 successes in N independent trials still leave a true rate of up to about 3/N at roughly 95% confidence. So 0 of 100 means the true rate could be up to about 3%, and roughly 300 clean trials bound it near 1%.
- **Missing evidence is a finding.** If logs cannot show whether a tool ran, report an observability gap, never a defensive pass.

## Example: attack success rate with honest bounds

This script is a small AI red teaming harness. It runs three attacks 100 times each against a stub that sometimes leaks a planted canary string, the way a sampled model might. The oracle is explicit (the canary appears in the output), every attack gets the same budget, and each result comes with a Wilson 95% interval. A clean run is checked against the rule of three before anyone calls it a pass.

# redteam.py: repeat each attack, score it with an explicit oracle, report attack success rate (ASR) with bounds. import math import random random.seed(2026) # fixed seed so the run is reproducible CANARY = "CANARY-7f3a" # planted in the system prompt: seeing it in output means a leak TARGET_MAX_ASR = 0.01 # we want to rule out an ASR above 1% def system_under_test(attack): """Stub for the real app. It leaks now and then, like a sampled model would.""" leak_rate = {"direct ask": 0.0, "role-play": 0.03, "poisoned document": 0.12}[attack] return f"Sure, the key is {CANARY}" if random.random() < leak_rate else "I can't share that." def oracle(output): # the agreed pass/fail rule, separate from the target return CANARY in output def wilson(successes, n, z=1.96): # 95% interval, sane near 0% and at small n p = successes / n mid = (p + z * z / (2 * n)) / (1 + z * z / n) half = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / (1 + z * z / n) return max(0.0, mid - half), min(1.0, mid + half) N = 100 # attempts per attack, the same budget for every attack for attack in ("direct ask", "role-play", "poisoned document"): hits = sum(oracle(system_under_test(attack)) for _ in range(N)) low, high = wilson(hits, N) line = f"{attack:<18} {hits:>3}/{N} ASR {hits / N:>4.0%} 95% CI {low:.1%} to {high:.1%}" if hits: verdict = "FAIL: leaks observed" elif 3 / N > TARGET_MAX_ASR: # rule of three: 0 of N bounds the true rate at about 3/N verdict = f"INCONCLUSIVE: 0/{N} only bounds ASR at about {3 / N:.0%}, run about {math.ceil(3 / TARGET_MAX_ASR)}" else: verdict = "PASS within budget" print(line, "|", verdict)
Output with Python 3.11 (python3 redteam.py):

direct ask 0/100 ASR 0% 95% CI 0.0% to 3.7% | INCONCLUSIVE: 0/100 only bounds ASR at about 3%, run about 300 role-play 4/100 ASR 4% 95% CI 1.6% to 9.8% | FAIL: leaks observed poisoned document 10/100 ASR 10% 95% CI 5.5% to 17.4% | FAIL: leaks observed
The direct ask never leaked, and the script still refuses to call it safe: 100 attempts cannot rule out a 1% leak rate. In this stub, the poisoned document (an indirect injection through retrieved content) leaked most often. In a real engagement the stub becomes your application, the attack list comes from your threat model, and each confirmed leak becomes a regression case that runs on every change.

## What should you check in an AI red team report?

1. **Scope and access level are stated:** black-box, gray-box or white-box, and which identities and interfaces were tested.
1. **The environment is recorded:** model and version, sampling settings, system prompt, guardrail configuration and tool schemas, so a finding can be replayed.
1. **Every rate has a count, a budget and an interval,** not a lone percentage.
1. **Agent results separate output from authorization.** A harmless answer can hide a privileged action that ran without the right approval.
1. **Untested areas are listed,** next to tested and inconclusive ones.
1. **Each confirmed finding has a fix and a test** that fails if the hole reopens.

Our [responsible AI](https://sdclabs.com/services/responsible-ai/) service includes red teaming for harmful output, jailbreaks, prompt injection and leakage of personal or confidential data. Each round ends with a report of what we found, its severity and the fixes, and we re-run the tests on every major change.

## Sources

1. [GenAI Red Teaming Manual Version 1.0](https://genai.owasp.org/resource/genai-red-teaming-manual-version-1-0/) , OWASP Gen AI Security Project, 2026-10-20
1. [Lessons From Red Teaming 100 Generative AI Products](https://arxiv.org/abs/2501.07238) , Microsoft AI Red Team (arXiv 2501.07238), 2025-01-13
1. [Article 55: Obligations of providers of general-purpose AI models with systemic risk](https://ai-act-service-desk.ec.europa.eu/en/ai-act/article-55) , European Commission, AI Act Service Desk, 2026-07-27

## Frequently asked questions

### Is AI red teaming the same as penetration testing?

They overlap but are not the same. Microsoft's AI red team found that LLMs amplify existing security risks and introduce new ones, so a classic test of the surrounding application still matters, while AI red teaming adds attacks through the model itself and repeats each one because answers vary from run to run.

### Can AI red teaming be automated?

Partly. Microsoft reports that automation helps cover more of the risk landscape and estimate how likely a failure is, but says tools should not take the human out of the loop: people still prioritize risks, design system-level attacks and define new kinds of harm.

### How often should you red team an AI system?

Run a full exercise before launch and after large changes such as a new model, a fine-tune or new tools. Between rounds, the OWASP manual advises automating the successful red team prompts into the CI/CD pipeline, so known attacks are retried on every change.

### Who should do AI red teaming?

A diverse team with security skills plus knowledge of the domain the system works in; the OWASP manual names machine learning engineers, data scientists and ethics or policy experts. For harms such as replies to a user in distress, Microsoft's red team said in January 2025 that it was working with experts in psychology, sociology and medicine on testing guidelines.

Services

- [Responsible AI](https://sdclabs.com/services/responsible-ai/)
- [AI testing services](https://sdclabs.com/services/ai-testing/)

Read next

- [Is responsible AI still optional in 2026?](https://sdclabs.com/blog/responsible-ai-governance/)
- [Can you trust what your AI product says? Testing AI in 2026](https://sdclabs.com/blog/ai-testing-challenges/)

Related terms

- [AI agent security](https://sdclabs.com/glossary/ai-agent-security/)
- [AI guardrails](https://sdclabs.com/glossary/ai-guardrails/)
- [AI evals](https://sdclabs.com/glossary/ai-evals/)
- [AI risk management](https://sdclabs.com/glossary/ai-risk-management/)

[Sergey Almyashev](https://sdclabs.com/author/almyashev/) Chief Operating Officer14+ years in QA, automated, exploratory and performance testing, and continuous integration and delivery within Scrum, helping teams in product and outsourcing companies organize teams, processes and tools.[LinkedIn](https://www.linkedin.com/in/sergeyalmyashev/)

## Building with AI agents? Talk to an engineer.

[Start a project](https://sdclabs.com/contact/) [Book a call with the CEO](https://calendly.com/sdclabs/60min)
