Back to blog posts

14 min

How AI browser automation agents work, and when to use them

Learn how a browser automation agent reads pages and picks actions. Compare agents with scripts and RPA.

Nicolas LecomteNico is a founder of Blaxel, who usually writes about AI, agentics, and the future of AI runtimes.

Some web tasks have no API behind them, and the sites change layouts faster than you can fix your scripts.

With AI browser automation agents, an agent turns a goal such as "download last month's invoices" into actions chosen at runtime. On every step, the LLM sees the page's Document Object Model (DOM), accessibility tree, screenshot, or a mix.

A Playwright or Selenium script works the other way around. Its developer hard-codes every selector before the run, and the script fails at the first element that moved.

Agents also fail in ways scripts don't. One can loop on a single step or report success on a task it never finished.

Key takeaways

  • A browser automation agent has an LLM pick each click and keystroke as the task runs.
  • Agents read pages through the DOM, the accessibility tree, screenshots, or a hybrid. Each method trades tokens against accuracy.
  • Scripts handle stable flows best. Browser agents earn their token cost on changing sites, and computer-use agents reach desktop apps.
  • Independent live-web tests score well below lab and vendor-reported numbers.
  • Treat page content as untrusted. Scope credentials, confirm irreversible actions with a human, and log every run.

What is a browser automation agent?

A browser automation agent is a program that lets a large language model (LLM) control a browser. The model reads each page and picks the next step toward a natural language goal. Then it acts and reads the page again.

By evaluating the page layout continuously, these agents adapt to minor UI updates that would otherwise break traditional automation tools.

What browser agents are used for

Public case studies, two of them published by Browserbase, document three main uses:

  • Data extraction: In April 2026, e-commerce data firm ShopVision reported 1.3 million Browserbase sessions in 30 days.
  • Invoices and receipts: Ramp's May 2026 Browserbase case study reports more than 5 million receipts a month.
  • End-to-end testing: Google's payments team uses Gemini 2.5 Computer Use to recover over 60% of failed test executions.

These deployment patterns show how web agents excel at handling repetitive workflows across uncooperative interfaces.

Browser agents vs scripts, RPA, and computer use agents

Moving from scripts toward agents trades predictability for flexibility. The computer use agent explainer covers full desktop control in depth.

DimensionScripts (Selenium, Playwright, Puppeteer)Robotic process automation (RPA)Browser agentsComputer use agents
ScopeOne browser, fixed flowDesktop and web apps, rules-drivenOne browser, goal-drivenFull desktop
PerceptionHard-coded selectorsSelectors and recorded UI targetsDOM, accessibility tree, screenshotsMostly screenshots
ReliabilityHigh until the UI changesHigh on stable UIsVaries by site and task lengthVaries, lower on long tasks
Cost per runNo LLM costLicense plus bot upkeepLLM tokens per stepLLM and vision tokens per step
MaintenanceSelector fixes after redesignsBot repairs after UI changesPrompt and eval upkeepPrompt and eval upkeep
Best forStable, high-volume flowsStructured enterprise processesDrifting layouts, many sitesNative apps outside the browser

Choose by how often the flow changes and where the work runs:

  • Scripts: Use them when the flow is stable, high volume, and checkable with fixed assertions.
  • RPA: It fits rules-driven processes across desktop and web apps, especially inside an existing RPA program.
  • Browser agents: They pay off when layouts drift, target sites multiply, or no API exists.
  • Computer use agents: Choose them once the task leaves the browser for native applications.

One flow can mix both approaches. Script the stable steps and hand only the fragile ones to the model.

How the agent and browser layers work together

The agent layer pairs an LLM with a framework. The framework turns each page into model input and parses the action the model picks. The browser layer runs local or hosted Chromium, headless (no window) or headed. Playwright or the Chrome DevTools Protocol (CDP) drives it.

How agents perceive a web page

The perception method drives much of an agent's token bill and accuracy.

Agents use one of three approaches:

  • Structure: The framework converts the DOM or accessibility tree into indexed text the model can reference.
  • Vision: The model reads a screenshot and returns coordinates. Set-of-Mark prompting overlays numbered boxes on interactive elements.
  • Hybrid: The agent sends structure on every step and adds a screenshot when layout matters.

Stagehand compared six formats on ten pages with claude-sonnet-5 in an October 6, 2026 benchmark post. The accessibility tree scored 88% read accuracy and 83% act accuracy. Screenshots scored 72% and 73%. A pruned DOM plus accessibility tree scored 96% and 97%, at 1.5 times the token cost of Markdown. The results come from one vendor testing one model.

Screenshots also cost time. In October 2025, Browser Use reported that each screenshot adds about 0.8 seconds of inference. Its agent at the time navigated mainly by DOM and captured screenshots only when needed.

