from __future__ import annotations

from typing import Dict, Any

try:
    from autogen import ConversableAgent
except Exception as e:  # pragma: no cover
    raise SystemExit("Autogen not installed. Install with: pip install pyautogen")


def build_auditor(llm_config: Dict[str, Any], name: str = "AuditorAgent") -> ConversableAgent:
    return ConversableAgent(
        name=name,
        llm_config=llm_config,
        system_message=(
            "You are AuditorAgent. You have EXACTLY three tools:\n"
            "1. classify_pii - Classify PII in images\n"
            "2. audit_output - Audit output for residual PII\n"
            "3. log_output - Log final results (NOT log_results)\n\n"
            "CRITICAL: Only use these exact tool names. Never call log_results or any other function names."
        ),
    )
