Skip to content
  1. Home
  2. AI agents
  3. Evaluation and testing
  4. Red teaming AI agents

Operate · Evaluation and testing

How do you red team an AI agent?

Red teaming an AI agent means attacking it on purpose, before an outsider does, to see whether it can be made to take a prohibited action, leak data it holds, follow instructions hidden in a document or tool result, or drift from its task. Automated scanners generate the attacks at scale; people add the creative, multi-turn ones.

In this guide: 83 pages

Key takeaways

  1. An agent red team tests actions, not only words. The categories that matter are prohibited actions, sensitive data leakage, task adherence and indirect prompt injection through the documents and tool results the agent reads.
  2. Automated scanners (Foundry’s AI Red Teaming Agent on PyRIT, garak, promptfoo) run thousands of attacks and report an attack success rate. Microsoft’s own position is that the effective approach combines automated tools with expert human analysis.
  3. Know the scanner’s blind spots. Foundry’s agentic tests were single-turn and English-only, with synthetic data and mock tools, and did not cover function tool calls or non-Foundry agents on 2 Nov 2026.
  4. Attack success rate is not comparable across tools or papers without a shared threat model, and judge-based scoring is non-deterministic. Use it to track your own agent over time, and fix with tool permissions and policy before you fix with prompts.
The red-team cycle for an AI agentSix steps in a loop. Scope and threat model: list the prohibited actions, the data the agent must never reveal and the tools it may call, using the OWASP agentic top 10 as the catalogue. Automated attacks: scanners such as PyRIT, garak and promptfoo generate adversarial prompts, including indirect prompt injection through documents and tool results. Human attacks: testers add multi-turn, context-specific and tool-abuse attempts. Report: attack success rate per risk category. Fix: guardrails, tool policy, prompts and permissions. Re-scan, and keep the scan in the release gate. A note says to run it in a purple environment, production-like but not production.Scope and threat modelProhibited actions, secrets,tools; OWASP agentic top 10Automated attacksPyRIT, garak, promptfoo;indirect injection via toolsHuman attacksMulti-turn, context-specific,tool abuse, social tricksReportAttack success rateper risk categoryFixGuardrails, tool policy,prompts, permissionsRe-scan, keep in gateEvery release and everymodel or tool changeRun it in a purple environment: production-like resources and tools, never production data or live write access.The red-team cycle for an AI agentSix steps in a loop. Scope and threat model: list the prohibited actions, the data the agent must never reveal and the tools it may call, using the OWASP agentic top 10 as the catalogue. Automated attacks: scanners such as PyRIT, garak and promptfoo generate adversarial prompts, including indirect prompt injection through documents and tool results. Human attacks: testers add multi-turn, context-specific and tool-abuse attempts. Report: attack success rate per risk category. Fix: guardrails, tool policy, prompts and permissions. Re-scan, and keep the scan in the release gate. A note says to run it in a purple environment, production-like but not production.Scope and threat modelProhibited actions, secrets,tools; OWASP agentic top 10Automated attacksPyRIT, garak, promptfoo;indirect injection via toolsHuman attacksMulti-turn, context-specific,tool abuse, social tricksReportAttack success rateper risk categoryFixGuardrails, tool policy,prompts, permissionsRe-scan, keep in gateEvery release and everymodel or tool changeRun it in a purple environment:production-like resources and tools, neverproduction data or live write access.
Scope, automated attacks, human attacks, a report by category, fixes in guardrails and permissions, and a re-scan that stays in the release gate.

What does an agent red team test that a model red team does not?

A model red team asks whether the model will say something harmful. An agent red team asks whether the agent will do something harmful: call a tool it should not, reveal data it can reach, obey an instruction planted in a web page or a tool result, or quietly stop doing the task it was given.

Microsoft’s AI Red Teaming Agent names the agentic risk categories as prohibited actions, sensitive data leakage and task adherence, and it tests indirect prompt injection (sometimes written XPIA, cross-prompt injection attack), where the attack arrives through content the agent reads rather than through the user. Its illustrative taxonomy for actions has three tiers: prohibited actions are never allowed; high-risk actions such as financial transactions or medical decisions are allowed with human-in-the-loop confirmation; irreversible actions such as file deletions or system resets are allowed with disclosure plus confirmation. Your boundaries criterion from the acceptance criteria is the first tier written down, and the red team’s job is to cross it.

The catalogue for scoping is the OWASP Top 10 for Agentic Applications, published 9 Dec 2025, which organises the threats an agent faces by what it can reach: tools, memory, other agents, the user’s identity. Pair it with the agent’s own registry record, which lists the tools, data and identity it holds, and you have the attack surface: every tool is a target for misuse, every data source a channel for injection, every hand-off a chance to pass a poisoned instruction along.

