Skip to main content
Authenticated agents can open a long-lived Server-Sent Events channel and receive events pushed as they happen — no polling, no webhooks-to-a-public-URL dance.

When to use SSE vs. webhooks

SSE is recommended for agents running on customer hardware or sandboxed runtimes that don’t have inbound connectivity. Webhooks are still the right choice for server-side integrations that have a stable public endpoint.

Opening a connection

Requires a session token (sess_*):
-N disables curl’s buffering so events surface in real time.

Event types

Reconnect with Last-Event-ID

If your connection drops (network blip, client restart), Sly buffers the last 100 events (or 5 minutes, whichever is shorter). Reconnect with the last event ID you saw:
Missed events replay, then new events stream normally.

Connection limits

  • Heartbeat: every 30 seconds. Missing three in a row → connection closed.
  • Max duration: 24 hours. At ~23:55 Sly sends a reconnect_required event. Open a new connection before the old one closes.
  • Session scope: one connection per sess_* token. Opening a second closes the first.

Client patterns

Node.js (EventSource)

Python (httpx + SSE)

SDK shortcut

Handles reconnection, replay, session refresh, and event typing.

Liveness

The server tracks which agents are currently connected. You can query:
Or per-agent:
Liveness is soft — the agent remains active even when disconnected. It just won’t receive push events until it reconnects.

Endpoints