Design a Browser Agent
Understanding the Problem
🖱️ What is a browser agent? A browser agent completes tasks on websites the way a person does: it looks at the page, decides what to click or type, does it, looks again, and repeats until the task is done. "Book a table for four on Friday at 7 at this restaurant," "submit my expense report from these receipts," "find the cheapest flight that fits my calendar." OpenAI's Operator and ChatGPT agent, Anthropic's computer use and Claude for Chrome, and Google's Project Mariner are examples. Computer-use agents generalize the same loop from a browser to a whole desktop.
The interesting part is that the agent works through an interface built for humans, not an API. Pages are huge, visual, dynamic and full of pop-ups. Every page is also untrusted input: any text the agent reads, including a product review or a hidden div, can try to give it instructions. And many actions on the web are irreversible: a purchase, a sent message, a deleted account. So the design is about three things: how the model perceives and acts on pages reliably, where the browser runs and how it's isolated, and how we stop the agent doing something consequential the user didn't intend.
General agent infrastructure (durable runs, tool gateways, memory) is in Design an Agentic System, and loop patterns in Agent Design Patterns. We'll focus on what's specific to driving a browser, as a hosted consumer product with browsers in the cloud.
Functional Requirements
Core Requirements
- Users should be able to give a task in natural language and have the agent operate a browser to complete it, with a live view of what it's doing.
- The agent should ask the user to confirm before consequential actions (purchases, submitting forms, sending messages, deleting things), and users should be able to take over the browser at any time.
- The agent should be able to work on sites where the user is logged in, without the model ever seeing the user's passwords.
- Developers should get full traces and replays of every run, and an evaluation suite that gates model and harness changes.
Below the line (out of scope)
- Full desktop computer use (same loop, different executor and sandbox; we'll note the differences).
- Solving CAPTCHAs or evading bot detection. The agent hands control to the user instead.
- Large-scale scraping. This is a per-user assistant, not a crawler.
Non-Functional Requirements
Ask about volume, task length and what "safe" means to the product. We'll assume 1 million tasks a day, averaging 25 steps and 3 minutes each.
Core Requirements
- Each step (observe, think, act) should take about 3-5 seconds, so a typical task finishes in a few minutes, and the live view should lag reality by under a second.
- No consequential action may happen without explicit user confirmation, enforced outside the model.
- Each session's browser must be isolated from every other user's and from our internal network, and destroyed (or its state encrypted and parked) at the end.
- Content on web pages must not be able to make the agent act against the user's intent or leak their data to other sites.
- Cost per task should be bounded and predictable.
Below the line (out of scope)
- Offline/on-device agents.
- Enterprise admin policy consoles, beyond per-site allowlists.
Back-of-the-envelope:
- Concurrent browsers: 1M tasks x 3 minutes / 1,440 minutes per day ≈ 2,100 sessions on average, perhaps 6,000 at peak. A headless Chromium with a few tabs uses around 1-2 GB of RAM and a fraction of a CPU core, so peak is on the order of 10 TB of RAM across a couple of hundred large hosts. Manageable, and a real fleet.
- Tokens per step: a 1280x800 screenshot is on the order of 1,000-1,500 image tokens with common vision models; a pruned accessibility tree is 2,000-8,000 tokens; the system prompt and tool definitions are ~5,000; history grows by a few hundred tokens per step if we drop old screenshots.
- Tokens per task: 25 steps x ~20k tokens ≈ 500k input tokens, most of it cacheable prefix, and ~5k output tokens. At typical frontier-model prices with caching, that's well under $1 per task in model cost, plus a few cents of browser compute.
- Model latency dominates: of a ~4-second step, 2-3 seconds is the model call. Fewer, better steps beat faster steps.
Note what the arithmetic says: keeping every screenshot in the history would add 1,500 tokens per step forever and break nothing until the context fills. Keep only the last two or three screenshots and summarize the rest as text actions. That's the single biggest token lever.