Browser agent

Hand a task that needs clicking, a form or a sign-in to a hosted browser agent, then poll it from later runs until it finishes.

For a plain public form, use web_form_fields first. Use bowmark.browser_agent for the remaining interactive work: a wizard, a filter panel, or a sign-in. It is billed per task, so also prefer a site's own functions or read.page for a read.

Get structured data

// run 1
return bowmark.browser_agent.start({
  task: "Go to https://example.com/some-page and return the value shown for X",
  outputSchema: {
    type: "object",
    properties: {
      found: { type: "boolean" },
      value: { type: "string" },
      note: { type: "string" },
    },
    required: ["found", "value", "note"],
  },
});

// a later run, once status is "idle"
const st = await bowmark.browser_agent.status(id);
const answer = JSON.parse(st.result); // result is a string: parse it
return answer.found ? answer.value : answer.note;

Leave out outputSchema when you want prose. Keep a found field in the answer. An empty list, or found: false, does not prove the thing is absent: the agent may not have found it, and note says what it saw. For a search, also add a string field such as siteMessage and ask the agent to copy the site's own on-screen message into it, such as "no results for those criteria". That tells "the site has no data" apart from "the agent missed the form".

Start, poll, stop

Start it in one run(), then check on it from separate, later runs. A run is capped at 90 seconds, so never wait on the agent inside the run that started it.

idempotent: true is an option of the SDK's outer run() call, not an option of browser_agent.status(). Raw HTTP has no equivalent option: if a connection resets, send the same status script again with the same session id.

import { run } from "@bowmark/web";

// run 1: start it, and show your user the watch link
const startedEnv = await run(
  `return bowmark.browser_agent.start({ task: "Go to https://example.com and find the price" })`,
);
if (!startedEnv.ok) throw new Error(startedEnv.error ?? `Bowmark run ${startedEnv.status}. Check incomplete.cutOff.`);
const started = startedEnv.result;
const { id, watchUrl } = started;

// run 2, 3, 4 …: one call each, until it finishes
for (;;) {
  const statusEnv = await run(
    `return bowmark.browser_agent.status(${JSON.stringify(id)}, { waitMs: 45000 })`,
    { idempotent: true }, // a poll is safe to repeat, so a connection reset is retried
  );
  if (!statusEnv.ok) throw new Error(statusEnv.error ?? `Bowmark run ${statusEnv.status}. Check incomplete.cutOff.`);
  const st = statusEnv.result;
  if (st.status === "needs_input") { /* ask your user, then send(id, answer) */ break; }
  if (st.status === "idle") {
    console.log(st.result);
    await run(`return bowmark.browser_agent.stop(${JSON.stringify(id)})`, { idempotent: true });
    break;
  }
  if (st.status === "failed") { console.error(st.error); break; }
}
from bowmark_web import run

# run 1: start it, and show your user the watch link
started_env = await run(
    'return bowmark.browser_agent.start({ task: "Go to https://example.com and find the price" })'
)
if not started_env["ok"]:
    raise RuntimeError(started_env["error"] or f"Bowmark run {started_env['status']}. Check incomplete.cutOff.")
started = started_env["result"]
id, watch_url = started["id"], started["watchUrl"]

# run 2, 3, 4 …: one call each, until it finishes
while True:
    status_env = await run(
        f"return bowmark.browser_agent.status({id!r}, {{ waitMs: 45000 }})", idempotent=True
    )
    if not status_env["ok"]:
        raise RuntimeError(status_env["error"] or f"Bowmark run {status_env['status']}. Check incomplete.cutOff.")
    st = status_env["result"]
    if st["status"] == "needs_input":
        break  # ask your user, then send(id, answer)
    if st["status"] == "idle":
        print(st["result"])
        await run(f"return bowmark.browser_agent.stop({id!r})", idempotent=True)
        break
    if st["status"] == "failed":
        print(st["error"])
        break
# run 1: start it. The response's result carries id and watchUrl.
curl -s -X POST https://api.bowmark.ai/v1/run \
  -H "Authorization: Bearer $BOWMARK_API_KEY" -H 'Content-Type: application/json' \
  -d '{"script":"return bowmark.browser_agent.start({ task: \"Go to https://example.com and find the price\" })"}'

