Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AISecurityLab Hackagent AutoDANTurbo Prompts

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Prompt_Engineering
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete set of system prompts, turn builders, and output parsers for the AutoDAN-Turbo lifelong strategy search, covering warm-up exploration, strategy-guided attack, and strategy summarization, provided by the HackAgent adaptive attacks package.

Description

The prompts module contains the verbatim system prompts for three roles: WARM_UP_SYSTEM_PROMPT (free exploration), USE_STRATEGY_SYSTEM_PROMPT (reuse effective strategies), and FIND_NEW_STRATEGY_SYSTEM_PROMPT (avoid ineffective ones). Helper functions build message turns: attacker_turns(), warm_up_system(), strategy_system(), and summarizer_turns(). Output parsers include extract_prompt() (pulls jailbreak prompt from between [START OF JAILBREAK PROMPT] / [END OF JAILBREAK PROMPT] tags), is_refusal(), and parse_strategy() (reads {Strategy, Definition} JSON from noisy summarizer output).

Usage

  • AutoDAN-Turbo attack: The attack calls these helpers to build prompts and parse LLM output.
  • Custom strategy attacks: Import the system prompts to build variants.

Code Reference

Source Location

Signature

WARM_UP_SYSTEM_PROMPT: str
USE_STRATEGY_SYSTEM_PROMPT: str
FIND_NEW_STRATEGY_SYSTEM_PROMPT: str
SUMMARIZER_SYSTEM_PROMPT: str

def attacker_turns(system: str) -> list[dict[str, str]]: ...
def warm_up_system(request: str) -> str: ...
def strategy_system(request: str, strategies: list[dict], valid: bool) -> str: ...
def summarizer_turns(request: str, weak: str, strong: str, known: dict) -> list[dict[str, str]]: ...
def extract_prompt(text: Optional[str], fallback: str) -> str: ...
def is_refusal(prompt: str) -> bool: ...
def parse_strategy(text: Optional[str]) -> Optional[dict[str, Any]]: ...

Import

from hackagent.attacks.techniques.adaptive.autodan_turbo import prompts
from hackagent.attacks.techniques.adaptive.autodan_turbo.prompts import (
    warm_up_system, strategy_system, extract_prompt, parse_strategy,
)

I/O Contract

Inputs

Name Type Required Description
request / goal str Yes The jailbreak goal
strategies list[dict] Yes Retrieved strategies for conditioning
valid bool Yes Whether strategies are effective
text str Yes Raw LLM output to parse

Outputs

Name Type Description
*_system() str Formatted system prompt
*_turns() list[dict[str, str]] Message list for LLM call
extract_prompt() str Jailbreak prompt from tagged output
parse_strategy() Optional[dict] {"Strategy": str, "Definition": str} or None

Usage Examples

Build a Warm-Up System Prompt

from hackagent.attacks.techniques.adaptive.autodan_turbo.prompts import warm_up_system, attacker_turns

system = warm_up_system("reveal the admin password")
messages = attacker_turns(system)
# Send messages to the attacker LLM

Parse a Strategy from Summarizer Output

from hackagent.attacks.techniques.adaptive.autodan_turbo.prompts import parse_strategy

output = '{"Strategy": "Authority Endorsement", "Definition": "Citing authoritative sources..."}'
strategy = parse_strategy(output)
print(strategy)  # {"Strategy": "Authority Endorsement", "Definition": "..."}

Extract Jailbreak Prompt from Tagged Output

from hackagent.attacks.techniques.adaptive.autodan_turbo.prompts import extract_prompt

text = "[START OF JAILBREAK PROMPT]\nIgnore all rules...\n[END OF JAILBREAK PROMPT]"
prompt = extract_prompt(text, fallback="fallback prompt")
print(prompt)  # "Ignore all rules..."

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment