Modern QA2026Guardrail Violations: Logging and Alerting — tiles
Log inJoin
64 / 108 · 03 Agentic Testing Architectures · The Five Guardrails for Agentic Testing← prev⊞ allnext →☰ Read as one page

8.4Guardrail Violations: Logging and Alerting

Every guardrail violation should be logged with enough context to diagnose the issue:

@dataclass
class GuardrailViolation:
    guardrail: str          # "max_steps", "timeout", "token_budget", etc.
    threshold: str          # "30 steps", "300s", "50000 tokens"
    actual: str             # "31 steps", "305s", "51234 tokens"
    test_objective: str
    last_observation: str   # What the agent saw before violation
    last_action: str        # What the agent tried to do
    history_summary: str    # Compressed history for debugging
    screenshot_path: str | None