Skip to main content

Multiple Red Teaming Modes

The dtx framework supports three flexible modes for running red team evaluations against language models. Each mode is designed for different levels of controlβ€”from beginner-friendly guided runs to fully customizable YAML-based test workflows.

Mode Comparison​

ModeDescriptionBest For
Guided RunInteractive CLI wizard for setting up testsBeginners, fast demos
Direct RunCommand-line based execution using flags (--agent, --dataset, etc.)Developers, quick iterations
Advanced RunFull YAML pipeline: scope β†’ plan β†’ executionTeams, reproducible audits

Red Teaming Modes

Red Teaming Modes

β”œβ”€β”€ 1. Guided Run
β”‚ └── dtx redteam quick
β”‚ - Interactive wizard
β”‚ - Choose agent, dataset, evaluator
β”‚
β”œβ”€β”€ 2. Direct Run
β”‚ └── dtx redteam run --agent <AGENT> --dataset <DATASET> [--eval <EVALUATOR>] [--url <MODEL>] [--keywords <KEYWORDS>]
β”‚ β”œβ”€β”€ Example 1 (Airbench + IBM Eval):
β”‚ β”‚ dtx redteam run --agent echo --dataset airbench --eval ibm38
β”‚ β”œβ”€β”€ Example 2 (Garak with built-in evaluator):
β”‚ β”‚ dtx redteam run --agent echo --dataset garak
β”‚ β”œβ”€β”€ Example 3 (Keyword match):
β”‚ β”‚ dtx redteam run --agent echo --dataset beaver --eval any --keywords research
β”‚ β”œβ”€β”€ Example 4 (HF model with evaluator):
β”‚ β”‚ dtx redteam run --agent hf_model --url arnir0/Tiny-LLM --dataset beaver --eval ibm38
β”‚ β”œβ”€β”€ Example 5 (OpenAI model with Stringray):
β”‚ β”‚ dtx redteam run --agent openai --url gpt-4o --dataset stringray
β”‚ └── Example 6 (Groq with LLaMA Guard model):
β”‚ dtx redteam run --agent litellm --url groq/llama-3.1-8b-instant --dataset stringray
β”‚
└── 3. Advanced Run (Scope β†’ Plan β†’ Run)
β”œβ”€β”€ Step 1: Generate a scope file
β”‚ dtx redteam scope "test" test_scope.yml
β”œβ”€β”€ Step 2: Generate a plan from scope
β”‚ dtx redteam plan test_scope.yml test_plan.yml --dataset stringray
└── Step 3: Run the plan
dtx redteam run --plan_file test_plan.yml --agent openai --url gpt-4o

πŸ”§ Before You Run with Real Models​

To run tests with providers like OpenAI, Groq, or Detoxio, make sure to create a .env file with your API credentials:

cp .env.template .env

Then open .env and fill in your keys, for example:

OPENAI_API_KEY=your-key
GROQ_API_KEY=your-key
HF_TOKEN=your-huggingface-token
LANGSMITH_API_KEY=your-key

πŸ”‘ Where to Get API Keys​

ServicePurposeGet API Key Link
OpenAIRun models like gpt-4, gpt-4ohttps://platform.openai.com/account/api-keys
GroqAccess fast LLaMA-3, Mistral modelshttps://console.groq.com/keys
DetoxioUse Detoxio evaluators & policy LLMshttps://platform.detoxio.ai/api-keys
Hugging FaceAccess gated models/datasetshttps://huggingface.co/settings/tokens
LangChain Hub / LangSmithUse prompt templateshttps://smith.langchain.com/settings