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:Connection limits
- Heartbeat: every 30 seconds. Missing three in a row → connection closed.
- Max duration: 24 hours. At ~23:55 Sly sends a
reconnect_requiredevent. 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
Liveness
The server tracks which agents are currently connected. You can query:active even when disconnected. It just won’t receive push events until it reconnects.