LLM red-teaming guide: how to test an AI app step by step
LLM red teaming is a structured, adversarial exercise in which you deliberately try to break or misuse an AI application — through its prompts, retrieved content, tool calls, and surrounding code — to surface weaknesses before real attackers do (Microsoft — Planning red teaming for LLMs). With autonomous agents, the question shifts from "what can an attacker do to our app?" to "what can an attacker do through our app when an LLM is inside it?" (CyberGuards — AI Red Teaming). AgentRedTeam automates a portion of this as continuous simulation/scanning; the guide below is the human-led shape it is modelled on. See also the secure AI agent deployment checklist.
1. Scope the system (threat model)
Start by mapping what the agent can actually do, not what you hope it does.
- Tools & permissions — what can the model invoke (web browse, code exec, file read/write, email, DB, APIs)? What is the worst realistic outcome if one is abused?
- Data boundaries — what can it read, write, or transmit? Where does that data come from (trusted vs retrieved)?
- Users & trust levels — external unauthenticated users, authenticated end users, privileged users, and third-party content the model retrieves (emails, web pages, docs).
- Blast radius — if the agent is hijacked, what systems can it reach, and with whose credentials?
This scoping step is what separates AI red teaming from a traditional pentest (CyberGuards).
2. Recruit and brief the red team
Microsoft's guidance stresses a diverse team with both benign and adversarial mindsets (Microsoft — Planning AI red teaming). Ordinary users surface harms that security engineers miss; security SMEs probe jailbreaks, system-prompt extraction, and cyberattack content. Assign people to specific harms or features, give clear objectives, and record findings reproducibly (date, input/output pair ID, prompt, output).
3. Run the test categories
A modern engagement covers roughly eight categories, mapped to the OWASP LLM Top 10 (2025):
- Direct prompt injection — instruction override, role assumption, system-prompt elicitation, output coercion.
- Indirect prompt injection — crafted documents, web pages, emails ingested through the realistic path.
- Sensitive-information disclosure — system-prompt extraction, training-data fragments, other users' context, embedding-store content.
- Improper output handling — does downstream code treat model output as untrusted? (XSS, SQLi, command injection.)
- Excessive agency / tool abuse — what can the model be coerced into calling, with what parameters, in what chains?
- Vector & embedding weaknesses — retrieval-boundary correctness across tenants, source-poisoning resilience.
- Misinformation & harmful content — can it be coerced into policy-violating output?
- Unbounded consumption — cost amplification, denial of service via expensive prompts.
For each attempt, log the exact input, the model response, and whether the guardrail was bypassed. Track a bypass rate, but weight by severity of the successful bypass, not just count (Aquilax — AI Red Teaming).
4. Report and turn findings into regression tests
The deliverable is a pentest-style report plus a reusable adversarial corpus your team can run in CI as regression tests (CyberGuards). Because LLM output is probabilistic, the same prompt may behave differently across runs — so fix the system (scopes, allowlists, human-in-the-loop gates), not just the one evil output. Red Hat frames this as "AI safety as code": generate adversarial cases, attempt jailbreaks, evaluate guardrail effectiveness, repeat (Red Hat — building trust through AI red teaming).
5. Where AgentRedTeam fits (honestly)
AgentRedTeam runs automated adversarial simulations against your agent and returns a prioritized vulnerability report. It is built to give you the repeatable, CI-friendly corpus and the first-pass coverage that a human red-team kickoff provides. It is not a replacement for a skilled human red team or a certified penetration test, and it does not guarantee every vulnerability is found. Use it to start the loop; graduate to human-led testing for high-stakes paths. Also see AI agent security risks for the failure classes it probes.