predev-api ships both the Architect and Browser Agents surfaces — one package, one key.
Installation
Quick Start
Authentication
Get your API key
Grab a key from the Browser Agents dashboard.
API Methods
browser_agent()
Submit one or more browser tasks and get the results back.
tasks(required):List[Dict]— see Task shape belowconcurrency(optional):int— parallel workers within this batch (1–20, default 5)stream(optional):bool— whenTrue, returns an iterator yielding SSE events instead of a final resultrun_async(optional):bool— whenTrue, returns immediately with{ id, status: "processing" }; poll withget_browser_agent(id)
- Default:
Dictwithid,total,completed,results,totalCreditsUsed,status - With
stream=True:Iterator[Dict]yielding{ "event": ..., "data": ... }frames - With
run_async=True:Dictwithidandstatus: "processing"— pollget_browser_agent(id)
Task shape
get_browser_agent()
Fetch the status and results of a task submission by id. Works for in-progress and completed submissions.
batch_id(required):str— id returned frombrowser_agent(..., run_async=True)or from streaminginclude_events(optional):bool— whenTrue, includes the full per-step event timeline (navigation, plan, screenshot, action, validation) for each task. Payloads can be large.
Dict with the same shape as browser_agent() sync response, plus events[] on each task (or liveEvents[] for tasks still in flight) when include_events=True.
list_browser_agents()
List your past and in-progress runs, newest first.
browser_agent_status()
Your live queue snapshot — running / queued counts and your plan’s
in-flight cap. Poll it to throttle a large submit loop.
Response Shape
Examples
Sync — wait for every task
Async — poll for completion
Streaming — live per-step events
Full timeline for a past submission
Error Handling
The SDK raises typed exceptions for the most common gating cases. The two billing-gate exceptions carry anaction_url — a deep link back to pre.dev
that auto-opens the right modal (subscribe / buy credits) when the user
lands there. Same exceptions fire on REST and SSE error paths.
Mid-stream errors on the SSE stream raise the same typed exceptions — a
for msg in client.browser_agent(..., stream=True): loop wrapped in
try/except is enough.
