Engineering

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

Emily Watson||5 min
Home

You launch a computer use agent to run a browser task, a desktop workflow, or a multi-step operation. The agent needs time to complete tasks. You want to see what it does instantly instead of polling for status. The /v1/runs/{id}/events endpoint returns a Server-Sent Events stream of progress updates. You can reconnect with Last-Event-ID to skip already-seen events and resume exactly where you left off.

How it works

1. POST /v1/runs creates a task run and returns a run ID. The run enters queued, running, or awaiting_human state. 2. GET /v1/runs/{id}/events streams Server-Sent Events. Each event contains a status field (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out) plus optional data fields about the step. 3. On network interruption, reconnect the same URL and send a Last-Event-ID header with the last event ID you stored. The server skips old events and starts streaming from the next one.

bash
curl -N https://coasty.ai/v1/runs/RUN_ID/events \  \
  -H "X-API-Key: $COASTY_API_KEY" \  \
  -H "Last-Event-ID: 1234"

Key fields and states

  • status: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out
  • event_id: unique identifier for each event in the stream
  • step_id: identifier of the current agent step when status is running
  • Created via POST /v1/runs with machine_id, task, and optional instructions
  • Billed $0.05 per agent step for task steps in workflows or task runs

Use Last-Event-ID on reconnection to resume streaming without gaps.

Where this beats brittle automation

Traditional automation relies on brittle selectors and static APIs. If a UI changes or an element moves, your script breaks. The computer use agent sees the screen just like a human does. It uses vision to locate buttons, fill forms, and navigate apps. Watching live progress lets you spot issues early and adjust instructions without waiting for full completion. SSE with Last-Event-ID gives you real-time observability plus reliability across network interruptions.

Build dashboards that display live agent status, retries, and failures. Hook up notifications to Slack or Discord when a run succeeds or fails. Get an API key at https://coasty.ai/developers and start streaming live progress today.

Want to see this in action?

View Case Studies
Try Coasty Free