Skip to main content

Overview

The Events API provides a Server-Sent Events (SSE) stream for real-time updates from Mission Control. This persistent connection delivers database mutations, system events, and state changes as they happen.
SSE is a one-way communication channel from server to client. Clients connect via EventSource and receive JSON-encoded events. Connection includes automatic heartbeat to prevent proxy timeouts.

Establish SSE Connection

GET /api/events

Open a persistent SSE connection to receive real-time events.

Response Headers

  • Content-Type: text/event-stream
  • Cache-Control: no-cache, no-transform
  • Connection: keep-alive
  • X-Accel-Buffering: no

Event Format

All events are JSON-encoded and follow this structure:
string
Event type identifier
object
Event payload (varies by type)
integer
Unix timestamp (milliseconds)

Event Types

Connection Events

connected

Sent immediately upon establishing SSE connection.

heartbeat

Sent every 30 seconds to keep connection alive through proxies.

Entity Events

agent:created

New agent provisioned.

agent:updated

Agent configuration or status changed.

agent:deleted

Agent removed from system.

task:created

New task created.

task:updated

Task modified (status, assignment, etc.).

task:deleted

Task removed.

notification:created

New notification for an agent.

activity:created

New activity logged.

System Events

alert:triggered

Alert rule condition met.

webhook:delivered

Webhook successfully delivered.

system:status_changed

System-wide status change.

Connection Management

Automatic Reconnection

EventSource automatically reconnects on connection loss:

Graceful Shutdown

Event Filtering

Client-Side Filtering

Use Cases

Live Dashboard Updates

Activity Feed

Real-Time Notifications

Performance Considerations

  • Connection Pooling: SSE connections are long-lived. Limit to 1 per client.
  • Heartbeat: 30s heartbeat prevents proxy timeouts.
  • Buffering: Response buffering is disabled (X-Accel-Buffering: no).
  • Browser Limits: Most browsers limit SSE connections to 6 per domain.

Error Handling

Authentication

SSE connections require valid authentication:

Error Responses

If authentication fails, the connection will close immediately with an error event.