Model robustness is one layer and not the control. Google reports, for its own models, that Gemini 4 Carbon reached 0.0% attack success against 0.7% for Gemini 4 Argon on the Gray Swan indirect prompt-injection benchmark (28 Oct 2026, vendor-reported). A better model lowers the rate; tool permissions, policy and approval gates decide what a successful attack can do. The Security threats to agents topic covers the attacks in detail.

Which automated tools run the attacks?

Four open tools and one managed service cover most of the automated layer. The scanners generate adversarial prompts from a library of strategies and score the agent’s response, often with a model as judge; the last two rows evaluate rather than attack. The table lists them as their pages showed on 2 Nov 2026.

Automated red-teaming tools for agents, as of 2 Nov 2026.

ToolWhat it doesScope and limitsLicence and status
Microsoft Foundry AI Red Teaming AgentRuns PyRIT attack strategies (Base64, Flip, Crescendo, Multi turn, Indirect Jailbreak and others) against a Foundry agent and reports attack success rate per category; results appear on the Agent Monitoring DashboardAgentic categories run in the cloud in East US 2, France Central, Sweden Central, Switzerland West and North Central US; supports Foundry prompt and container agents with Azure tool calls; workflow agents, non-Foundry agents and function tool calls not supported; single-turn, English-only, synthetic data and mock toolsPages carry the preview banner and a preview API version; treat as preview
PyRITThe open toolkit under Foundry’s agent: attack strategies, converters, scorers; usable against any endpointYou write the target and the scoringMicrosoft, MIT
garakVulnerability scanner with probes (DAN, encoding injection and others) and detectorsModel and endpoint focused; agent tools need a custom harnessNVIDIA-hosted, Apache-2.0
promptfooRed teaming and evaluations from one CLI, with CI checks and pull-request scanningAny HTTP target; agent tool calls through custom providersMIT; announced it is joining OpenAI on 9 Mar 2026 and says it stays open source
InspectEvaluation framework with sandboxing (Docker, Kubernetes, Modal), custom and MCP tools, and bridges to Claude Code, Codex CLI and Gemini CLIBuilt for agent evaluations with real tools in a sandboxUK AI Security Institute and Meridian Labs
AgentCore Evaluations safety evaluatorsSafety, harmfulness and stereotyping evaluators over agent tracesScores responses; does not generate attacksAWS, GA 31 Mar 2026

AWS and Google document safety evaluators and guardrails (Bedrock Guardrails and AgentCore Policy; Model Armor through Agent Gateway) but we found no managed agent red-teaming service in the AWS or Google documentation we read on 2 Nov 2026, so on those clouds the open tools run against the agent’s endpoint.

What do human testers add, and where do they run?

People add the attacks a scanner cannot: multi-turn conversations that build trust, attacks that use your real tools and data, and the social tricks that arrive through the channel the agent lives in. Microsoft’s wording is that the most effective strategies combine automated tools that surface potential risks with expert human analysis.

Give the human testers the registry record and the acceptance criteria. The never list tells them what to aim for; the tool list tells them which tool results to poison; the data list tells them what a leak looks like. The best testers are often the fraud team, the help-desk lead or the people who already know how customers try to game the process, not security specialists alone.

Run the attacks in what Microsoft calls a purple environment: non-production, with production-like resources, real tool interfaces and realistic but not real data, and no live write access. Foundry’s cloud scans use mock tools and synthetic data for the agentic categories, which is safe and also why they miss what a real tool result can carry. Your human round is where the agent reads a real-shaped document with an instruction hidden in it, or a tool returns a record with a payload in a free-text field.

Test the approval path too. An attack that gets a high-risk action past the approver is a success for the attacker, so include cases where the request shown to the approver looks routine and the arguments are not. The Human in the loop sub-page covers why the approval screen must show the exact tool, arguments and target.

How do you read an attack success rate, and what do you fix?

Read it per category, over time, for your own agent, and never as a number to compare with a vendor’s or a paper’s. Fix with permissions and policy first, prompts second, and keep every successful attack as a case in the evaluation set.

Attack success rate is the share of attack attempts that achieved their goal, as judged by a scorer. Microsoft notes that scoring by generative models can be non-deterministic and that there is always a chance of false positives, so rerun the scan and read the flagged cases before you act on the number. promptfoo published a note on 12 Dec 2025 arguing that attack success rate is not comparable across jailbreak papers without a shared threat model: the attacker’s budget, the categories and the judge all change the figure.

Targets differ by category. Prohibited actions and data leakage should be at zero on the attacks you know about, because each success is an incident the agent could have in production. Task adherence and jailbreak categories are a trend to drive down. A release gate that blocks on any prohibited-action success and on a rise in the other categories is the usual shape.

