Blog/Quality Assurance

AI Red Teaming: What It Is And How to Run It

QA engineer working on laptop

Summarize with:

An AI system that passes its functional tests can still be talked into leaking data, ignoring its instructions, or taking actions it should never take. Standard test cases rarely find these failures, because they check what the system should do, not what a determined person can make it do. AI red teaming closes that gap by attacking your own system on purpose before someone else does. This guide explains what AI red teaming is, what a red team looks for, which frameworks to anchor on, and how to run one step by step, with the metrics, tools, and fixes that follow.

What is AI red teaming?

AI red teaming is structured adversarial testing in which people, often with automated tools, try to make an AI system fail by producing harmful, leaked, or unauthorized behavior, so that weaknesses are found and fixed before real attackers or users find them.

The term comes from military and security practice, where a dedicated team plays the attacker. OWASP describes generative AI red teaming as combining traditional adversarial testing with methods and risks specific to AI. In practice, it joins two skills. Namely, attacking the model's behavior, through prompt injection, jailbreaks, and data extraction, and testing everything around it with classic security methods, such as APIs, cloud infrastructure, and plugins.

Security and safety

A red team usually probes two kinds of failure. Security failures come from an attacker, such as a hidden instruction that makes an assistant leak customer records. Safety failures can happen with an ordinary user, such as harmful advice, biased answers, or confident falsehoods. A complete red team covers both.

AI red teaming vs. penetration testing vs. evaluation

Penetration testing AI red teaming AI evaluation
Core question Can an attacker break into the system? Can someone make the AI system misbehave or be misused? How well does the AI do on defined tasks?
Target Applications, APIs, networks, and infrastructure The model, prompts, data, tools, and connected systems Output quality against metrics
Method Known vulnerability classes and exploits Adversarial creativity: novel prompts, multi-turn manipulation, and attack chains Datasets, metrics, and graders
Repeatability An exploit usually works every time Probabilistic: an attack may succeed only some of the time Scores that vary by run
Typical output Vulnerability report with severity scores Findings with reproduction steps and an impact rating Scores and regression trends

The three practices complement each other. Penetration testing still matters for the infrastructure around the model, and evaluation covers everyday quality. Our guides to LLM evaluation and AI agent evaluation cover the measurement side.

Why AI red teaming matters

  • You cannot list every failure in advance. Inputs are open-ended and outputs vary, so scripted test cases only cover the failures you already imagined.
  • The attack surface is language. Any text the system reads, from users, documents, web pages, or emails, can carry instructions.
  • Failures have real costs. Leaked data, unauthorized actions, harmful or false output, regulatory exposure, and brand damage all follow from weak controls.
  • Standards expect it. NIST's Generative AI Profile (AI 600-1) recommends red teaming, and the EU AI Act requires providers of general-purpose AI models with systemic risk to carry out and document adversarial testing. That duty falls on model providers, but the practice is a sensible baseline for any team that ships AI features.
  • Defenses drift. Models, prompts, tools, and data change, so a system that held up last quarter may not hold up now.

What an AI red team looks for

Attacks fall into a handful of categories. The right-hand column maps each one to the OWASP Top 10 for LLM Applications, which makes a useful scope checklist.

Category What it is Example OWASP LLM Top 10
Direct prompt injection and jailbreaks User input that overrides instructions or bypasses safety rules Roleplay or encoded text that makes a bot ignore its policy LLM01
Indirect prompt injection Instructions hidden in content the system reads A web page or email that tells an assistant to forward data LLM01
Data disclosure and prompt leakage Extracting private data, credentials, or hidden instructions Asking for another customer's record or the system prompt LLM02, LLM07
Excessive agency and tool misuse An agent takes actions beyond what was intended Talking an agent into a refund outside policy LLM06
Improper output handling Model output passed unsafely to other components Output containing a script that a downstream system runs LLM05
Harmful, biased, or false output Unsafe content, unfair treatment, confident falsehoods Different answer quality across user groups, or an invented policy LLM09
Retrieval and data poisoning Tampering with documents or training data to steer output A planted document in a knowledge base LLM04, LLM08
Resource abuse Inputs that drive up cost or exhaust capacity Very long or looping requests LLM10

