Run the AI browser agent
Describe a goal. Prompteryx opens a browser, looks at the screen, clicks and types until the goal is met, and reports what it found and what it cost.
You write the goal in plain English. The agent runs in a stealth cloud browser (or, with the desktop app, in your own logged-in Chrome), takes up to a step limit you set, and returns a final answer, the steps it took, and a usage line with AI credits and cost.
With saveAsWorkflow the successful path is saved as a workflow in your account, so the next run costs no AI credits at all. Run it later with the workflow endpoints.
Three ways to run it
import { Prompteryx } from '@prompteryx/sdk'
const px = new Prompteryx({ apiKey: process.env.PROMPTERYX_API_KEY })
const result = await px.autopilot.run({
goal: 'Find the cheapest direct flight from London to Lisbon next Tuesday and screenshot the booking page',
startUrl: 'https://www.skyscanner.net', // optional
model: 'gemini-3.5-flash', // optional; ids in AUTOPILOT_MODELS
maxSteps: 30, // default 30
maxCredits: 50, // optional cost cap
saveAsWorkflow: true, // save the successful path for reuse
})
console.log(result.success, result.finalAnswer)
console.log(result.usage) // { aiCredits, tokensIn, tokensOut, costUSD, turns }
console.log(result.savedWorkflowId) // run it again with px.workflows.run(id)npx prompteryx agent "Find the cheapest direct flight from London to Lisbon next Tuesday" --save-as-workflow
# add --local to use your own Chrome through the Prompteryx desktop app (no cloud minutes)# Start the job (returns jobId + sessionId immediately)
curl -X POST https://www.prompteryx.ai/api/v1/ai-browser/execute \
-H "Authorization: Bearer px_live_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"instruction":"Go to https://www.skyscanner.net. Find the cheapest direct flight from London to Lisbon next Tuesday","maxSteps":30,"saveAsWorkflow":true,"mode":"start"}'
# Then advance it until status is terminal (each call runs up to ~230s server-side)
curl -X POST https://www.prompteryx.ai/api/v1/ai-browser/execute \
-H "Authorization: Bearer px_live_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"jobId":"JOB_ID","mode":"run"}'"Use Prompteryx to find the cheapest direct flight from London to Lisbon next Tuesday."
# The assistant calls the browser_ai_action tool. Setup: /docs/developers/mcp{
"success": true,
"finalAnswer": "Cheapest direct flight: LHR–LIS Tue 22 Sep, 07:05, £48 (Ryanair).",
"steps": [ { "action": "navigate", "url": "https://…" }, { "action": "click", "target": "Search" } ],
"savedWorkflowId": "wf_9c2…",
"usage": { "aiCredits": 12, "tokensIn": 48210, "tokensOut": 1930, "costUSD": 0.11, "turns": 9 }
}Each run spends AI credits (per model turn) and cloud browser minutes. Set maxSteps and maxCredits to cap a run.
Over HTTP, say where to start inside the instruction (as above). The SDK and CLI do this for you with startUrl / --start-url.
Models: omit model for gemini-3.5-flash, or pass any id from the SDK's AUTOPILOT_MODELS. An unknown id is refused with 400 UNSUPPORTED_MODEL and the list of valid ones. claude-sonnet-5-vision is now claude-sonnet-5-5-vision (renamed 30 Sep 2026; the old id still runs as Sonnet 5.5).
Out of AI credits: 402 QUOTA_EXHAUSTED. Out of cloud minutes: 429. Both messages say what to top up.
Access follows your balance, whatever plan you are on: if the account has credits and minutes, the agent runs. When either is exhausted the response says which one to top up.
Long tasks: the SDK and CLI poll for you. Over HTTP, use mode: "start" then repeat mode: "run" as shown above.