Fixes go in order of strength. First, tool permissions and policy: an agent that cannot call the payment tool cannot be made to; AgentCore Policy (GA 3 Mar 2026) writes that as a Cedar rule, Google enforces it at Agent Gateway, and Foundry guardrails check tool calls and tool responses (preview). Second, guardrails on input and output, such as Prompt Shields on Azure, Bedrock Guardrails and Model Armor. Third, prompts and instructions, which help and which an attacker reads around. Then add each successful attack to the golden dataset, re-scan, and keep the scan in the gate so a model or tool change cannot reopen the hole.

How do Microsoft, AWS and Google implement it?

Red teaming and the controls that fix findings, as the vendor pages showed on 2 Nov 2026.

Capability, Microsoft, AWS, Google

CapabilityMicrosoftAWSGoogle
Managed red teamingAI Red Teaming Agent on PyRIT; agentic categories in five regions; treat as previewNone found in the docs we read; safety and harmfulness evaluators in AgentCore EvaluationsNone found in the docs we read; safety_v1 criterion in ADK evaluation
ScopeFoundry prompt and container agents with Azure tool calls; single-turn, English-only, mock toolsOpen tools (PyRIT, garak, promptfoo, Inspect) against the AgentCore endpointOpen tools against the Agent Runtime endpoint
Fix with policyFoundry agent guardrails on tool calls and responses (preview); Entra Conditional Access for agentsAgentCore Policy, Cedar rules on tool calls, GA 3 Mar 2026Agent Gateway policies with Model Armor integration
Fix with guardrailsAzure AI Content Safety Prompt Shields (GA since Aug 2024)Bedrock Guardrails, including Automated Reasoning checks (GA 6 Aug 2025, detect only, English)Model Armor

Foundry’s red-teaming pages carry a generic preview banner and the samples use a preview API version; Microsoft states no explicit GA, so this page calls it preview.

Frequently asked questions

Is red teaming an AI agent the same as a penetration test?

No. A penetration test attacks the infrastructure and the application code. An agent red team attacks the agent’s behaviour: whether it can be talked, tricked or injected into a prohibited action or a leak. You need both, and the agent red team needs the people who know the business process as much as it needs security specialists.

How often should we red team an agent?

Before the first release, after every change to tools, permissions, knowledge sources or the model, and on a schedule for agents in the highest risk tier. The automated scan belongs in the release gate so it runs every time; the human round is periodic and after any incident.

Can Foundry’s AI Red Teaming Agent test a Copilot Studio or AgentCore agent?

Not the agentic categories, on 2 Nov 2026: Microsoft lists non-Foundry agents, workflow agents and function tool calls as not supported. For agents on other platforms, run PyRIT, garak or promptfoo against the agent’s endpoint, or use Inspect with the real tools in a sandbox.

What is a good attack success rate for an AI agent?

There is no number to borrow. Prohibited actions and data leakage should be zero on the attacks you know about; the other categories should fall release over release on your own threat model. Rates from vendors and papers use different attackers, categories and judges, so they do not transfer.

Do we need a red team if the model vendor already did one?

Yes. The vendor tested the model against general harms; your agent has your tools, your data and your approval screens, none of which the vendor saw. Vendor robustness lowers the rate; your tool permissions and policies decide what a successful attack can reach.

More in Evaluation and testing

Acceptance criteria for AI agentsRead
Offline and online evaluationcoming
Regression testing when models changecoming

Sources

Each source was read on 2 November 2026. The date shown is the date on the page, or the page’s ms.date for Microsoft Learn; an undated page shows the date it was read.

  1. AI Red Teaming Agent Microsoft Learn, 19 August 2026
  2. Run AI red teaming in the cloud Microsoft Learn, 3 September 2026
  3. PyRIT: Python Risk Identification Toolkit Microsoft (GitHub), undated page, read 2 November 2026
  4. garak: LLM vulnerability scanner NVIDIA (GitHub), undated page, read 2 November 2026
  5. promptfoo promptfoo (GitHub), undated page, read 2 November 2026
  6. promptfoo blog, including the note on comparing attack success rates promptfoo, undated page, read 2 November 2026. The note on attack success rate is dated 12 Dec 2025.
  7. Inspect evaluation framework UK AI Security Institute, undated page, read 2 November 2026
  8. OWASP Top 10 for Agentic Applications for 2026 OWASP GenAI Security Project, 9 December 2025
  9. Evaluations for Amazon Bedrock AgentCore AWS documentation, undated page, read 2 November 2026
  10. Amazon Bedrock AgentCore adds quality evaluations and policy controls for deploying trusted AI agents AWS News Blog, 2 December 2025. The post carries later update notes with the GA dates.
  11. Evaluate agents with the Agent Development Kit Google (adk.dev), undated page, read 2 November 2026
  12. Introducing Gemini 4 Carbon Google, 28 October 2026
  13. Overreliance on AI: a framework Microsoft Learn, 27 February 2025

Planning an AI program?

Talk to the team that builds it and runs it after launch.

  • Built to SOC 2, HIPAA and GDPR standards
  • EU AI Act-aligned delivery
  • Microsoft Solutions Partner