Skip to content

DeepTeam - LLM Red Teaming Framework Cheatsheet

DeepTeam - LLM Red Teaming Framework Cheatsheet

DeepTeam is an open-source LLM red teaming framework built by the team behind DeepEval. It simulates adversarial attacks against your LLM application — prompt injection, jailbreaks, PII leakage, excessive agency, bias — using a library of vulnerabilities and attack enhancements that rewrite a base attack to evade defenses. Its guiding idea is that red teaming should be repeatable and automated, not a one-off manual exercise, so it runs like a test suite in CI.

Red team only systems you own or are authorized to test. Generated attacks are real adversarial inputs.

Installation

MethodCommand
pippip install deepteam
uvuv add deepteam
Model keyexport OPENAI_API_KEY=... (simulator + judge)
Verifypython -c "import deepteam; print('ok')"

Core Concepts

TermMeaning
VulnerabilityA weakness class to probe (e.g. PII leakage)
AttackA technique used to trigger it (e.g. prompt injection)
EnhancementA transform that makes an attack harder to detect
Model callbackYour app, wrapped as a function DeepTeam can call
Risk assessmentThe scored report of what succeeded

Minimal Red Team Run

from deepteam import red_team
from deepteam.vulnerabilities import Bias, PIILeakage
from deepteam.attacks.single_turn import PromptInjection

async def model_callback(input: str) -> str:
    # call YOUR app/model here and return its output
    return await my_llm_app(input)

risk = red_team(
    model_callback=model_callback,
    vulnerabilities=[Bias(), PIILeakage()],
    attacks=[PromptInjection()],
)
print(risk)
ArgumentPurpose
model_callbackAdapter to your system under test
vulnerabilitiesWhat weaknesses to probe
attacksWhich techniques to use
attacks_per_vulnerability_typeVolume of test cases

Vulnerability Categories

CategoryProbes for
PIILeakageLeaking personal data
BiasGender/race/religion/political bias
ToxicityHarmful or abusive output
PromptLeakageSystem prompt disclosure
ExcessiveAgencyTaking unauthorized actions
MisinformationFactual/unsupported claims
IllegalActivityUnsafe instruction compliance
RobustnessHijacking / input overreliance

Attacks & Enhancements

Single-turn attackTechnique
PromptInjectionInjected instructions
RoleplayPersona-based bypass
Base64 / ROT13 / LeetspeakEncoding evasion
MultilingualNon-English bypass
MathProblemObfuscation via framing
Multi-turn attackTechnique
LinearJailbreakingEscalating turns
TreeJailbreakingBranching search for a bypass
CrescendoJailbreakingGradual escalation

Running in CI

# red_team.py — fail the build if high-severity issues appear
risk = red_team(model_callback=cb, vulnerabilities=[...], attacks=[...])
assert risk.overall_score >= THRESHOLD, "Red team failures detected"
PracticeWhy
Pin a scenario setComparable results across runs
Gate on severityBlock only on high-risk regressions
Store reportsTrack posture over time
Re-run on prompt changePrompts are the control surface
AspectDeepTeamgarakPyRITpromptfoo
LayerApplicationModelModel + multi-turnApplication
StylePythonic suiteCLI scannerOrchestration SDKConfig + CLI
Multi-turnYesLimitedStrongYes
Best forApp-level automated red teamingBroad model probesComplex attack researchCI eval + red team

Complements garak (model-layer probes) and promptfoo (eval + CI); run more than one — they catch different failures.

Resources