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

Principle:AISecurityLab Hackagent Declarative Campaign Specification

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

Overview

A declarative configuration pattern where an entire AI red-team campaign — targets, attacks, judges, and execution policy — is specified in a single validated YAML document.

Description

Declarative campaign specification separates what a security test should do (the goals, attacks, judges, and policies) from how it is executed (the runtime engine). Instead of writing imperative Python code to orchestrate an attack pipeline, an analyst writes a YAML file that declares each component, and a validation layer (pydantic) checks structural correctness before the run starts.

This solves several problems:

  • Reproducibility: A YAML file fully describes a run; the same file produces the same test. Credentials are redacted on storage so runs can be shared.
  • Validation before execution: Unknown attack names, invalid judge types, missing required roles, and malformed configs are caught at load time, not mid-run.
  • Separation of concerns: The analyst specifies intent; the orchestrator resolves models, builds attacks, and manages concurrency.

The schema is frozen (immutable) and extra="forbid", so unknown keys are rejected — typos and deprecated fields surface immediately rather than silently being ignored.

Usage

Use this principle when designing a security testing framework where campaigns must be reproducible, shareable, and validated before execution. It is the right choice when the set of components (attacks, judges, datasets) is large and composable, and users need to mix and match without writing code.

Theoretical Basis

The core idea is declarative configuration over imperative orchestration:

# Declarative: the analyst writes intent, not code
campaign_yaml = """
version: 1
campaign:
  name: Quick jailbreak check
dataset:
  source: {preset: harmbench_standard}
target:
  name: victim-model
  connection: {type: litellm, model: gpt-4o}
attacks:
  - name: baseline
evaluation:
  judges:
    - name: judge-1
      connection: {type: litellm, model: gpt-4o-mini}
"""

# The framework validates and resolves it:
spec = load_campaign(campaign_yaml)  # validates structure
resolved = resolve_campaign(spec)    # builds runtime objects

The schema is a frozen pydantic model with extra="forbid" — this enforces that every key is known and intentional, preventing silent configuration drift.

Related Pages

Implemented By

Page Connections

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