How agents act through Playwright and the Chrome DevTools Protocol

CDP is the low-level channel for controlling Chrome. Commands such as Input.dispatchMouseEvent, Input.insertText, and Page.navigate enable click, type, and URL navigation.

Playwright wraps those primitives in checks. Before a click, it waits for the element to be actionable. The element must be visible, stable for two animation frames, and not disabled. If the checks don't pass before the timeout, the action throws a TimeoutError.

Since Chrome 132, the old headless mode ships only as chrome-headless-shell. The --headless flag now runs a new headless mode built on regular Chrome. Pick headless for unattended batch work and headed when someone needs to watch the screen.

The observe, plan, act, and verify loop

Each step follows the same cycle:

  1. Observe: The framework captures the DOM, accessibility tree, or a screenshot.
  2. Plan: The LLM chooses one action toward the goal.
  3. Act: The framework executes it through CDP or Playwright.
  4. Verify: The agent reads the new state, then stops on success or at its step limit.

Browser Use 1.0 shipped on November 10, 2026. It replaced 24 browser actions with one tool: a persistent Python REPL with raw CDP access. Its README shows a minimal local run:

Python
from browser_use import Agent, Browser, ChatOpenAI

agent = Agent(
'Find the number of stars of the browser-use repo',
llm=ChatOpenAI('gpt-6-luna'), # reads OPENAI_API_KEY
browser=Browser('chromium'), # a fresh local Chrome with its own temp profile
)
print(agent.run_sync().final_result()) # in async code: result = await agent.run()

This continuous feedback loop enables the agent to recover from unexpected pop-ups or layout changes dynamically.

Browser automation agent tools in 2026

As of November 2026, tools fall into three groups: agent frameworks, hosted browser infrastructure, and AI lab browser modes.

ToolTypeLicenseLanguageModelsHosting
Browser UseAgent library plus cloudMITPythonPydantic AI model strings, Anthropic, Google, OpenAI-compatibleLocal Chrome or Browser Use Cloud
StagehandBrowser SDK with AI stepsMITTypeScript, Python, GoOpenAI, Anthropic, Google, Groq, Cerebras, custom callbackLocal Chromium or Browserbase
SkyvernVision-first agentAGPL-3.0 core, some cloud features excludedPython, TypeScript clientOpenAI, Anthropic, Azure, Bedrock, Gemini, Ollama, OpenRouterSelf-hosted or Skyvern Cloud
Midscene.jsVision-first frameworkMITJavaScriptQwen, Doubao, Gemini, GPT and othersLocal, no hosted tier stated
Playwright MCPMCP serverApache-2.0Node.jsAny MCP client's modelLocal
BrowserbaseHosted browsersCommercial servicePlaywright, Puppeteer, Selenium, Stagehand clientsNot applicableCloud
BrowserlessHosted browsersCommercial servicePuppeteer, Playwright, CDP clientsNot applicableCloud or private deployment

Open source agent frameworks

Open-source agent frameworks provide flexible building blocks for integrating autonomous browser control into custom applications.

Key open-source frameworks currently leading the ecosystem include:

  • Browser Use is an MIT library. Version 1.0 defaults to a Browser Use Cloud browser and the bu-4.0 model on its gateway. Its model docs accept any Pydantic AI model string.
  • Stagehand version 4 removed its agent() call. The v4 migration guide states: "agent() is gone. Nothing in v4 replaces it one-for-one." Developers compose act, extract, and observe inside their own control flow. Stagehand drives any Chromium browser over CDP. Server-side caching is a Browserbase feature.
  • Skyvern relies on vision LLMs and ships a no-code workflow builder.
  • Midscene.js treats HTML, Canvas, and desktop apps as screenshots.
  • Playwright MCP hands agents accessibility snapshots by default, with vision as an opt-in.

Choosing the right framework depends on whether your project prioritizes vision processing, DOM navigation, or modular step execution.

Hosted browser infrastructure

Hosted providers run fleets of Chromium browsers and give agents a CDP or Playwright endpoint. They also manage session lifetimes, recordings, and stored logins. Browserbase's Live View lets a person take over a running session.

Browserbase pricing lists a Free plan with three concurrent browsers and 15-minute sessions. Developer costs $20 a month for 25 browsers, and Startup costs $99 for 100 browsers. Scale pricing is custom.

The Browserless free plan offers two concurrent browsers and 2-minute sessions. The Scale plan extends sessions to 60 minutes, so match the plan to your longest task. Browserless refuses video recording once the agent fills a credential, because the recording could capture the secret.

Browser modes in computer use offerings

All three major labs now separate browser tasks from full desktop control. Anthropic's computer_toolset_20260801 works in an environment you control. A separate browser_toolset_20260801 handles tasks inside webpages without a desktop.

