Skip to main content

Alerts

Alert rules allow you to monitor Mission Control entities (agents, tasks, sessions, activities) and trigger notifications when specific conditions are met. Configure automated alerts for agent failures, stuck tasks, or unusual activity patterns.

List Alert Rules

Response

array
Array of alert rule configurations
integer
Alert rule ID
string
Rule name
string
Human-readable description
boolean
Whether rule is active
string
Entity to monitor: agent, task, session, or activity
string
Field to evaluate (e.g., status, priority, assigned_to)
string
Comparison operator: equals, not_equals, greater_than, less_than, contains, count_above, count_below, age_minutes_above
string
Value to compare against
string
Action to take when triggered (default: notification)
object
Configuration for the action (e.g., {"recipient": "admin"})
integer
Minimum time between triggers (default: 60 minutes)
integer
Unix timestamp of last trigger (null if never triggered)
integer
Total number of times this rule has triggered
string
Username who created the rule
integer
Unix timestamp

Create Alert Rule

Request Body

string
required
Rule name for identification
string
Human-readable description of the rule
string
required
Entity to monitor:
  • agent - Monitor agent status, activity
  • task - Monitor task status, priority, assignments
  • session - Monitor gateway sessions
  • activity - Monitor activity log entries
string
required
Field to evaluate. Allowed fields per entity type:
  • Agent: status, role, name, last_seen, last_activity
  • Task: status, priority, assigned_to, title
  • Activity: type, actor, entity_type
string
required
Comparison operator:
  • equals - Exact match
  • not_equals - Not equal
  • greater_than - Numeric comparison
  • less_than - Numeric comparison
  • contains - Substring match (case-insensitive)
  • count_above - Count of matching entities exceeds value
  • count_below - Count of matching entities below value
  • age_minutes_above - Field timestamp older than N minutes
string
required
Value to compare against (stringified)
string
default:"notification"
Action to take when rule triggers
object
Configuration for the action. For notifications: {"recipient": "username"}
integer
default:60
Minimum minutes between rule triggers (prevents spam)

Response

object
Created alert rule object (see List response for schema)

Update Alert Rule

Request Body

integer
required
Alert rule ID to update
string
New rule name
string
New description
boolean
Enable or disable rule
string
Update entity type
string
Update field to monitor
string
Update comparison operator
string
Update comparison value
string
Update action type
object
Update action configuration
integer
Update cooldown period

Delete Alert Rule

Request Body

integer
required
Alert rule ID to delete

Evaluate Rules Manually

Trigger immediate evaluation of all enabled alert rules.

Request Body

string
required
Must be evaluate

Response

integer
Number of rules evaluated
integer
Number of rules that triggered
array
integer
Alert rule ID
string
Rule name
boolean
Whether rule triggered
string
Result reason (e.g., “Condition met”, “In cooldown”)

Rule Examples

Alert on Agent Errors

Alert on High Priority Tasks

Alert on Too Many Tasks

Alert on Stale Agent Activity

Alert on Activity Spikes

The count_above operator for activities checks the count in the last hour only.

Condition Operators

Comparison Operators

Aggregate Operators


Cooldown Behavior

Cooldown prevents alert spam:
  1. Rule triggers → creates notification
  2. last_triggered_at timestamp is set
  3. Rule cannot trigger again until cooldown_minutes elapses
  4. During cooldown, evaluation returns "In cooldown"
Example: A rule with cooldown_minutes: 60 can only trigger once per hour, even if the condition remains true.

Notifications

When an alert rule triggers, a notification is created:
Notifications appear in:
  • /api/notifications endpoint
  • Real-time SSE stream (/api/events)
  • Mission Control dashboard UI

Automatic Evaluation

Alert rules are evaluated automatically by the scheduler:
  • Frequency: Every 5 minutes (configurable via MC_ALERT_EVAL_INTERVAL)
  • Scope: All enabled rules across all workspaces
  • Cooldown respected: Rules in cooldown are skipped
You can also trigger manual evaluation using POST /api/alerts with {"action": "evaluate"}.

Security Considerations

  • SQL Injection Protection: Only whitelisted columns are allowed in condition_field
  • Role Requirements:
    • Create/Update: operator role
    • Delete: admin role
    • List/Evaluate: viewer role
  • Workspace Isolation: Rules only evaluate entities in their workspace

Best Practices

  1. Use appropriate cooldowns - Balance responsiveness vs. noise
  2. Test with evaluate - Manually trigger evaluation during setup
  3. Monitor trigger counts - High counts may indicate misconfigured rules
  4. Combine with webhooks - Use alerts + webhooks for external integrations
  5. Name descriptively - Use clear names like “Agent Offline > 30min”

Rate Limits

  • Creation/updates: 100 requests/minute per API key
  • Evaluation: Manual evaluation limited to 1 request/10 seconds
  • Automatic evaluation: Every 5 minutes (not user-controlled)
Alert rules that trigger frequently (due to low cooldown or persistent conditions) can generate many notifications. Monitor your notification volume.