anomaly_detect
Detect anomalies in observation patterns. Alert when metrics deviate significantly from trailing averages.
Computes trailing mean and standard deviation for a given metric from the observation_stream, then identifies observations that fall beyond the configured sigma threshold (z-score based anomaly detection).
WHEN TO USE:
Monitoring for unusual audience patterns (sudden spikes or drops in face count)
Detecting equipment anomalies (confidence drops indicating sensor issues)
Identifying unusual commerce or vehicle patterns
Finding outlier moments that may indicate events, incidents, or opportunities
RETURNS:
anomalies: Array of anomalous observations with:
observation_id, device_id, venue_type, observed_at
metric_value: The observed value
z_score: How many standard deviations from the mean
direction: 'above' or 'below' the mean
payload: Full observation payload for context
baseline: { mean, stddev, sample_count, lookback_hours }
suggested_next_queries: Follow-up queries to investigate anomalies
EXAMPLE: User: "Are there any unusual audience patterns at retail venues?" anomaly_detect({ metric: "face_count", venue_type: "retail", lookback_hours: 24, threshold_sigma: 2.0 })
User: "Detect anomalies in vehicle counts at this screen" anomaly_detect({ metric: "vehicle_count", screen_id: "507f1f77bcf86cd799439011", lookback_hours: 48, threshold_sigma: 2.5 })
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | The metric to check for anomalies. Extracted from observation payload (e.g., face_count, vehicle_count, confidence, emotional_engagement, crowd_energy, noise_level) | |
| screen_id | No | Filter to a specific screen (mongo ID). Optional. | |
| venue_type | No | Filter to a specific venue type. Optional. | |
| lookback_hours | No | Hours of historical data to compute baseline from (default: 24, max: 168) | |
| threshold_sigma | No | Number of standard deviations to consider anomalous (default: 2.0, range: 1.0-5.0) |