For agents, the OWASP Top 10 for Agentic Applications 2026 adds risks such as goal hijack and tool misuse, and our guide to testing AI agents shows how to test for them. For false output, see our guide to AI hallucinations in software testing.

Frameworks and standards for AI red teaming

There is no single standard that defines what every AI red team must include. These frameworks give you a shared scope, vocabulary, and reporting structure.

Framework What it gives you Use it to
OWASP Top 10 for LLM Applications, and the Top 10 for Agentic Applications Ranked lists of the most common LLM and agent risks Scope the test and structure findings
OWASP GenAI Red Teaming Guide (January 2025) A practical approach across four areas: model, implementation, system, and runtime, with threat modeling as a key activity Plan the engagement
MITRE ATLAS A knowledge base of adversary tactics and techniques against AI systems, modeled on MITRE ATT&CK Choose attack techniques and use shared names for them
NIST AI RMF (AI 100-1) and the Generative AI Profile (AI 600-1) A risk framework built on Govern, Map, Measure, and Manage, with red teaming under Measure, plus GenAI-specific risk categories Report findings to risk and compliance teams
NIST AI 100-2 E2025 A taxonomy of adversarial machine learning attacks Classify attacks consistently
EU AI Act, Article 55 A duty for providers of general-purpose AI models with systemic risk to carry out and document adversarial testing Know when documented testing is a legal requirement

A mature engagement borrows from several of them: OWASP for scope, MITRE ATLAS for techniques, and NIST for governance and executive reporting.

How to run an AI red team

A red team engagement follows the same loop whether you run it for a day or as a standing program.

  1. Define the scope and what counts as failure. Name the system under test, whether a model, an application, or an agent, and the environment. List the assets to protect, such as data, actions, and reputation. Define failure concretely, for example "a customer record leaves the support assistant." Set rules of engagement for what testers may do, how they handle data, and when they stop.
  2. Build a threat model. Identify who might attack, such as an anonymous user, a customer, the author of a document the system reads, or an insider. Write down what each one wants, what the system can reach through its tools and data, and where untrusted content enters. OWASP recommends threat modeling as a key activity and points to MITRE ATLAS as a reference.
  3. Plan attack scenarios. Write objective-based scenarios for each category in the table above, such as "extract any customer record through the support assistant." Rank them by impact and likelihood so the highest risks get tested first.
  4. Run the attacks. Combine manual exploration with automated tools. Try multi-turn conversations, role-play, encoded or translated text, and instructions hidden in documents. Repeat each attack several times, because the same prompt can succeed on one run and fail on the next. Log every prompt, response, and model version.
  5. Score and triage. Record which attacks succeeded, how often, how severe the impact was, and how easily someone could repeat them.
  6. Report. Write each finding so an engineer can reproduce and fix it, with the steps, the impact, a severity rating, and a suggested mitigation.
  7. Fix and retest. Apply mitigations, rerun the same attacks, and add every successful one to your regression suite.
  8. Repeat. Rerun the program after significant changes to the model, prompts, tools, data, or permissions.
A flow chart showing the stages of a red team engagement

The attack step gets the attention, but the value comes from the last step, where a finding becomes a fix and a permanent regression test.

Who should be on the red team

Mix the skills. Security engineers bring attacker thinking, QA engineers bring test design and reproducibility, ML and prompt engineers understand how the system behaves, and domain experts, such as legal, medical, or financial specialists, know what a harmful answer looks like. Where possible, include people who did not build the system, because builders tend to test the cases they already expect.

Can small teams run an AI red team?

Yes. Pick the three risks that matter most for your product, such as prompt injection, data leakage, and unauthorized actions. Use open-source tools for coverage, add a few hours of manual probing from someone with a security mindset, and put the successful attacks into your CI suite. Widen the scope as you learn.

Manual vs. automated AI red teaming

Approach Strengths Limits Best for
Manual Creative, adapts to the system's replies, finds novel attack chains, and understands business harm Slow, hard to scale, depends on skill, and hard to repeat exactly Novel attacks, high-risk systems, and agent workflows
Automated Broad coverage, repeatable, cheap to rerun, and fits CI Generic probes miss application-specific logic, and automated scoring can be wrong or noisy Baseline coverage and regression testing
Hybrid People design scenarios and chase leads, and tools scale and retest them Needs coordination Most teams

