Back to Blog
Tutorial

Sophia Martinez5 min
Ctrl+S

You are building an autonomous agent that runs tasks on virtual machines. You need to see its state and steps as they happen, not just the final result. The Coasty Computer Use API gives you Server-Sent Events (SSE) for live progress streams. You can reconnect with Last-Event-ID so a network blip does not drop you out of the run.

How to stream live agent progress

Create a task run with POST /v1/runs. Include a valid machine_id and a task description. Set cua_version to v3 for guided tasks or v4 for autonomous verification. You do not need a webhook_url because the stream is the primary way to consume progress. The response is a 202 Accepted with the run_id. Convert it to a GET request to GET /v1/runs/{id}/events. This endpoint returns a Server-Sent Events stream. Each event has a type field and a data field with JSON. The type can be queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. The data object includes step_id, step_type, state, and any error details. If the connection drops, send a GET request again with the Last-Event-ID header set to the last event ID you received. The server resumes from that point.

bash
export COASTY_API_KEY=$(cat ~/.coasty_key)

# Create a task run
RUN_RESPONSE=$(curl -s -X POST https://coasty.ai/v1/runs \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "vm-12345",
    "task": "Open Chrome and go to https://example.com",
    "cua_version": "v3",
    "max_steps": 50
  }')

RUN_ID=$(echo $RUN_RESPONSE | jq -r '.run_id')
echo "Created run $RUN_ID"

# Stream events
curl -s -N https://coasty.ai/v1/runs/$RUN_ID/events \
  -H "Authorization: Bearer $COASTY_API_KEY" | jq -c '{type, data}'

# Reconnect with Last-Event-ID
curl -s -N https://coasty.ai/v1/runs/$RUN_ID/events \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -H "Last-Event-ID: 12345" | jq -c '{type, data}'

Server-Sent Events fields and status values

  • GET /v1/runs/{id}/events returns lines prefixed with type: and data:, each terminated by a newline.
  • Event types: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
  • Each event data contains step_id, step_type, state, and any error.message.
  • A run is billed $0.05 per agent step. Steps are emitted as events with type: running and step_type: task.
  • When type: succeeded, the run completed successfully. When type: failed, the run ended with an error.

Use GET /v1/runs/{id}/events with Last-Event-ID to reliably stream live agent progress.

Why computer use beats brittle selectors

Traditional tools rely on stable selectors, XPaths, or element IDs. When a UI changes, those selectors break. Coasty agents see the screen like a human. They follow visual cues, use natural language instructions, and adapt to layout shifts. SSE gives you real-time telemetry for every action, letting you debug agent behavior instantly. You can see which steps succeeded, which failed, and where the agent paused waiting for human input. This visibility is impossible with purely API-based integrations that only return a final result.

Start streaming live agent progress with SSE and Last-Event-ID. Build dashboards that show step-by-step execution, react to errors, and handle human approvals. Get your API key at https://coasty.ai/developers and try it with your first task run.

© 2026 Coasty

Backed byYCombinator