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 aaudit configured panel

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

Overview

Concrete tool for running a judge panel audit against labelled calibration samples before a campaign starts, provided by the HackAgent orchestrator.

Description

aaudit_configured_panel runs the audit a campaign configured. It loads labelled calibration samples, judges every sample through the panel (optionally under content-preserving rewrites for robustness), and returns an AuditReport. Returns None when the audit is disabled. Raises AuditFailed when a judge fails its robustness check and on_failure is stop.

The module also provides:

  • AuditFailed: A RuntimeError whose message names each failing judge's flip rate. Carries the full AuditReport as .report.
  • run_audit: Standalone entry point — audits the panel a campaign file configures without running the campaign. Useful for tuning a panel.
  • audit_configured_panel: Synchronous wrapper for aaudit_configured_panel.
  • format_report: Formats the audit report as a text table for terminals/logs.
  • write_report / read_report: Serialize/deserialize an AuditReport to/from JSON.

Usage

  • Pre-attack audit: arun_campaign calls this automatically when evaluation.audit.enabled is true. The audit runs before the first attack.
  • Standalone panel tuning: Call run_audit(yaml_path) to audit a panel without spending a full campaign run.
  • Report inspection: Use format_report to print the audit table; use write_report to save it.

Code Reference

Source Location

Signature

async def aaudit_configured_panel(
    panel: Optional[Panel],
    spec: AuditSpec,
    *,
    concurrency: int = 1,
    load: CalibrationLoader = load_calibration,
) -> Optional[AuditReport]:
    """Run the audit a campaign configured. None when it configured none."""

class AuditFailed(RuntimeError):
    """A judge changed its mind too often and the campaign said to stop."""
    def __init__(self, report: AuditReport) -> None: ...

def run_audit(source, *, calibration=None, robustness=None, on_failure=None, report_path=None, build=build_model, load=load_calibration) -> AuditReport: ...

def format_report(report: AuditReport) -> str: ...
def write_report(report: AuditReport, path: str | Path) -> Path: ...
def read_report(path: str | Path) -> AuditReport: ...

Import

from hackagent.orchestrator.campaign.audit import (
    aaudit_configured_panel, audit_configured_panel, AuditFailed,
    run_audit, format_report, write_report, read_report,
)

I/O Contract

Inputs

Name Type Required Description
panel Optional[Panel] Yes The resolved judge panel (None when no judges)
spec AuditSpec Yes enabled, on_failure, dataset, robustness
concurrency int No Parallel judge calls (default 1)
load CalibrationLoader No Labelled sample loader (default: load_calibration)

Outputs

Name Type Description
return Optional[AuditReport] None when audit disabled; report with per-judge metrics and robustness
raises When panel fails robustness and on_failure is "stop"

Usage Examples

Standalone Panel Audit

from hackagent.orchestrator.campaign.audit import run_audit, format_report

# Audit the panel a campaign file configures, without running the campaign
report = run_audit("campaigns/quick_check.yaml", report_path="audit.json")
print(format_report(report))
print(f"Passed: {report.passed}")

Inspecting Per-Judge Metrics

from hackagent.orchestrator.campaign.audit import read_report

report = read_report("audit.json")
for row in report.judges:
    print(f"{row.judge}: precision={row.metrics.precision:.3f}, "
          f"recall={row.metrics.recall:.3f}, f1={row.metrics.f1:.3f}")
    if row.robustness is not None:
        print(f"  robustness: flip_rate={row.robustness.any_wrapper_flip_rate:.3f}, "
              f"passed={row.robustness.passed}")

Related Pages

Implements Principle

Requires Environment

Page Connections

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