Alerting
The Alerting system monitors your agent traces in real-time and fires alerts when behavior deviates from expected baselines.
Alert Types
Section titled “Alert Types”| Type | Description |
|---|---|
| Cost spike | Total trace cost exceeds threshold |
| Error rate | Percentage of failed spans exceeds threshold |
| Latency | Trace duration exceeds threshold |
| Missing span | Expected span name not found in trace |
Creating Alert Rules
Section titled “Creating Alert Rules”Navigate to Alert Rules in the sidebar, then click New Rule.
Rule Configuration
Section titled “Rule Configuration”| Field | Description |
|---|---|
| Name | Display name for the rule |
| Type | One of the 4 alert types above |
| Threshold | Numeric limit (cost in $, rate in %, duration in ms) |
| Mode | absolute — fixed value, or relative — % change from rolling baseline |
| Baseline window | Number of recent traces used to compute the rolling average |
| Webhook URL | Optional HTTP endpoint to notify when alert fires |
| Cooldown | Minimum seconds between repeated alerts (default: 60s) |
Example: Cost Spike Rule
Section titled “Example: Cost Spike Rule”Name: High cost alertType: cost_spikeThreshold: 0.10 (10 cents per trace)Mode: absoluteCooldown: 60Example: Error Rate Rule
Section titled “Example: Error Rate Rule”Name: Error rate too highType: error_rateThreshold: 20 (20% of spans failing)Mode: absoluteBaseline window: 10 (compare against last 10 traces)Viewing Alerts
Section titled “Viewing Alerts”Navigate to Alerts in the sidebar to see all fired alert events, with:
- Timestamp
- Rule name and type
- Trace that triggered it (click to open)
- Resolved / unresolved status
The sidebar badge shows the count of unresolved alerts.
Real-time Delivery
Section titled “Real-time Delivery”Alerts fire instantly via SSE — no polling needed. The dashboard badge updates in real-time when a new alert fires.
Webhook Integration
Section titled “Webhook Integration”When a webhook URL is configured, AgentLens sends a POST request on every alert:
{ "rule_id": "rule_abc123", "rule_name": "High cost alert", "type": "cost_spike", "trace_id": "trace_xyz", "value": 0.142, "threshold": 0.10, "fired_at": "2026-03-01T10:00:00Z"}Use this to integrate with Slack, PagerDuty, or any custom notification system.