Engineering

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

Priya Patel||6 min
Ctrl+C

When an agent runs a long automation task, you need visibility into every step. Instead of polling for status, use Server-Sent Events. Coasty's GET /v1/runs/{id}/events streams updates as they happen, and the Last-Event-ID header lets you reconnect without missing progress.

How it works

POST /v1/runs starts an agent run (billed $0.05 per step). The response provides a run_id. Call GET /v1/runs/{id}/events to stream Server-Sent Events. Each event contains status (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out) and payload data. If the connection drops, send Last-Event-ID: <last-read-event-id> to resume exactly where it left off.

bash
curl https://coasty.ai/v1/runs/{id}/events?timeout=60s -H "X-API-Key: $COASTY_API_KEY" -H "Accept: text/event-stream"

Key SSE fields and behavior

  • Status values: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
  • Each event is a Server-Sent Event (data: {...\n\n).
  • Use Last-Event-ID header to reconnect after a failure.
  • The endpoint streams until run completion or timeout.
  • Response headers include Coasty-Signature for HMAC webhook validation.

Use Last-Event-ID to reconnect safely and never skip a status update.

Where this beats brittle automation

Traditional tools require brittle selectors or frequent API polling. With a computer use agent, the agent sees the screen and acts like a human. Streaming events let you react instantly to changes, such as pausing on errors, showing progress to users, or handing off to a human when awaiting_human occurs.

Start streaming live agent progress with SSE and Last-Event-ID. Get your API key at https://coasty.ai/developers .

Want to see this in action?

View Case Studies
Try Coasty Free