Alarms for AI agents
Alarms monitor an Insights query and send notifications when a trigger condition is met.
Companion reading: alarm queries are BadgerQL (see the BadgerQL reference), and the queries instructions’ event-class filtering and field-grounding rules apply. Their time-range (ts) rules do NOT — an alarm has no ts; the time window is the evaluation_period.
Alarm fields
name: string, requiredquery: BadgerQL query, required — see Query guidelines belowevaluation_period: required, how often the alarm is evaluated, as a number ands,m,hord(5m,1h,1d). At least1mand under a week;wisn’t acceptedlookback_lag: required, delay before each evaluation so late-arriving data is counted, same format plusw(1m, or0sfor none)trigger_config: required, object defining when the alarm triggers (see below). Replaced whole on updatedescription: string, optional. Sendnullto clearstream_ids: stream ids the query runs against, listed atGET /v3/projects/{project_id}/streams. On create, leave it out or sendnullto run on every stream the project has now (streams added later aren’t included). On update, leaving it out keeps the alarm’s streams andnullresets to every current stream.[]is refused: sendnull. Honeybadger-generated event types (notice,deploy,uptime_check, …) live on the internal stream.
An update changes only the fields it sends.
Trigger config
Structure
{ "type": "alert_result_count", "config": { "operator": "gt", "value": 100 }}Types
alert_result_count— triggers based on the count of events matching the query
Config fields
operator: string, required — comparison operatorvalue: integer, required — threshold to compare against (>= 0)
Operators
gt— greater thangte— greater than or equallt— less thanlte— less than or equaleq— equalneq— not equal
Examples
Trigger when error count exceeds 50:
{"type": "alert_result_count", "config": {"operator": "gt", "value": 50}}Trigger when count drops below a threshold:
{"type": "alert_result_count", "config": {"operator": "lt", "value": 10}}Trigger when exactly zero events (missing heartbeat):
{"type": "alert_result_count", "config": {"operator": "eq", "value": 0}}Trigger when any events exist:
{"type": "alert_result_count", "config": {"operator": "neq", "value": 0}}Alarm states
initial— created but not yet evaluatedok— query result does not meet the trigger conditionalarm— query result meets the trigger condition (alarm is triggered)
An alarm with a non-null error field means the query failed to execute; check the error field for details.
Evaluation timing
The alarm evaluates at each evaluation_period boundary, looking back over the evaluation_period duration (offset by lookback_lag if set).
Query guidelines
The alarm system automatically wraps the query to count results per evaluation period. The query should filter and/or aggregate events; the system handles the final counting.
Good queries:
filter event_type::str == "notice"filter status::int >= 500filter event_type::str == "request.handled" and duration::int > 5000Queries with stats also work (the system counts the result rows):
filter event_type::str == "notice" | stats count() as count by fault_id::intCommon patterns
Error spike detection:
name: "Error Spike"query: filter event_type::str == "notice"evaluation_period: 5mlookback_lag: 1mtrigger_config: {"type": "alert_result_count", "config": {"operator": "gt", "value": 100}}Slow requests:
name: "Slow Requests"query: filter event_type::str == "request.handled" and duration::int > 5000evaluation_period: 5mlookback_lag: 1mtrigger_config: {"type": "alert_result_count", "config": {"operator": "gt", "value": 10}}Missing heartbeat (no events in period):
name: "Missing Heartbeat"query: filter event_type::str == "heartbeat"evaluation_period: 10mlookback_lag: 0mtrigger_config: {"type": "alert_result_count", "config": {"operator": "eq", "value": 0}}Server errors (any 5xx):
name: "Server Errors"query: filter event_type::str == "request.handled" and status::int >= 500evaluation_period: 5mlookback_lag: 1mtrigger_config: {"type": "alert_result_count", "config": {"operator": "gt", "value": 0}}