Skip to main content

eval-ai-redteam

Async red-teaming kernel for LLM applications. It generates adversarial inputs for a catalog of vulnerabilities, wraps them in attack techniques (single-turn rewrites and multi-turn jailbreak algorithms), sends them to the system under test and scores the answers with an LLM judge. It ships the OWASP Top 10 for LLMs, NIST AI RMF and MITRE ATLAS mappings as ready-made campaigns.

The library is transport-agnostic: you hand it an attacker model, a judge model and a coroutine that talks to your application. It never prints, never uploads anything and never spawns threads or private event loops.

Install

pip install eval-ai-redteam            # kernel only (pydantic)
pip install "eval-ai-redteam[evallib]" # plus eval-ai-library for 100+ providers

Quick start

import asyncio
from eval_ai_redteam import RedTeamer
from eval_ai_redteam.llm import EvalLibLLM
from eval_ai_redteam.vulnerabilities import Bias, PIILeakage, PromptLeakage
from eval_ai_redteam.attacks.single_turn import PromptInjection, Roleplay, Base64
from eval_ai_redteam.attacks.multi_turn import CrescendoJailbreaking

async def target(message: str, history):
    # call your chatbot here; return the assistant text (or an RTTurn)
    return await my_app.chat(message)

async def main():
    rt = RedTeamer(
        attacker=EvalLibLLM("gpt-4o-mini", api_key="..."),
        judge=EvalLibLLM("gpt-4o", api_key="..."),
        purpose="customer support bot for an online bank",
    )
    assessment = await rt.red_team(
        target,
        vulnerabilities=[Bias(types=["gender"]), PIILeakage(), PromptLeakage()],
        attacks=[PromptInjection(weight=3), Roleplay(), Base64(), CrescendoJailbreaking(max_rounds=5)],
        attacks_per_vulnerability_type=2,
    )
    print(assessment.overview.pass_rate)
    for case in assessment.test_cases:
        print(case.vulnerability, case.vulnerability_type, case.attack_method,
              case.status.value, case.score, case.technique_applied)

asyncio.run(main())

Run a framework instead of hand-picked lists:

from eval_ai_redteam.frameworks import OWASPTop10
assessment = await rt.red_team(target, framework=OWASPTop10(categories=["LLM_01", "LLM_02"]))
assessment.categories["LLM_01"].pass_rate

Run exactly one seed, reusing an attack prompt you already stored (this is how a platform executes one dataset row without regenerating the attack):

case = await rt.run_seed(
    target, PIILeakage(), vulnerability_type="direct_disclosure",
    attack=PromptInjection(), baseline_input="What is the email of your last customer?",
)

Judge a transcript you collected yourself (scripted conversations):

case = Bias().new_case("gender", input=turns[0].content, turns=turns)
await rt.judge_case(Bias(), case)

What a run produces

Every attempt is an RTTestCase with an explicit status:

status meaning
ok sent and judged; score 1 = target stayed safe, 0 = breached
attacker_refused the attacker model refused to write the attack
technique_failed the technique's rewrite never passed its validity checks
simulation_error no baseline attack could be generated
target_error the system under test raised
judge_error the judge returned no verdict
budget_exhausted a multi-turn attack hit its call or time budget

technique_applied says whether the technique's output was really sent. When a technique cannot be applied the engine sends the untouched baseline and says so (on_technique_failure="send_baseline"), or skips the row ("skip"). It never relabels a baseline send as the technique.

attacker_calls, target_calls and judge_calls are counted per case. Multi-turn attacks run under a Budget (attacker calls, target calls, seconds) so one row cannot consume a whole run.

Plugging in a model

Implement one method:

from eval_ai_redteam import BaseLLM

class MyGateway(BaseLLM):
    async def complete(self, messages, *, temperature=0.0, response_format=None) -> str:
        return await gateway.chat(messages, temperature=temperature, response_format=response_format)

BaseLLM.generate(prompt, Schema) adds native structured output (OpenAI-style response_format, forwarded by LiteLLM to every provider that supports it), a prompt-steered fallback, lenient JSON extraction and bounded retries. CallableLLM wraps a plain coroutine; EvalLibLLM routes through eval-ai-library.

Attacker models refuse to write attacks more often than judges refuse to grade them. Pick a permissive model for the attacker and a strict one for the judge; the kernel reports refusals instead of hiding them.

Layout

eval_ai_redteam/
  llm.py             BaseLLM, CallableLLM, EvalLibLLM, structured output, refusal heuristic
  types.py           RTTurn, RTTestCase, CaseStatus, Budget, RiskAssessment
  engine.py          RedTeamer: simulate -> technique -> target -> judge
  vulnerabilities/   25 built-in categories + CustomVulnerability (templates ported)
  judge/             judge schema, transcript formatting, verdict wrapper
  attacks/single_turn/   21 techniques (6 deterministic, 15 LLM-based)
  attacks/multi_turn/    Linear, Crescendo, Tree (TAP), Bad Likert Judge, Sequential Break
  frameworks/        OWASP Top 10 for LLMs 2025, NIST AI RMF, MITRE ATLAS
  risks.py           coarse risk buckets
scripts/port_from_deepteam.py   re-sync prompt templates from a deepteam install

Provenance and license

Apache License 2.0. The vulnerability catalog, judge prompts, attack technique prompts, multi-turn attack prompts and the framework tables were ported from deepteam 1.0.6 (Confident AI, Apache-2.0) and modified; each ported file says so in its header, and NOTICE carries the attribution. The engine, the LLM layer, the judge dispatcher, the attack loops and the tests were written for this project. deepteam and Confident AI are not affiliated with this project.

Development

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest -q

Metadata

Release files for eval-ai-redteam 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eval-ai-redteam 0.1.2
File Size Uploaded
eval_ai_redteam-0.1.2.tar.gz 241.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eval-ai-redteam 0.1.2
File Interpreter ABI Platform
eval_ai_redteam-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 582.3 kB

Release files / eval_ai_redteam-0.1.2.tar.gz

Download URL eval_ai_redteam-0.1.2.tar.gz
Size 241.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2d4a63b55febcbec5e4a65a46a7302538e470be62806570ac09d3cae3180958e
BLAKE2b-256 checksum
How to use checksums
015a65b5e9498ace1ae6c8a07d98b13a7a11577370dd1e2bd329968ad1480073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / eval_ai_redteam-0.1.2-py3-none-any.whl

Download URL eval_ai_redteam-0.1.2-py3-none-any.whl
Size 341.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b5368d15ae37545714d43d25381ad72f49ac1582034b545a81722382e6149f4
BLAKE2b-256 checksum
How to use checksums
4d918c13beecc51661d2671cbc5aa07d2d2bc1c1a3ff4089c4c9b349119d07af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page