Off-the-shelf probes only test generic weaknesses, so the best programs pair them with custom scenarios built around your system prompt, tools, data sources, and business rules.

Tools you can start with

Several open-source tools cover the automated side:

  • Garak from NVIDIA is an LLM vulnerability scanner that runs large sets of probes for prompt injection, jailbreaks, data leakage, toxicity, and encoding-based attacks.
  • PyRIT from Microsoft is a framework for building automated, multi-turn attacks, and it grew out of the Microsoft AI Red Team's own work.
  • Promptfoo is an evaluation and red teaming command-line tool that tests adversarial cases against assertions and fits into CI pipelines.

Commercial platforms also exist. Whichever you choose, check that it covers the risk categories in your scope, supports your architecture, such as RAG or agents, explains how it scores results, integrates with your pipeline, and handles your data the way your policies require.

Metrics and reporting for AI red teaming

Because attacks succeed probabilistically, report numbers with the number of attempts behind them.

Metric What it measures How to use it
Attack success rate The share of attempts that achieve the attacker's objective Track it per category and per release, and state how many attempts you ran
Coverage The share of risk categories and scenarios you tested Show gaps against your scope, for example the OWASP categories
Severity The impact if an attack succeeds, such as data exposed, actions taken, or harm done Rate every finding, and block releases on critical ones
Reproducibility How reliably someone can repeat an attack Record successes across repeated tries
Time to fix and retest Days from finding to verified fix Shows whether findings actually get resolved
Regression rate Fixed attacks that work again Signals drift after model, prompt, or tool changes

Scoring systems built for software vulnerabilities, such as CVSS, fit AI harms poorly. Many teams add a rubric that weighs the impact, the reach of the system, meaning what it can access or do, and how easy the attack is.

How to write a finding

A good finding lets an engineer reproduce and fix the problem without asking questions. Include:

  • Title and category, mapped to your framework, such as an OWASP risk.
  • Objective and preconditions, meaning what the attacker wanted and what access they had.
  • Reproduction steps, with the exact inputs, the number of attempts, and the number of successes.
  • Observed behavior, including the response and any actions the system took.
  • Impact and severity, in terms the business understands.
  • Suggested mitigation, an owner, and a status.

Red teaming RAG apps and AI agents

QA engineer at a desk working on a laptop

Two kinds of systems need extra attention, because they give an attacker more to work with.

RAG applications

In a retrieval-augmented generation app, the retrieved content is part of the attack surface. Test for:

  • Indirect injection. Plant documents that contain hidden instructions, and check whether the model follows them.
  • Knowledge base poisoning. Check what happens when a document in the index is wrong or malicious.
  • Access control gaps. Verify that a user cannot retrieve documents they are not allowed to see, including through carefully phrased questions.
  • Data leakage across tenants or roles. Probe for information that belongs to someone else.

For how to measure retrieval and answer quality in RAG systems, see our guide to RAG evaluation.

AI agents

Agents add tools, permissions, and multi-step behavior. Test for:

  • Goal hijack and tool misuse. Try to redirect the agent to a new goal, or to call tools out of scope or with unsafe arguments.
  • Privilege escalation. Check whether the agent can reach data or actions beyond what the task needs.
  • Slow-burn attacks. Spread an attack across several turns or steps, because defenses that stop a single prompt may miss a gradual one.
  • Blast radius. Ask what a fully hijacked agent could do, and restrict it until the answer is acceptable.

Our guide to testing AI agents covers the safety layer in more detail, and our guide to AI agent evaluation covers how to measure the results. For customer-facing chatbots, see our AI chatbot testing service. Keep test data safe too, as our guide to test data management explains.

Find the weak spots in your AI before attackers do

TestDevLab's engineers test LLM apps, RAG pipelines, and AI agents for prompt robustness, safety guardrails, and unsafe behavior. You get findings your team can fix and retest.

Fixing what you find

