Back to Blog
Tutorial

Priya Patel7 min
Ctrl+C

You fire off a long-running agent run and want live updates. You need to reconnect if the network flakes. Coasty gives you Server-Sent Events via GET /v1/runs/{id}/events. Last-Event-ID lets you skip replayed events after a reconnect. This guide shows exactly how to hook into the stream and handle reconnects with real fields and pricing.

How it works

POST /v1/runs starts an agent run and returns a run_id. Then GET /v1/runs/{id}/events streams Server-Sent Events. Each event has a type, timestamp, and payload. The payload includes status (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out) plus step details. If the connection drops, send Last-Event-ID on the next request to resume from the tracked event. The server never resends the same event ID.

bash
curl -sS https://coasty.ai/v1/runs/{run_id}/events
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Accept: text/event-stream" \
  --no-buffer

Streaming fields and events

  • GET /v1/runs/{id}/events returns Server-Sent Events.
  • Each event has an id, type, timestamp, and payload.
  • Payload contains status, step details, and trace.
  • Use Last-Event-ID header to reconnect without gaps.
  • The server never repeats an event ID.
  • Status values: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.

Send Last-Event-ID on reconnect to resume streaming without gaps.

Where this beats brittle automation

API-only tools wait for success or a timeout. With streaming events you see each step, status, and any human approval prompts in real time. You can pause, cancel, or resume runs instantly. This beats brittle selectors because you get telemetry on every screen interaction, not just a final return code. Your UX can show a live terminal, a progress bar, or a webhook payload per step.

Integrate SSE streams into your dashboard or webhooks. Add Last-Event-ID for robust reconnects. Get your key at https://coasty.ai/developers and start streaming live agent progress.

© 2026 Coasty

Backed byYCombinator