Anomaly Detection

Deterministic stats gate the model: cheap, reproducible statistics detect anomalies; the LLM is invoked only to explain them. Pure LLM anomaly hunting over raw rows is wasteful and non-reproducible, the stats pass keeps it auditable and near-zero cost on the clean path.

Stats pass (no LLM)

Queries executions for the last N runs (default 200) and detects:

LLM pass (synthesis)

When anomalies exist, the model receives the list and returns a 1-2 sentence oncall-readable summary. No anomalies → no LLM call (zero cost).

Inputs

Output

{
  anomalies: [
    {
      executionId, scriptName, type, severity, detail, metric
    }
  ],
  summary: 'plain-English synthesis of detected anomalies'
}

Scheduled use

Drive on an interval: POST /api/ai/agents/anomaly-detection, alert when anomalies.length > 0 at severity error.