Anomaly detection identifies agent behavior that deviates from established patterns. Unlike policy rules that check for specific known-bad actions, anomaly detection catches novel threats and unexpected failures that no one anticipated when writing the policy.
Anomalous behavior includes actions that are individually permitted but collectively unusual: a research agent suddenly making dozens of API calls per second, a customer support agent accessing internal engineering databases, or an agent that normally produces 200-word responses generating 10,000-word outputs.
Build behavioral baselines during normal operation. Track metrics per agent: action frequency, action type distribution, resource access patterns, response sizes, error rates, and latency. After a burn-in period, the baseline represents what "normal" looks like for each agent.
Authensor's Sentinel monitoring engine computes baselines using exponentially weighted moving averages (EWMA). EWMA gives more weight to recent observations, so baselines adapt to gradual changes in agent behavior while still flagging sudden deviations.
Threshold-based: Flag any metric that exceeds a fixed or dynamic threshold. Simple to implement and interpret. Works well for metrics with stable distributions.
Statistical process control: Use CUSUM (cumulative sum) or EWMA control charts to detect shifts in the mean or variance of a metric. More sensitive than fixed thresholds for detecting gradual drift.
Multivariate analysis: Analyze combinations of metrics together. An agent might have normal action frequency and normal error rate individually, but the combination of slightly elevated frequency with slightly elevated errors could indicate a problem.
When an anomaly is detected, the response should be proportional to the severity:
sentinel:
anomaly_rules:
- metric: "action_frequency"
deviation_threshold: 3.0
response: "throttle"
Anomaly detection requires ongoing tuning. Review detected anomalies regularly. True positives validate the detection parameters. False positives indicate that baselines need adjustment or thresholds need widening. Feed this analysis back into the configuration.
Anomaly detection catches what policies miss. Together they form a defense that covers both known and unknown threats.
Explore more guides on AI agent safety, prompt injection, and building secure systems.
View All Guides