Tutorial

Stream Live Agent Progress with SSE and Last-Event-ID

Sophia Martinez||8 min
+W

You spin up a computer use agent to open a browser, log in, and fill a form. The agent runs in the background. You want to show progress on your dashboard without polling. Server-Sent Events let your server push events to your client as they happen. The /v1/runs/{id}/events endpoint streams status updates, errors, and other events for a task run. You can reconnect reliably with Last-Event-ID if the connection drops.

How it works

A task run is a server-driven agent execution. You start it with POST /v1/runs. The run has a state: queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. To get live updates, open a GET /v1/runs/{id}/events stream. The server sends Server-Sent Events (SSE). Each event has a type and data. The data contains the event details, such as the current state or an error message. If the connection breaks, send the Last-Event-ID header with the last received event ID when reconnecting.

bash
curl -N -H 'X-API-Key: $COASTY_API_KEY' \
  https://coasty.ai/v1/runs/abc123/events

Reconnect with Last-Event-ID

  • When the network drops, close the connection gracefully.
  • When reconnecting, include the Last-Event-ID header with the ID of the last event you received.
  • The server resumes streaming from the event after that ID.

Use the Last-Event-ID header to reconnect after network hiccups.

Where this beats brittle automation

Traditional automation uses selectors or hard-coded API calls. If the UI changes, the step fails. A computer use agent reads the screen, understands the context, and acts like a human. With SSE, you see every step in real time, not just final results. You can pause on awaiting_human, handle failures, and integrate with your own UI. You get visibility into what the agent sees and does, not just a black box.

Start streaming live agent progress with SSE and Last-Event-ID. Create a dashboard that shows every step of your computer use agent. Get your API key at https://coasty.ai/developers to begin.

Want to see this in action?

View Case Studies
Try Coasty Free