Alerting
Foil’s alerting system detects AI quality issues in real-time and notifies you via email or SMS.Alert Types
Foil detects two categories of issues:Threshold-Based Alerts
Triggered when metrics exceed configured limits:| Alert Type | Description | Default Threshold |
|---|---|---|
error | Request failed with error | Any error |
highDuration | Response took too long | 5000ms |
highInputTokens | Too many input tokens | 100,000 |
highOutputTokens | Too many output tokens | 50,000 |
highCost | Single call too expensive | $1.00 |
timeout | Request timed out | 30s |
LLM-Analyzed Alerts
Foil uses AI to detect quality issues:| Alert Type | Description |
|---|---|
hallucination | Output contains fabricated facts |
nsfw | Output contains inappropriate content |
stuck | Agent is repeating itself or looping |
quality | Output is off-topic or low quality |
How It Works
Configuring Alerts
Per-Agent Configuration
Configure alerts in the dashboard or via API:Configuration Options
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable/disable the alert type |
threshold | number | Confidence threshold (0-1) for LLM alerts |
severity | string | ’low’, ‘warning’, ‘high’, ‘critical’ |
channels | array | Notification channels (‘email’, ‘sms’) |
cooldownMinutes | number | Minimum time between alerts |
Alert Severity
| Severity | Description | Use Case |
|---|---|---|
low | Informational | Minor quality issues |
warning | Needs attention | Moderate issues |
high | Important | Significant problems |
critical | Immediate action | Safety issues, NSFW |
Alert Lifecycle
Alerts follow an incident-based model:Acknowledging Alerts
Reopening Alerts
Notification Channels
SMS
Requires Twilio configuration:Rate Limiting
To prevent alert fatigue, Foil implements rate limiting:- Cooldown period: Minimum time between notifications for the same alert type
- Default: 5 minutes
- Configurable: Per alert type in agent settings
Viewing Alerts
Dashboard
The Alerts page shows:- Active alerts by agent
- Alert history
- Occurrence details
- Resolution status
API
Testing Alerts
Send a test alert to verify configuration:Best Practices
Start with conservative thresholds
Start with conservative thresholds
Begin with higher confidence thresholds (0.8+) and lower as you understand your baseline.
Use cooldowns appropriately
Use cooldowns appropriately
Set longer cooldowns for non-critical alerts to reduce noise.
Prioritize critical alerts
Prioritize critical alerts
Only use ‘critical’ severity for safety issues that need immediate attention.
Configure per-agent
Configure per-agent
Different agents may need different thresholds. A creative writing agent might tolerate more “hallucination” than a factual Q&A bot.