Back to Blog
Tutorial

Alex Thompson5 min
Ctrl+C

You fire off a long-running computer use agent and want a UI that updates in real time. You also need to handle network glitches without losing sync. The GET /v1/runs/{id}/events endpoint streams Server-Sent Events for exactly this scenario. It returns status changes, step events, and actions as they happen. Using the Last-Event-ID header lets you reconnect safely after a drop.

How it works

Start a task run with POST /v1/runs. The run enters queued, then running. When running, the server streams events through GET /v1/runs/{id}/events. Each line starts with data: and contains a JSON event. Fields include status (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out), event_type (status_change, step, action, error), and optional details like step_id, field_name, and step_result. If the connection drops, send the Last-Event-ID header on the retry request to resume from the last received event.

bash
curl -sS -N https://coasty.ai/v1/runs/abc123/events \ 
  -H "X-API-Key: $COASTY_API_KEY" \ 
  -H "Accept: text/event-stream" \ 
  -H "Last-Event-ID: 42"

Key response fields

  • status: one of queued, running, awaiting_human, succeeded, failed, cancelled, timed_out
  • event_type: status_change, step, action, error
  • step_id: unique identifier for a task step (for if/loop/retry logic)
  • field_name: name of the field being written or read (e.g., input, username)
  • step_result: JSON payload for step-level results or assertions
  • timestamp: unix epoch time of the event

Reconnect with Last-Event-ID to resume streaming exactly from where you left off.

Where this beats brittle automation

Traditional bots rely on stable selectors or API wrappers that break when UI changes. A computer use agent sees the screen, reads text, clicks buttons, and types inputs. The SSE stream lets you show every click, every file opened, every assertion result in real time. You get observability that pure API calls cannot provide. Last-Event-ID makes this stream resilient to network blips, so your dashboard never falls out of sync.

Add real-time dashboards to your computer use agents. Stream events, reconnect safely, and surface progress to users. Get a key at https://coasty.ai/developers and start building live agent UIs today.

© 2026 Coasty

Backed byYCombinator