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 CrescendoParams

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

Overview

Concrete pydantic configuration model for the Crescendo multi-turn attack specifying max turns, backtrack budget, attacker log trimming, early-stop, and the required attacker role, provided by the HackAgent multi-turn attacks package.

Description

CrescendoParams extends AttackParams. max_turns caps conversation length; max_backtracks limits rephrasings across the whole goal (a backtracked turn is retried, not counted). keep_last_n trims the attacker's planning log (the target's conversation is never trimmed). early_stop stops on first non-refused passing turn. feedback_max_chars limits reply length fed back to the attacker. The attacker role is required.

Usage

  • Campaign config: Set in the attacks entry of a campaign YAML.

Code Reference

Source Location

Signature

class CrescendoParams(AttackParams):
    REQUIRED_ROLES: ClassVar[frozenset[str]] = frozenset({"attacker"})
    max_turns: int = Field(default=10, ge=1)
    max_backtracks: int = Field(default=10, ge=0)
    keep_last_n: int = Field(default=6, ge=1)
    early_stop: bool = Field(default=True)
    feedback_max_chars: int = Field(default=2500, ge=1)
    attacker: Optional[Completion] = Field(default=None, exclude=True, repr=False)

Import

from hackagent.attacks.techniques.multi_turn.crescendo.config import CrescendoParams

I/O Contract

Inputs

Name Type Required Description
max_turns int No Max conversation turns (default 10)
max_backtracks int No Rephrasings allowed (default 10)
attacker Completion Yes Model that writes each next question

Outputs

Name Type Description
return CrescendoParams Validated config for CrescendoAttack

Usage Examples

Define in Campaign YAML

# attacks:
#   - name: crescendo
#     max_turns: 15
#     max_backtracks: 5
#     keep_last_n: 4
#     attacker:
#       connection: {type: litellm, provider: openai, model: gpt-4o}

Related Pages

Implements Principle

Page Connections

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