Browser for agents

env.BROWSER gives your server code a real browser, in the cloud or on a computer of your own, for web apps that have no API for what you need. Your agent opens pages, clicks, fills in forms, reads and takes screenshots. It can keep each user's login, and hand the browser to the user through a live view so they log in themselves before the agent carries on.

env.BROWSER is available to every workspace and paid as usage. Reference it in any api/*.js file and it's wired up on deploy, nothing to set up.

Open a browser and act

const b = await env.BROWSER.open({
  allow: ["*.example.com", "login.microsoftonline.com"], // or "open"
  profile: "user-123", // keep this user's login between runs
});
await b.goto("https://app.example.com/timesheet");
await b.click("button#submit");
const { text } = await b.text(".status");
await b.close({ save: true });

Every call is async and returns a plain object, except env.BROWSER.session(id) and env.BROWSER.available. Element actions wait up to 30 seconds for the element; pass { timeout: ms } (1000 to 120000) as the last argument to change it. Every action result includes the page's url and title.

env.BROWSER

CallReturns
availabletrue when this app can use env.BROWSER (a property)
open({ allow, profile?, keepAlive?, passkeys?, node? })A browser b with b.id, b.profile, b.restored (a saved login was loaded), b.profileUpdatedAt, b.keepAliveMs, b.passkeys, b.node
session(id)The browser with that id, to continue in a later request or cron run. Not async: nothing is checked until its first action
log({ session?, limit? })The audit log, newest first
profiles.list()[{ name, bytes, updated }]
profiles.delete(name){ deleted }, false when there was no such profile (no error)
profiles.export(name){ cookies, origins } in Playwright's storageState format, or null
profiles.import(name, state){ profile, bytes, updatedAt }
  • allow (required): example.com is that host, *.example.com is it and every subdomain, "open" any public site. Requests anywhere else are stopped (the page sees a network error, and the log lists them under blocked). Private and internal addresses never load.
  • profile: a name of 1 to 128 letters, digits and _ . : @ - (a user id, say).
  • keepAlive: how long the browser waits idle before it closes, in milliseconds, 60000 to 1200000. Default 600000 (10 minutes).
  • passkeys: true to let pages ask for passkeys. Off by default (see Passkeys below).
  • node: the name of one of your browser machines, to open the browser on your own computer instead of in the cloud (see A browser on your own machine). b.node is its name, or null in the cloud.

A browser

CallReturns
goto(url, { waitUntil? }){ status, url, title }. waitUntil: load (default), domcontentloaded, networkidle0, networkidle2
click(selector, { waitForNavigation? }){ url, title }
fill(selector, value){ url, title }. Clears the field, then types. Typed values never reach the log
select(selector, values){ selected, url, title }. Matches an option's value or its text
press(key){ url, title }, e.g. Enter or Tab
wait(what){ url, title }. A selector, milliseconds, { text } or { navigation: true }
text(selector?) / html(selector?){ text } or { html }, of the element or the page
screenshot({ fullPage?, selector? }){ screenshot: { type: "image/png", data } } with data in base64
upload(selector, files){ uploaded }. files: [{ name, type, data }] in base64, 10 MB in all
download(urlOrSelector){ filename, contentType, size, data, source } with data in base64, at most 10 MB. A URL, a link, or a button or form that starts a download
pdf({ format?, landscape?, background? })The current page as a PDF, in the same shape as download. format: A4 (default), A3, A5, Letter, Legal, Tabloid
evaluate(expression){ value }: the result of running it in the page
info(){ url, title, tabs }
steps([...]){ ok: true, results } or { ok: false, failedAt, error, results }. Up to 50 actions in one call
liveView({ instructions?, timeoutMs?, readOnly? }){ url, readOnly, handoffId, expiresAt }
handoffState(){ active, ended, viewer, handoffId, durationMs, url, title }
save(){ profile, bytes, updatedAt }
close({ save? }){ closed: true, saved }. Closing an ended browser is fine
log({ limit? })This browser's audit log

Actions run in the newest tab (a login popup is usually it).

Downloading files

download gets a file with the browser's login, from any site in the allow list. Give it a full URL (or { url: "/path" } for a path on the current site), a link's selector, or the selector of a button or form that starts a download: the click is made and what it asks for is fetched instead of saved. Files the page builds itself work too.

Every redirect must be in the allow list. A site that ties a login to one network address may refuse the download (download_failed). To keep the file, put it in env.STORAGE. pdf() prints the page as shown, for receipts and pages without a download button.

Errors

A failed call throws an Error with status and code:

codestatusWhen
browser_not_on_plan403The workspace can't use env.BROWSER right now
unauthorized401The deploy predates a change to env.BROWSER: redeploy the app
browser_error400, 413, 429Bad input (allow missing, a bad profile name), a profile over 1 MB, or 1,000 profiles already
not_found404No such browser, or it belongs to another environment
session_ended410The browser closed (idle past keepAlive, or closed): open a new one with the same profile
not_allowed403goto or download (or one of its redirects) to a site outside allow
download_failed502The site refused the download or couldn't be reached (the message has its status)
too_large413A download or PDF over 10 MB
too_many_sessions4295 browsers open for the app, or 10 for the team, or 3 on one machine
timeout408The element or text didn't appear in time
action_failed422The action itself failed (the message says why)
unavailable503A browser couldn't be started just now: try again
no_such_node404node: your workspace has no machine by that name
node_not_allowed403node: the machine isn't allowed for this app
node_offline503node: the computer is off, or Cloudrizz Browser Machine isn't running on it
node_unreachable, node_closed, node_failed502node: the connection to the machine failed: try again
browser_node_error400node isn't a valid machine name

Let the user log in

Some logins need a person: Microsoft or Google sign-in, two-step codes. liveView gives the user the browser for a moment. They log in, press Done, and your agent carries on in the same browser.

const { url } = await b.liveView({ instructions: "Log in, then press Done." });
// Show url to this user only: anyone with the link controls the browser.
const { active } = await b.handoffState(); // check every few seconds
if (!active) await b.save();
  • timeoutMs: how long the link and the handover last, 60000 to 1800000 (default 600000). instructions: false gives the link without a handover.
  • readOnly: true: the user only watches (no clicks, typing or navigation) and there is no handover, so your agent keeps working while they watch.
  • The link can be shown in an iframe on your app's own pages (its .cloudrizz.app address and your verified domains), and nowhere else.
  • active turns false when the handover ends, and ended says how: finished (Done or Failed; check the page to see whether the login worked), timeout, or closed (the user closed the page and didn't come back within 30 seconds). Switching to another app on a phone to read a code doesn't count as closing.
  • viewer says whether the page is not_opened, watching, away (in the background) or left.
  • While the handover is active your code can still act, but its clicks and typing mix with the person's. Only read (handoffState, text, screenshot) until active is false.
  • keepAlive counts from your code's last call, not from the person's clicks. Checking handoffState every few seconds keeps the browser open; otherwise keep keepAlive longer than a person needs.

Passkeys

A cloud browser has no passkey, security key or Windows Hello, and the user's own can't reach it through the live view. So by default pages can't ask for one: sign-ins that would (Microsoft Entra often does) offer their other methods instead, such as an authenticator app or a code. If a passkey screen still shows, choose "Sign in another way". An organisation that allows only passkeys can't sign in here; its admin would need to allow another method for this login.

Saved logins

A profile keeps a user's cookies and each site's local storage, encrypted and only for your app. open({ profile }) loads it (local storage when the browser first reaches each site), and save() writes it back. IndexedDB isn't saved. Delete a profile when a user disconnects.

Several browsers can share a profile. Before each call a browser takes in what the others saved since it last looked: when a user logs in through a live view in one browser and it is saved, an agent's browser on the same profile is logged in from its next call (goto the page again to see it). save() never puts back what another browser changed meanwhile, and when two browsers changed the same cookie, the one saved first wins.

Preview and production are separate

Browsers, profiles and the log belong to the environment that made them: production, or one preview or branch deploy. A preview can't open production's browsers or load its users' saved logins (each deploy signs with its own key), and a profile saved in a preview stays there.

Audit log

Entries are { session, at, action, detail, ok, error, domains, blocked }: detail is the URL or selector (never a typed value), domains the sites loaded, blocked the ones the allow list stopped. Kept 30 days, up to 500 per call (default 100).

A browser on your own machine

Some sites turn away browsers in the cloud (bot protection), or tie a login to your office's internet address. For those, run the browser on a computer of your own: an office PC that stays on, or a virtual machine. Websites then see an ordinary Chrome on your own network.

  • In the dashboard, open Workspace, then Browser machines, and press Download for Windows on that computer. Run it (Windows warns the first time: More info, then Run anyway). It shows a code and opens the dashboard, where a workspace owner or admin checks the code, names the computer and chooses which apps may use it. It then starts with Windows and shows a Cloudrizz icon by the clock. The computer needs Google Chrome.
  • On a Mac, Linux or a server, press "Mac, Linux or a server" on the same page for the program (it needs Node.js 22 or newer) and start it with --pair to approve it the same way.
  • To remove it: Settings, Apps, Cloudrizz Browser Machine, Uninstall on the computer, or Remove in the dashboard.
  • In the app, name the machine: env.BROWSER.open({ allow: ["example.com"], node: "office" }). Names are 1 to 40 lower-case letters, digits and dashes. Everything else works the same: actions, downloads, PDFs, saved logins, the live view and the log.
  • Handle node_offline in your app with a message to the user: the computer has to be on with the program running whenever the app uses it.

To see what a machine's browsers are doing, open Workspace, then Browser machines. Under each machine, "Browsers open now" lists the browsers apps have open there. Watch shows one live without letting you click or type. Take control lets you use it, for instance when an agent is stuck: the app sees this as a handover (handoffState() is active) until you press Done. Workspace owners and admins only, and each use is in the app's audit log.

You can also use a machine's Chrome yourself, with no app: Open a browser (optionally with an address to start at) opens one there and shows it to you in a new tab, where you click and type as if you sat at that computer, with an address bar, Back and Reload above it. It can reach any public website, and the local network only if the machine allows it. It starts with a fresh profile and keeps nothing when it closes. It stays open while you use it, closes 10 minutes after you leave it, or when you press Close. It counts toward the browsers a machine can have open at once, and anyone at that computer can see its window.

The computer must be on, with someone signed in to Windows:

The computer isBrowsers work?Why
Locked (Windows+L)YesYou are still signed in, so the program and Chrome keep running, and a hidden or minimized window keeps working.
Signed outNoThe program runs in your Windows session and starts when you sign in.
Asleep or hibernatingNoApps get node_offline. On a computer used for this, set Sleep to Never under Power settings.

What the program does on the machine:

  • Connects out to Cloudrizz; it opens no port to the outside.
  • Starts a Chrome with a fresh, temporary profile for each browser, and deletes it when the browser closes.
  • Keeps each browser to the sites the app allowed, all the time, also while a person uses the live view.
  • Never lets a browser reach that computer or your local network, unless a team admin turns on "Allow the local network" for the machine.
  • Downloads are fetched by the machine itself, from the same address as its browser.

Browser machines cost nothing extra. Up to 5 machines per workspace. Each machine has 3 browsers open at once by default; a team admin can set 1 to 20 per machine (Browsers open at once). Each browser takes about 300 to 500 MB of the machine's memory, more on heavy sites, so a computer with 8 GB runs 3 to 5 comfortably and one with 16 GB about 10. Whoever uses the machine can see what its browsers do, so use one your team controls.

Limits

  • Up to 5 browsers open per app and 10 per team.
  • In the cloud, the allow list applies while your actions run; during a live view the browser is in the user's hands. On your own machine it applies all the time.
  • Some sites recognise cloud browsers as automated and may refuse them or ask for extra checks: use a browser on your own machine for those.
  • Browser time is charged per hour a browser is open (see usage prices).