OpenAI has shut down its computer-use-preview model. The computer use guide routes screenshot work to ComputerToolset and page-reading work to BrowserToolset. Google's Gemini Computer Use tool offers an ENVIRONMENT_BROWSER mode on models including gemini-4-argon.

How to deploy browser agents safely

Every page an agent reads is untrusted input. Anthropic red-teamed Claude for Chrome in August 2025. Prompt injection attacks succeeded 23.6% of the time without mitigations and 11.2% with them.

These controls limit what a misled agent can do:

  • Untrusted content: Keep page text away from permission decisions.
  • Credentials: Browser Use 1.0 shows the model only secret names. The library types the values with type_secret. Its docs warn this is not a sandbox, since model-written code can still read the values. Stagehand substitutes variables locally, but its act docs say to set cache: false on credential calls.
  • Least privilege: Limit the sites an agent can visit with Browser Use's allowed_domains. Use low-privilege accounts. OWASP's LLM01:2025 guidance recommends that developers restrict model privileges to the minimum necessary.
  • Human confirmation: Require a person's approval before purchases, destructive changes, or any form entry that sends sensitive details. OpenAI recommends the same checkpoints for computer use.
  • Bounds and audit logs: Set step, time, or cost limits. Keep session replays and verify the result in the target system itself.
  • Isolated execution: Run any code the agent writes somewhere other than your host. The browser sandboxing guide for coding agents covers that setup.

Implementing these defensive practices minimizes operational risks while allowing agents to run securely in production environments.

Reliability and where browser agents fail

Scores depend on the harness, the evaluator, and whether sites are live. The OSWorld-Verified leaderboard runs desktop tasks in a controlled virtual machine. Its top-ranked entry, dated August 1, 2026, outscores the people tested in the original study.

Live-web results look different. The April 2025 paper that introduced Online-Mind2Web found four of six agents scored "around 30%". Vendor figures run higher. In March 2026, OpenAI self-reported 92.8% on Online-Mind2Web for GPT-5.4 using screenshots alone.

The same failure modes recur across studies:

  • Longer failed runs: The Online-Mind2Web paper analyzed Browser Use, Claude Computer Use 3.7, and Operator. Their failed tasks took nearly twice as many steps as successful ones.
  • False completion: Skyvern's May 2025 Web Bench study lists agents hallucinating success among its top error categories.
  • Missed elements: Web Bench also cites agents failing to close pop-ups or find coupon buttons.
  • Incomplete workflows: An October 2026 WebArena-Lite audit found scrolling loops, premature answers, and incomplete form workflows.

Understanding these failure patterns helps developers design robust evaluation benchmarks and retry logic for production deployments.

Logins, CAPTCHAs, and site rules

Two-factor authentication (2FA) needs a person, and a CAPTCHA should end the run. A sample instruction in Google's computer use docs tells agents never to attempt to solve or bypass CAPTCHAs.

Claude Code's Chrome integration pauses at a login page and asks the user to handle it. Browserbase's authentication guide says 2FA and magic links "usually require human intervention in the loop."

Once a person completes a login, reuse that logged-in session instead of storing passwords. Browserbase Contexts and Browser Use's user_data_dir and cloud profiles both keep logins between runs.

Site rules apply to agents too. Under RFC 9309, robots.txt rules "are not a form of access authorization," and they set no request-rate limit. Each team must pace its own traffic. Terms of service carry contract risk. In a mixed November 2022 ruling, a court found hiQ breached LinkedIn's user agreement by scraping. Review the terms of every site an agent visits.

How Baseten Sandboxes secure agent code execution

Some browser agents also write and run code. Browser Use 1.0, for example, works through a Python REPL. Model-written code needs the same isolation as any untrusted program.

Baseten Sandboxes execute that generated code, and each sandbox is its own Firecracker microVM. Creation takes under a second. An idle sandbox resumes from standby in under 25ms.

The sandboxes don't host the browser session. The browser stays on your own Chromium or a hosted browser provider. Only the code the agent generates goes to a sandbox.

FAQs about browser automation agents

Is Browser Use open source?

Yes. The core library uses the MIT license. Browser Use also sells Browser Use Cloud, with hosted browsers and models. Local runs need Browser('chromium') or Browser('chrome'). Fully local runs also need your own model instead of its gateway.

What is a headless browser agent?

A headless browser agent drives a browser with no visible window. It suits scheduled server runs and continuous integration (CI) pipelines. Run headed to debug a trajectory or supervise a risky run.

Can browser agents handle CAPTCHAs and 2FA?

They shouldn't try. Route 2FA prompts to a person through a live session view. Anthropic's Claude in Chrome guidance prohibits bypassing CAPTCHAs. When a CAPTCHA appears, stop the run and check the site's terms.

Related articles