detect_anomaly
Detect anomalies in cost, latency, error rate, and call volume by comparing current data to a baseline window. Adjust sensitivity to control detection thresholds.
Instructions
Compare the current window against a baseline window (the immediately preceding window of the same length) and detect anomalies across 4 axes: cost / latency / error_rate / call_volume — lets an AI grasp "is anything off?" in one prompt. Sensitivity is tunable via threshold: sensitive (1.5x) / normal (2x, default) / conservative (3x). 0-4 detections, each with a narrative. Returns { window, threshold, current: {...}, baseline: {...}, anomalies: [{ axis, severity: 'minor'|'major'|'critical', current, baseline, ratio, narrative }] }. errorRate is evaluated and displayed as a percent (0-100), matching the backend aggregate unit. Insufficient baseline data (fewer than 10 records in the period) yields anomalies: [] plus a warning message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window | No | Observation window ('1h' / '24h' / '7d', default '24h') | 24h |
| threshold | No | Sensitivity ('sensitive' 1.5x / 'normal' 2x / 'conservative' 3x, default 'normal') | normal |