# run 2, 3 …: poll until status is idle
# HTTP has no `idempotent` option. If this request resets, send this same body again.
curl -s -X POST https://api.bowmark.ai/v1/run \
  -H "Authorization: Bearer $BOWMARK_API_KEY" -H 'Content-Type: application/json' \
  -d '{"script":"return bowmark.browser_agent.status(\"<id>\", { waitMs: 45000 })"}'

A session() or plain typed-client call refuses browser_agent with run_only. Your key is fine: call it through run().

The calls

CallWhat it does
start({ task, ...options })Starts a session. Returns id, status, watchUrl, backend, model, warnings. Never the answer
status(id, { waitMs?, cursor? })Waits up to waitMs (capped at 45,000) for progress, then returns the session. See below
send(id, message)Answers a needs_input question, or gives a new instruction. message is a string
stop(id)Closes the session. Always call it when you are done
list()Every session you hold open
watchLink(id)A fresh watch link. The old one stops working

send takes the message as a plain string, not an object like start's { task }:

await bowmark.browser_agent.send(id, "House number 12")        // right
await bowmark.browser_agent.send(id, { message: "House number 12" }) // throws

start() options:

OptionWhat it does
taskRequired. Plain-language instructions, including the URL. There is no url field
outputSchemaA JSON Schema. The answer comes back as a JSON string matching it
backend"auto" (default), "jev" (fast; needs the site's URL in task), or "browser_use"
modelThe model to use
maxCostUsdThe most one agent turn may cost you. Default $2, max $25
proxyCountryAn ISO two-letter country code to browse from, like "KE". Only applies with backend: "browser_use"
timeoutMsHow long to wait for each call to answer. Default 30,000, max 55,000. It does not give the agent more time

Save watchUrl when start() returns. status() does not repeat it.

Preview before submit

The browser agent has no preview or dry-run mode, and it does not guarantee that it will not submit. To fill in a public form without submitting it, use web_form_fields: a form fill only submits when you pass submit: true, and that is the only way to commit. Verify each site before you run the browser agent on a live account.

Cost and data location

maxCostUsd is a per-run ceiling: each browser-agent run stops at $2 by default, or at the value you set up to $25. It is separate from your account's monthly spend cap, which starts at $50. See Pricing for both.

There is no EU-only browser-agent option. The browser_use backend runs through Browser Use, which does not publish its processing location. The jev backend uses Vercel's AI Gateway and an AI model provider. See Data and compliance and privacy policy sections 6 and 7 before sending regulated data.

What status(id) returns, field by field

FieldTypeMeaning
idstringThe session id
status"running" | "needs_input" | "idle" | "failed" | "stopped" | "closed"idle = done, read result. needs_input = relay question
question{ kind: "question" | "takeover", question: string } | nullSet on needs_input. takeover means a person must act at watchUrl
resultstring | nullThe answer. Always a string: with outputSchema, JSON.parse it yourself
errorstring | nullSet on failed. See When it fails
steps{ at, kind: "thinking" | "action" | "message", text }[]What the agent did since your last cursor
cursorstringPass it to the next status() to get only new steps
taskstringThe task you started with
backendstringWhich agent ran: "jev" or "browser_use"
modelstringThe model used
closedbooleanWhether the session is closed
warningsstring[]Anything you should know about this call

Keep polling until idle, needs_input or failed. Most tasks finish in 1 to 4 polls, about 1 to 3 minutes. The same step repeating across polls is normal. Set your own give-up time at 5 minutes or more.

The login handoff

The browser agent has no stored credentials and no credential field. Text you write into task, a username and password included, is typed like any other instruction, so a login written there can complete with no pause. Do that only for throwaway or demo accounts, since the task text goes to the browser vendor and status() returns task exactly as you wrote it, password included, to anyone holding the session id. Otherwise, when a task meets a sign-in, an interactive CAPTCHA (reCAPTCHA, hCaptcha, Turnstile), a two-factor code or a magic link, status() returns needs_input with kind: "takeover". A plain distorted-text image code is often read and typed by the agent itself with no pause, but not on every run: a scheduled script should treat needs_input as a retry, not as proof the site needs a person.

Give the user watchUrl. They see the page the agent is stuck on.

They sign in or solve the challenge there.

They click "I'm done, hand it back", or you call send(id, "..."). Keep polling.

After a person signs in during a session, later send() calls in that same session stay signed in. A new session starts signed out and needs a new sign-in: no login carries over between sessions. For a scheduled job that signs in, use a site with its own functions and a stored login. On a site with no functions, save the login once from Bowmark Buddy and read its pages with bowmark.read.page(url, { connection }) until the login expires (about 7 days); see Sites without their own functions. Use the browser agent there only when a person will sign in on every session. bowmark.secret() in a task string sends the placeholder text, not the value.

A session left at needs_input is billed until it closes. Call stop() if nobody will act. File uploads and certificate logins are not supported.

Some sites require a CAPTCHA or human verification on every request. Brazilian municipal tax portals such as IPTU and CND, some bank logins, and government-ID flows commonly do. Each run will pause at needs_input or takeover, so they are not a fit for unattended, high-volume work.

The fast backend (backend: "jev") cannot hand a sign-in to a person. When it stops on a sign-in page it answers from that page if it can, and otherwise returns status: "failed" with an error starting the agent stopped on a sign-in page. Omit backend to get the handoff above.

When it fails

status: "failed" carries an error. Its start tells you what to do:

error starts withWhat to do
blocked: The site refused the browser. Don't retry it. Try read.page or another source
connection_failed: Bowmark's browser never reached the site. Start a fresh session. If it repeats, try later
merchant_verification_failed: A buying task named a merchant the agent could not confirm. Put the merchant's own domain in task and retry
anything elseThe task ran too long and was cut off. Make it narrower, or send() the next part

A failed session stays open. send() a narrower instruction to try again in the same browser, or stop() it.

A rejected login is not in that table. Bowmark does not classify a wrong password today. The session can finish idle with a result that describes the sign-in page, with no error, so read the answer and do not trust idle alone. For a site with a typed provider, use its login(). Otherwise add an answer field such as loggedIn to outputSchema and check it.

When a status() call itself throws:

What you seeWhat to do
ECONNRESET, socket hang up, a client timeoutThe agent kept working. In the SDK, pass idempotent: true to the outer run() call, not to status() or stop(). With HTTP, re-POST the same status script with the same id
vendor-refusedRetry once or twice. If it repeats, wait 5 minutes and start a fresh session
status: "stopped" or "closed"Start a new session. A closed id cannot be resumed

start() refused with "paused on Bowmark's side, not yours" (older builds said "temporarily unavailable due to a balance issue"). Is this my cap, a declined card, or Bowmark's? It is Bowmark's: our own prepaid AI balance fell below its safety floor. Your spend cap, card and usage never cause it, and nothing you change clears it. It lasts until we top up, usually hours. Your own cap refuses differently (HTTP 402, see HTTP API). Retry at most every 30 minutes and use read.page meanwhile.

After a network error on start(), call list() before starting again. A session may already be running.

Limits

LimitValue
Open sessions per account3. A finished or failed session holds a slot until you stop() it
One run()90 seconds. Poll from separate runs
One agent turn5 minutes, then it reads failed
Idle sessionClosed after 20 minutes, billed until then
Spend per agent turnmaxCostUsd, default $2, up to $25

A run returns text only. result cannot carry a file the browser downloaded, such as a PDF invoice. For a document, use the download function of a typed provider, or read.page on a public link to the file.

At 3 sessions and a few minutes per task, about 15 tasks fit in 15 minutes. For a frequent check on many items, ask for the site.

Answers can differ between runs

The agent reads the page with a language model, so the same task can return different answers. Where consistency matters, run it 2 or 3 times and take the majority, or confirm a change before you act on it.

Cost

Each task is billed on the model turns it takes plus the browser time it holds open, itemized as browser_agent.vendor on your billing dashboard. Rates and a worked example: Pricing.