Skip to main content
GET
Get a run by id
Fetch one run by id. Use this to poll an async submission, review a historical run, or pull the full per-step event timeline for debugging.

Overview

  • Method: GET
  • Path: /browser-agent/{id}
  • Auth: same Authorization: Bearer YOUR_API_KEY as Run a Task
  • Scope: you can only fetch runs created with your own API key.

Path Parameters

Query Parameters

Response

Returns the same BatchResult shape produced by POST /browser-agent. See Run a Task → Response Schemas for the field-by-field breakdown.

In-progress runs

While status === "processing":
  • results[i] holds a completed task when task i has finished, otherwise a synthesized pending stub with { url, instruction, input, status: "PENDING" } so your UI can always render the task row.
  • completed counts how many tasks have a real result (not stubs).
  • When includeEvents=true, liveEvents[i] holds the in-flight event stream for each still-running task. Completed tasks get liveEvents[i] = [].

Completed runs

When status === "completed" (or "failed"):
  • Every results[i] is a real TaskResult.
  • liveEvents is omitted (all timelines live on results[i].events when includeEvents=true).
  • completedAt is populated.

Example — polling an async run

Example — full timeline for one task

Each TaskResult now carries an events array, and while any task is still running liveEvents is populated too.

Event timeline

The events array records every step the agent took. Each event is { type, data, ts? }. Event types you’ll see:
Internal fields (sandbox provider, LLM model, token counts) are stripped from events before they’re returned. You only see what your task did, not how we ran it.

Status Codes

Polling Patterns

Python — poll until done

Node.js — poll with exponential backoff

For interactive UIs use stream: true on the initial Run a Task request to skip polling entirely. Use GET /browser-agent/:id?includeEvents=true only to reconstruct timelines for historical runs.

Next: List Tasks

Paginate over every task submission your API key has created, filter by status.

Authorizations

Authorization
string
header
default:YOUR_API_KEY
required

API key for authentication. Get your API key from https://pre.dev/projects/key (Solo) or https://pre.dev/enterprise/dashboard?page=api (Enterprise). Use format: Bearer YOUR_API_KEY

Path Parameters

id
string
required

Run id (24-char Mongo ObjectId).

Query Parameters

includeEvents
boolean
default:false

Include per-step event timelines. Payloads can be large — screenshots inflate them fast.

Response

Run result.

Run summary. The schema is named BatchResult for backwards compatibility with older clients.

id
string

Run id (24-char Mongo ObjectId).

total
integer

Total tasks in the run.

completed
integer

Number of tasks that have finished (any status).

results
object[]

Per-task results aligned by taskIndex. In-progress runs return PENDING stubs for tasks that haven't started; the stub has only url, instruction, input, and status: "PENDING".

totalCreditsUsed
number

Sum of credits billed across all tasks in the run.

status
enum<string>
Available options:
processing,
completed,
failed
createdAt
string<date-time>
completedAt
string<date-time>

Populated once status !== "processing".

liveEvents
object[][]

Only present when includeEvents=true on GET /:id. Per-task in-flight event streams for tasks that haven't yet finished. Aligned by index with results; completed tasks get an empty array.

error
string

Set only when status === "failed".