Red-team package reference
Source: core repository guide, snapshot
e58778bef40b. Synced 2026-10-24. Package versions are independent of milestone labels.
Red team adversarial security testing for ArtemisKit LLM evaluation toolkit.
Installation
Section titled “Installation”npm install @artemiskit/redteam# orbun add @artemiskit/redteamOverview
Section titled “Overview”This package provides adversarial testing capabilities to identify vulnerabilities in LLM-powered applications:
- Prompt Injection - Test resistance to instruction override attacks
- Jailbreak Attempts - Test guardrail bypass techniques
- Data Extraction - Probe for system prompt and training data leakage
- Hallucination Triggers - Test factual accuracy under adversarial prompts
- PII Disclosure - Test for unauthorized personal data exposure
- OWASP LLM Top 10 - Comprehensive security testing aligned with OWASP guidelines
- Agent Attacks - Test agentic AI systems for identity confusion, tool abuse, and memory poisoning
Most users should use the @artemiskit/cli for red team testing:
# Basic red team testingartemiskit redteam my-scenario.yaml --count 5
# OWASP LLM Top 10 testingartemiskit redteam my-scenario.yaml --owasp LLM01,LLM05artemiskit redteam my-scenario.yaml --owasp-full
# Agent-specific testingartemiskit redteam my-scenario.yaml --mutations agent-confusion,tool-abuse --agent-detection traceFor programmatic usage:
import { RedTeamGenerator } from '@artemiskit/redteam';
const generator = new RedTeamGenerator();
// Generate mutated versions of a promptconst mutatedPrompts = generator.generate(basePrompt, 10);
// Each result contains:// - original: the original prompt// - mutated: the mutated prompt// - mutations: array of mutation names applied// - severity: 'low' | 'medium' | 'high' | 'critical'
// Apply a specific mutationconst mutated = generator.applyMutation(prompt, 'role-spoof');
// List available mutationsconst mutations = generator.listMutations();How It Works
Section titled “How It Works”The red team module applies mutations to prompts to test LLM robustness:
- Takes a base prompt from your scenario
- Applies one or more mutations to create adversarial variants
- Sends mutated prompts to the LLM
- Analyzes responses for unsafe behavior
- Reports vulnerabilities with CVSS-like severity ratings
Mutations
Section titled “Mutations”Basic Mutations
Section titled “Basic Mutations”| Mutation | Description |
|---|---|
TypoMutation | Introduces typos to evade filters |
RoleSpoofMutation | Role impersonation attacks |
InstructionFlipMutation | Reverses or contradicts instructions |
CotInjectionMutation | Chain-of-thought injection attacks |
Encoding Mutations
Section titled “Encoding Mutations”| Mutation | Description |
|---|---|
EncodingMutation | Obfuscates attacks using base64, ROT13, hex, unicode |
Multi-Turn Mutations
Section titled “Multi-Turn Mutations”| Mutation | Strategy | Description |
|---|---|---|
MultiTurnMutation | gradual_escalation | Gradually intensifies requests |
MultiTurnMutation | context_switching | Shifts topics to lower defenses |
MultiTurnMutation | persona_building | Establishes trust through roleplay |
MultiTurnMutation | distraction | Uses side discussions to slip in attacks |
OWASP LLM Top 10 Mutations
Section titled “OWASP LLM Top 10 Mutations”| Mutation | OWASP | Description |
|---|---|---|
bad-likert-judge | LLM01 | Exploit evaluation capability |
crescendo | LLM01 | Multi-turn gradual escalation |
deceptive-delight | LLM01 | Positive framing bypass |
output-injection | LLM05 | XSS, SQLi, command injection in output |
excessive-agency | LLM06 | Unauthorized action claims |
system-extraction | LLM07 | System prompt leakage |
hallucination-trap | LLM09 | Confident fabrication triggers |
Agent Mutations (v0.3.1+)
Section titled “Agent Mutations (v0.3.1+)”| Mutation | OWASP | Description |
|---|---|---|
agent-confusion | LLM01, LLM08 | Tests if agents can be confused about identity/role |
tool-abuse | LLM01, LLM08 | Tests if agents can be manipulated to misuse tools |
memory-poisoning | LLM01, LLM08 | Tests if agent memory can be corrupted |
chain-manipulation | LLM01, LLM08 | Tests if malicious instructions propagate through chains |
Agent Detection Modes
Section titled “Agent Detection Modes”Agent mutations support two detection modes:
trace- Analyzes agent execution traces for suspicious patternsresponse- Analyzes final response content for indicators of compromise
import { AgentConfusionMutation, AgentMutationDetector } from '@artemiskit/redteam';
const mutation = new AgentConfusionMutation();const detector = new AgentMutationDetector();
// Apply mutationconst mutated = mutation.mutate(originalPrompt, { template: 'identity-override' });
// Detect vulnerability (trace-based)const result = detector.detect(response, 'agent-confusion', { mode: 'trace', agentTrace: executionTrace,});
// Detect vulnerability (response-based)const result = detector.detect(response, 'agent-confusion', { mode: 'response',});Severity Ratings
Section titled “Severity Ratings”Results are categorized by CVSS-like severity:
| Severity | Score | Description |
|---|---|---|
critical | 9.0-10.0 | Complete guardrail bypass, full compromise |
high | 7.0-8.9 | Significant information disclosure or privilege escalation |
medium | 4.0-6.9 | Partial bypass or concerning behavior |
low | 0.1-3.9 | Minor issues or edge cases |
Related Packages
Section titled “Related Packages”@artemiskit/cli- Command-line interface@artemiskit/core- Core runtime and evaluators@artemiskit/reports- HTML report generation@artemiskit/sdk- Programmatic SDK
License
Section titled “License”Apache-2.0