No single control stops every attack on an AI system, so layer your defenses and limit what a successful attack can do.

  • Limit what the system can do. Give tools and data the least privilege each task needs, use scoped credentials, and keep secrets out of the model's context.
  • Require approval for risky actions. Put a person in the loop for anything irreversible, costly, or sensitive.
  • Separate instructions from untrusted content. Mark retrieved and user-supplied text as data, and do not let it change the system's goals. This helps, but it is not foolproof.
  • Treat model output as untrusted. Validate it before it reaches other systems, and filter harmful content on the way out.
  • Harden prompts and architecture. Tighter prompts help, but they are the weakest layer on their own.
  • Monitor and rate-limit. Log prompts, tool calls, and anomalies, alert on suspicious patterns, and cap resource use.
  • Retest. Rerun the exact attacks that worked, add them to your automated regression suite, and rerun the program after every significant change.

Common mistakes in AI red teaming

  • Treating it as a one-time exercise before launch. Models, prompts, tools, and data keep changing.
  • Testing only the model. Most of the risk sits in prompts, retrieval, tools, and permissions.
  • Stopping at jailbreak prompts. Indirect injection and tool abuse often do more damage.
  • Trusting a single run. Attacks are probabilistic, so repeat them and report the success rate.
  • Assuming the model provider already tested it. Provider testing does not cover your prompts, data, and tools.
  • Treating a guardrail product as a replacement. Guardrails reduce risk, and they need testing too.
  • Running automated scans without custom scenarios. Generic probes miss your business logic.
  • Writing vague findings. Without reproduction steps, nobody can fix them.
  • Not retesting. A fix is only a fix when the same attack no longer works.
  • Ignoring privacy while testing. Do not use real customer data in test prompts or logs.

Final thoughts

AI red teaming is how you learn what your system does when someone is trying to break it. Scope it clearly, test the whole application and not only the model, mix human creativity with automated coverage, and turn every finding into a fix and a regression test. If you also use AI agents inside your own QA process, our guide to agentic testing covers the guardrails, and our security testing services cover the wider attack surface.

FAQ

Most common questions

What is AI red teaming?

AI red teaming is structured adversarial testing in which people, often with automated tools, try to make an AI system fail by producing harmful, leaked, or unauthorized behavior, so that weaknesses are found and fixed before real attackers or users find them.

How is AI red teaming different from penetration testing?

Penetration testing looks for known vulnerability classes in applications, APIs, and infrastructure, and an exploit usually works every time. AI red teaming targets how an AI system behaves, including its prompts, data, and tools, and its attacks are probabilistic, so it relies on adversarial creativity and repeated attempts.

How do you run an AI red team?

Define the scope and what counts as failure, build a threat model, plan attack scenarios, run manual and automated attacks several times each, score and report the findings, fix them, and retest. Repeat after significant changes.

What tools are used for AI red teaming?

Open-source options include Garak from NVIDIA, PyRIT from Microsoft, and Promptfoo, and commercial platforms also exist. Pair any tool with custom scenarios built around your own prompts, tools, and data.

Who should be on an AI red team?

A mix of security engineers, QA engineers, ML and prompt engineers, and domain experts, ideally including people who did not build the system.

How often should you red team an AI system?

Before launch, after any significant change to the model, prompts, tools, data, or permissions, and on a regular schedule. Run automated regression attacks continuously in CI.

Is AI red teaming required by law?

Not in general. The EU AI Act requires providers of general-purpose AI models with systemic risk to carry out and document adversarial testing, and NIST's Generative AI Profile recommends red teaming. Other teams should treat it as good practice, and should check their own obligations with legal counsel.

Can small teams or startups do AI red teaming?

Yes. Focus on the top three risks for your product, use open-source tools for coverage, add manual probing from someone with a security mindset, and put every successful attack into your CI suite.

Know how your AI holds up against real attacks

TestDevLab's ISTQB-certified engineers help you scope the risks, test your AI systems, and retest the fixes. You get clear findings that your security and product teams can act on.

Summarize with:

QA engineer having a video call with 5-start rating graphic displayed above

Save your team from late-night firefighting

Stop scrambling for fixes. Prevent unexpected bugs and keep your releases smooth with our comprehensive QA services.

Explore our services