Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

AI System Design

Design a Computer-Use Agent

Step 1 / 9

Learn AI system design by building a computer-use / browser agent step by step.

The numbers to beat1 screenshotper loop stepa11y treewhen the app offers onepixelsfinal arbiter

The whole design, in writing

Every step of the build above, written out: the problem each piece solves, the option that was taken and the ones that were not, the numbers, and how it fails in production.

The big idea

The universal API is a screen

Most of the world’s software has no API. Legacy portals, internal tools, airline checkouts, government forms — the only interface they offer is the one humans use: pixels, a mouse, a keyboard. A computer-use agent operates that interface directly, which makes it the most general — and most treacherous — kind of agent: every website is now its tool, and every website can surprise it.

Userdelegates a task
New in this step: User.

Wrap a vision-language model in a see-think-act loop over a sandboxed machine: observe the screen, decide one action, perform it, observe again. The model supplies judgment; the system supplies eyes, hands, brakes, and a memory.

What the new pieces do

Userclient
Hands over a real computer task — "book the flight", "file this expense report" — and expects to approve anything scary.

Step 1 · The skeleton

One loop, one action at a time

The user says "book me on the 9am to Berlin." That’s dozens of clicks, fields and pages. What structure turns a goal into safe progress through an interface the agent has never seen?

Userdelegates a taskAgent Loopsee · think · act
New in this step: Agent Loop.

How should the agent work through a multi-page web task?

  1. The plan is stale by click three — pages load differently, popups appear, buttons move. Upfront scripts are how brittle RPA breaks.

  2. One action per iteration, each decided against the freshest screen. The loop absorbs surprise — which is the whole job when the world is a website.

  3. That’s not an agent, that’s a very slow mouse. Approval belongs at the few irreversible moments (step 6), not every step.

The Agent Loop drives everything: capture the current screen, ask the model for the single next action, execute it, capture again, repeat. Progress is a chain of small, individually-verifiable moves — never a long blind script.

Why this piece earns its place

The loop is the only component that can decide the task is over, and that is harder than it looks. Actions succeeding is not the same as progress: an agent can click, confirm the effect, and cycle between two pages forever, every iteration individually correct. Retry limits never catch this, because nothing failed. What catches it is a no-progress check on the loop itself — compare the observation and the notes against the last few iterations, and stop when neither has moved. The ceilings the retry story already assumes, a step count and a clock, only do their job if they arrive in the request rather than sitting in config, because a one-form expense claim and a three-site booking are not the same budget and one global number serves both badly. The cost model falls out of the same shape: every iteration is a model call over a fresh image, so both the bill and the elapsed time are linear in iterations and neither can be quoted up front. Make the loop resumable while you are at it — it owns live state in a running machine, and an orchestrator restart mid-task otherwise leaves a logged-in session with no owner.

What the new pieces do

Agent Loopbackend
The controller: capture an observation, ask the model for the next action, execute it, verify the effect, repeat until done.

Step 2 · The eyes

What does the model actually see?

The agent needs to perceive the screen. You have three candidate senses: raw screenshots, the DOM/accessibility tree, or both. Screenshots show truth but cost vision tokens; trees are cheap and precise but only exist for well-built apps — and lie when the UI is canvas, Flutter, or a legacy desktop app.

Agent Loopsee · think · actVLM Pilotreads the screen
New in this step: VLM Pilot.

What should the agent perceive?

  1. Great until the app is a canvas, a game engine, a PDF viewer, or just badly built — then the tree is empty or wrong. Trees describe what developers declared, not what’s on screen.

  2. Pixels are truth but expensive and unaddressable: "the blue button" isn’t a coordinate. You’d burn vision tokens re-reading text the tree gives you for free.

  3. The hybrid is the production answer: trust pixels as the final arbiter, exploit structure wherever it exists, and degrade gracefully to pure vision when it doesn’t.

The VLM Pilot receives the task, recent history, and the current screenshot — augmented with the accessibility/DOM snapshot when one exists. Pixels are the ground truth; structure is an accelerant, not a dependency.

Why this piece earns its place

Perception looks like one capture and is really two, of a moving target: grab the pixels, then the tree, and a page that re-renders in between hands the model a description of a screen that no longer exists. Take them as close together as the platform allows, timestamp both, and treat a disagreement as a reason to re-observe rather than something to reconcile. A sharper hazard belongs to the degraded path this step just defined. Where the tree exists, an element below the fold is still in the snapshot carrying a rect outside the viewport, so present-but-unseen and genuinely absent stay distinguishable. Drop to pure vision and they collapse into each other — a camera sees only the viewport — and the model will report the button missing with complete confidence. That path needs an explicit scroll-and-look behavior before absence is allowed to count as fact. Capture resolution decides more than it appears to: downscale the frame to save vision tokens and small labels turn to mush, so the right setting is per-app, not global. Fix it and record it, because every coordinate the next step produces is only meaningful against that exact frame.

  • 1 screenshotper loop step
  • a11y treewhen the app offers one
  • pixelsfinal arbiter

What the new pieces do

VLM Pilotservice
A vision-language model that looks at the current screen (plus the task and history) and decides the next action.

Step 3 · From intent to target

Grounding: where exactly is "Submit"?

The model says "click the Submit button." The mouse needs an (x, y). Bridging that gap — grounding — is where computer-use agents historically embarrassed themselves: right intent, wrong pixels, catastrophic click.

VLM Pilotreads the screenGroundinga11y tree · marks
New in this step: Grounding.

How does "click Submit" become coordinates?

  1. Modern VLMs can — but raw coordinate regression is the flakiest path, off by enough to hit the wrong control on dense UIs. Use it as the fallback, not the plan.

  2. Structured targets give exact rects for free. Where there’s no tree, drawing numbered boxes on detected elements turns "guess a coordinate" into "choose #7" — a far easier problem for the model.

  3. A joke — but stale-coordinate replay after a layout change is functionally this, which is why re-grounding on every fresh screenshot matters.

The Grounding layer resolves intent to a target: exact element rects from the accessibility tree when available, set-of-marks labeling over the screenshot when not, raw model coordinates as the last resort. Every action is grounded against the current observation — never a remembered one.

Why this piece earns its place

Grounding is where two coordinate systems quietly disagree. The browser reports rects in CSS pixels, the frame arrives in device pixels, and the page carries a scroll offset — get the conversion wrong and every target is off by the scale factor, an error that grows with distance from the origin, so a control near the top-left still lands and one near the far edge misses the window entirely while every log line reads as correct. Normalize once, at the boundary, and assert the grounded target actually falls inside the frame it was grounded against. Then make the layer emit what it chose, not just where: the target rect, which tier produced it, and the selector or label it matched. Without that record a failed step is unattributable — you cannot tell whether the model asked for the wrong thing or the resolver found the wrong thing, and those two have opposite fixes. It pays forward as well. A target that carries an identity is something the next observation can be checked against and the trace can replay faithfully, so the work done here is what lets verification mean more than the screen looks different now.

What the new pieces do

Groundingservice
Turns the model’s intent ("click Submit") into an exact target — via accessibility tree, DOM, or set-of-marks over the screenshot.

Step 4 · The hands, in a padded room

Execute actions in a sandbox

The agent is about to click, type, scroll — with real side effects. On whose computer? A model driving your logged-in laptop can read your email, and a hijacked one (a webpage that says "ignore your instructions…") can act on what it reads. Where do the hands live?

Groundinga11y tree · marksAction Executormouse · keys · scrollVM / Browserisolated sandbox
New in this step: Action Executor, VM / Browser.

Where should the agent’s mouse and keyboard operate?

  1. Maximum capability, maximum blast radius: every open tab, credential and file is exposed to both model mistakes and prompt injection from any page it reads. Reserve this for narrow, supervised flows.

  2. The sandbox bounds the blast radius: scoped credentials go in, a task comes out, the VM is destroyed. Screenshots of it are streamed to the user for oversight.

  3. Gates catch actions you predicted. Injection and misclicks exploit the ones you didn’t. Isolation is the defense that works when judgment fails.

The Action Executor performs grounded actions as synthetic input events inside a VM / browser sandbox — a disposable environment holding only task-scoped credentials. The user watches a live stream of the screen and can grab the wheel at any time.

Why this piece earns its place

Isolation is not the only control this step needs. Start with egress: a machine with no host access still has a network, and the cheapest thing a hijacked agent can do is put a secret in a URL and fetch it. Isolation bounds what the agent can reach on your side; a destination allowlist bounds what it can reach on the way out, and those two get conflated constantly. Then there is cost. A cold machine plus a browser plus a login is a long time before the first useful frame, so the first optimization anyone reaches for is a warm pool — and a pooled environment is not disposable. Cookies, cached sessions and a stray open tab survive into the next person's task, which is the exact property isolation was bought to provide. If you pool, pool the base image and reset the profile, treating a failed reset as a hard error rather than something to retry. The last one is that the site is watching back. A datacenter address, a profile with no history and input at machine speed is the fingerprint commercial bot defenses look for, and the block arrives as a challenge rather than an error — so the executor has to recognize one as a stop, not as a step worth retrying.

What the new pieces do

Action Executorservice
Performs the grounded action as synthetic input events — clicks, typing, scrolling, key chords — inside the sandbox.
VM / Browserservice
A disposable virtual machine or browser session the agent controls. Isolation is the blast-radius control.

Back of the envelope

disposable VM
fresh per task, destroyed after
scoped credentials
only the logins this task needs
live screen stream
user can watch and take over
no host access
the agent never touches your real machine

Step 5 · Close the loop

Verify, don’t assume

The click was sent. Did it work? The page might still be loading, a popup might have eaten the click, the button might have been disabled. Agents that assume success compound errors invisibly — by the time failure is obvious, they’re five wrong steps deep.

Agent LoopGroundingAction ExecutorVM / BrowserObservation
New in this step: Observation. · swipe to pan the diagram

The agent just clicked "Add to cart." What’s the next move?

  1. "Sent" is not "worked." Silent failures compound: the cart is empty at checkout and the agent starts improvising. Never chain actions on assumption.

  2. Fixed waits are both too slow (most pages settle faster) and too fast (some don’t). Wait for evidence, not time.

  3. Screenshot again, confirm the cart badge incremented, THEN proceed. Every action is a hypothesis; the next observation is the test.

After every action the loop captures a fresh Observation — screenshot plus DOM state — and the model verifies the expected effect before deciding the next move. Loading states get bounded waits-for-evidence; failed effects trigger re-grounding and bounded retries, not blind repetition.

Why this piece earns its place

None of this works unless the expectation is written down before the action. Act first, then show the model a new screen and ask whether it worked, and it will explain why it worked — post-hoc rationalization is the failure mode of self-verification, and it hides precisely because every step reports success. So make the decision emit its predicted effect as part of the action: this click should produce a cart count of one. Verification becomes a comparison, and a mismatch is a concrete event you can log and count rather than a judgment call. Counting them is worth more than it sounds. Mismatches bucketed by site and element are the earliest warning that a site shipped a redesign: the rate moves across every user at once, well before any single task fails outright, and it is the signal that separates the model got worse from the world changed. The retry path needs its own care, because most interesting actions are not idempotent. An ambiguous outcome — the click may have landed, the page may still be settling — is the worst case, and deciding whether the effect already happened has to come before deciding to act again, or the form gets submitted twice.

  • every actionverified against pixels
  • bounded waitsevidence, not timers
  • re-groundon every fresh frame

What the new pieces do

Observationstore
The fresh screenshot (and accessibility/DOM snapshot) captured after every action — the only truth about what happened.

Step 6 · The brakes

Gate the irreversible

Somewhere in the task sits a click that can’t be un-clicked: Purchase. Send. Delete. Submit to the IRS. The model is right most of the time — and "most of the time" is a horrifying standard for spending money. Where do the brakes go?

Agent LoopguardedSafety Gateapprove irreversible
New in this step: Safety Gate.

The agent reached the "Place order · $1,240" button. What happens?

  1. One misread field or hijacked instruction and the agent bought the wrong flight with real money. Autonomy without brakes is liability.

  2. A Safety Gate classifies actions; the irreversible ones — payments, sends, deletes, credential entry — require explicit human sign-off with full context.

  3. Then the agent can’t finish the tasks people most want delegated. The goal is bounded autonomy: free on reversible steps, gated on irreversible ones.

A Safety Gate sits between decision and execution: reversible actions flow freely; irreversible ones — purchases, sends, deletions, logins — pause with a screenshot and a plain-language "about to do X, approve?" The human approves the moments that matter, not every click.

Why this piece earns its place

An approval is asynchronous and the page is not. While someone reads the request on their phone, the session times out, the held seat is released, the price moves, a banner shifts the layout. What they approved was a screenshot; what executes runs against whatever is there when they say yes. So an approval is permission for an intent, not a license to replay a stale click — once the human agrees, re-observe, re-ground, and confirm the target still says what it said, or go back and ask again. The pause also has to end somehow. Nobody answering is a common case rather than a rare one, and a waiting task is a live sandbox holding a seat, a cart, a lock — so the request needs a deadline and a defined expiry: release what is held, tear the environment down, and report where the task stopped, rather than leaving a machine idling against a timeout nobody chose. The other risk sits on the human side. Gate too much and people approve without reading, which is worse than having no gate at all: you have manufactured consent and then logged it, so the audit trail now claims a person reviewed something nobody looked at.

What the new pieces do

Safety Gateservice
Pauses before purchases, sends, deletes, logins — anything hard to undo — and asks the human to approve.

Step 7 · Going long

Memory and the paper trail

Real workflows run long: 60 steps, three sites, a confirmation code from page 2 needed on page 9. Screenshots are huge and the context window isn’t. And when the agent finishes — or fails — someone will ask exactly what it did. What persists?

Agent LoopVLM PilotGroundingAction ExecutorVM / BrowserObservationSafety GateTask MemoryTrace / Replay
New in this step: Task Memory, Trace / Replay. · swipe to pan the diagram

A 60-step task across 3 websites. How does the agent keep track?

  1. Dozens of images overflow any window and bury the signal. Old pixels are the least useful tokens you can carry.

  2. "Done: flight selected · Learned: conf #XK42 · Next: passenger form" beats fifty stale screenshots. Notes compress; pixels expire.

  3. Re-doing a half-completed purchase flow is how you buy two tickets. Long tasks need memory, not amnesia and a rerun.

Task Memory holds structured running notes — completed steps, extracted facts, remaining plan — while old screenshots age out of context. In parallel, the Trace records every frame and action: the audit trail for debugging, evals, and answering "what exactly did it do with my card?"

Why this piece earns its place

The trace is the most useful artifact in this design and the most dangerous one. Every frame it keeps is a picture of whatever happened to be on screen — a card number mid-entry, somebody's inbox, a password field between keystrokes — so it holds the highest concentration of secrets anywhere in the system, and it holds them as images, where no string scanner will ever find them. Redact at capture rather than at review: mask credential fields and known-sensitive regions before the frame is written, and give the store a retention clock of its own, separate from the task's lifetime. It is also the largest thing you keep by a wide margin, since a full frame per step across every task dwarfs the notes sitting beside it — so store keyframes plus the actions between them instead of everything at full fidelity. What buys all of that back is evals. A recorded failure replays as a fixed test, which is the only honest way to answer whether a new model got better at your tasks or merely better at the ones you remembered to try.

What the new pieces do

Task Memorystore
Running notes for long workflows: what’s done, what was learned (order number, form values), what remains.
Trace / Replaybus
Full recording of observations and actions — for debugging, evals, audits, and replaying exactly what the agent did.

The payoff

You built a computer-use agent

From "the only API is a screen" to a system that works it safely: a see-think-act loop, hybrid vision + structure perception, set-of-marks grounding, sandboxed execution with scoped credentials, verification after every action, approval gates on the irreversible, task memory for the long haul, and a full replayable trace.

UserAgent LoopVLM PilotGroundingAction ExecutorVM / BrowserObservationSafety GateTask MemoryTrace / Replay
The finished design, end to end. · swipe to pan the diagram

Now change the page mid-task and watch the machinery respond — re-observe, re-ground, bounded retry, and a clean escalation to the human when the world stops making sense.

Everything you assembled, in order

  • See-think-act — one verified action per fresh observation
  • Hybrid perception — pixels as truth, a11y/DOM as accelerant
  • Grounding — a11y rects → set-of-marks → raw coords, in that order
  • Sandbox — disposable VM, scoped credentials, live stream
  • Verify effects — every action is a hypothesis; the next frame tests it
  • Safety gate — gate by consequence — approve the irreversible
  • Task memory — notes compress; old screenshots expire
  • Trace — every frame and action, replayable and auditable

Where an interviewer pokes next

Getting the boxes right is the easy half. These are the questions that separate a candidate who drew the diagram from one who has run the thing. Answer each one out loud before you open it.

  1. The app has no accessibility tree AND the screenshot is a canvas game with no clean element boundaries. What does grounding fall back to?

    Raw coordinate regression — the model estimates (x, y) directly from pixels, the weakest of the three grounding modes. This is exactly why set-of-marks matters as a middle tier: a general-purpose element detector can often still find clickable-looking regions on a canvas even without a11y data, turning a pure regression problem back into multiple-choice. Raw coordinates are the last resort, not the default.

  2. "Bounded retries" — bounded by what, and what happens when the agent exhausts them?

    Bounded by a small fixed count (typically 2-3 re-grounding attempts per action) plus a wall-clock ceiling on the whole task. Exhausting retries doesn’t mean the loop keeps trying forever or silently gives up — it means the agent stops and escalates to the human with its current observation and a plain-language "I’m stuck here, this is what I see," which is a much better failure mode than infinite flailing or a silent abandoned task.

  3. How granular can the sandbox’s "scoped credentials" actually get — is it really different from just logging in normally?

    Yes: scoped credentials mean task-specific tokens (a one-time login, a payment method with a spend cap, an API key limited to one merchant) issued fresh per task and revoked after, rather than the user’s standing session with every saved password and open tab. The VM never sees the user’s real inbox or other accounts — only what this specific task was granted, which is what makes "hijacked mid-task" survivable instead of catastrophic.

  4. Could a malicious page poison Task Memory itself, not just trigger one bad action?

    That’s a real, harder version of the injection problem — if the model writes "learned: confirmation code is X" into memory based on attacker-controlled page text, a later step might act on a poisoned fact instead of just a poisoned instruction. The mitigation is the same discipline as everywhere else in the loop: memory entries derived from untrusted content should be treated as claims to verify against a fresh observation before acting on them, not facts to trust blindly.

  5. How would two computer-use agents handing off one workflow — one books the flight, another files the expense report — actually coordinate?

    Through the same Task Memory pattern, structured as a handoff contract: agent one writes its completed-facts (confirmation number, price, dates) in a form agent two’s prompt can consume, and the Safety Gate still evaluates each agent’s own irreversible actions independently — agent one’s "purchase" approval doesn’t pre-approve agent two’s "submit expense." Coordination is data handoff, not shared autonomy.

Check yourself — the answers, and why

Eight steps in, these are the calls you should be able to make cold. Pick one, then read why.

  1. Why do production computer-use agents combine screenshots with accessibility trees?

    Structure accelerates grounding where apps declare it; vision covers everything else and arbitrates when the tree lies.

  2. Why does the agent run in a disposable VM instead of your laptop?

    Everything the agent reads is untrusted input. Isolation with scoped credentials is the defense that works when judgment fails.

  3. After sending a click, the agent should…

    Every action is a hypothesis tested by the next frame. Assumed success compounds into deep, invisible failure.

  4. The safety gate should trigger on…

    Gate by consequence: fast on reversible steps, human approval on the ones that can’t be undone. Model confidence is not a safety boundary.

  5. A webpage contains hidden text instructing the agent to transfer money. What stops it?

    Every page the agent reads is untrusted input. Isolation bounds the blast radius and consequence-based gating catches irreversible actions no matter what "told" the agent to do them.

How you’d open this design in an interview

Before any boxes: agree what it must do, pin the qualities that shape everything, then build — naming each trade-off as you make it. The walkthrough above is that exact order.

What it must do

Agree on these before drawing a single box.

  • Loop: observe the screen, decide one action, execute it, observe again — until the task is done.
  • Perceive: read the current screenshot, augmented by the accessibility/DOM tree when it exists.
  • Ground & act: resolve “click Submit” to an exact target and perform it as synthetic input.
  • Verify: capture a fresh observation and confirm the expected effect before the next action.
  • Guard & remember: gate irreversible actions for approval; keep task memory + a replayable trace.

The qualities that shape everything

Each one names the mechanism that buys it.

Absorb a UI that surprises you
A see-think-act loop takes one action per fresh observation instead of running a long blind script, so surprises are caught immediately.
Work any app, even without an a11y tree
Hybrid perception: the screenshot is ground truth, the accessibility/DOM tree is a cheap accelerant when one exists — degrade gracefully to pure vision.
Turn intent into the right pixel
Grounding resolves “click Submit” via a11y rects, then set-of-marks labeling, then raw coordinates as a last resort — always against the current observation.
Bound the blast radius of mistakes and injection
Execute in a disposable VM/browser sandbox holding only task-scoped credentials, streamed live so the user can take over.
Never compound silent failures
After every action, capture a fresh observation and verify the expected effect before the next move — failed effects trigger re-grounding and bounded retries.
Never autonomously do the irreversible
A safety gate classifies actions and pauses purchases, sends, deletes and logins for explicit human approval, letting reversible steps flow.

The trade-offs you say out loud

Senior signal isn’t the boxes — it’s naming what you gave up and why it was the right price.

A see-think-act loop over planning every click upfront

An upfront script is stale by click three — pages load differently, popups appear, buttons move. One action per fresh observation absorbs surprise, which is the whole job when the world is a website.

Structured grounding (set-of-marks) over raw coordinate regression

Raw coordinate guessing is the flakiest path, off by enough to hit the wrong control on dense UIs. Exact a11y rects, or numbered boxes the model chooses from, turn “guess a coordinate” into “choose #7” — grounding accuracy is the best predictor of success.

A disposable sandbox over the user’s own machine and session

Running on the user’s session exposes every tab, credential and file to model mistakes and to prompt injection from any page it reads. A VM with only task-scoped credentials bounds the blast radius — you can’t filter what you can’t anticipate, so you bound what a hijacked agent can reach.

Verifying the effect after every action over assuming the click worked

“Sent” is not “worked” — silent failures compound until the agent is five wrong steps deep. Every action is a hypothesis and the next observation is its test; re-observe and confirm before choosing the next move.

Gating the irreversible over letting the agent click Purchase itself

One misread field or hijacked instruction and the agent spends real money on the wrong thing, while refusing all purchases means it can’t finish the tasks people most want delegated. Gate by consequence — free on reversible steps, human approval on the few irreversible ones.

The answer, out loud

What a strong answer to “Design a Computer-Use Agent” sounds like, first question to last trade-off. It is about 7 minutes of talking; the whiteboard and the interviewer fill the rest of the 45. Read it aloud once, then close the page and give it yourself.

  1. 0–3 min

    Start with what has no API

    Before I draw anything I want to name the constraint. Most of the software people actually need automated has no API — legacy portals, internal tools, an airline checkout, a government form. The only interface on offer is the one humans use: pixels, a mouse, a keyboard. So I'd design something that drives that interface directly. That makes it the most general kind of agent, because every website is now a tool, and the most treacherous, because every website can surprise it. I'll design against the task a user would actually hand over — book me on the 9am to Berlin.

  2. 3–8 min

    One loop, one action

    The skeleton is a user, an agent loop, and the machine being driven. The loop captures the current screen, asks the model for one next action, executes it, and captures again. The tempting alternative is to plan the whole click path upfront, and I'd argue against that on one ground: every click after the first is a bet placed on a screen nobody has seen yet. The loop makes each decision the cheapest possible thing to throw away. The other extreme, confirming every click with the user, isn't an agent, it's a very slow mouse.

    Built in step 1: One loop, one action at a time
  3. 8–14 min

    Pixels as truth, structure as a shortcut

    Then, what it sees. I'd give the model the task, recent history, and the current screenshot, augmented by the accessibility or DOM tree when one exists. I wouldn't build on the tree alone — it describes what developers declared, and it's empty or wrong the moment the app is a canvas or a legacy desktop window. Screenshots alone are honest but expensive, and the blue button isn't a coordinate. So, the hybrid: pixels are the final arbiter, structure is an accelerant where it exists, and the system degrades gracefully to pure vision when it doesn't.

    Built in step 2: What does the model actually see?
  4. 14–20 min

    Turning intent into a target

    The model says click Submit, and the mouse needs an exact target. That bridge is grounding, and it's where these agents have historically embarrassed themselves: right intent, wrong pixels, catastrophic click. I'd resolve against the accessibility tree first, since that gives exact element rects for free. With no tree I'd fall back to set-of-marks — detect the interactive elements, draw numbered boxes on the screenshot, ask which number. That turns guessing a coordinate into choosing number seven, a far easier problem. Raw coordinates are the last resort, and every grounding runs against the current observation, never a remembered one.

    Built in step 3: Grounding: where exactly is "Submit"?
  5. 20–26 min

    Put the hands in a padded room

    Now the hands. The executor performs the grounded action as synthetic input — clicks, typing, scrolling — inside a disposable VM or isolated browser session holding only the credentials this task needs, streamed live so the user can take over. Running on the user's own logged-in machine exposes every open tab, credential and file to both model mistakes and prompt injection. And a hostile instruction arrives inside the same pixels the agent has to read to do the job at all, so there is no separate channel to sanitize. Containment is the one control that doesn't depend on recognizing the attack first.

    Built in step 4: Execute actions in a sandbox
  6. 26–32 min

    Every action is a hypothesis

    After every action the loop captures a fresh observation and the model verifies the expected effect before choosing the next move. Assuming the click worked is how these systems fail invisibly — sent isn't worked, the cart is empty at checkout, and by then it's five wrong steps deep. A fixed wait doesn't help either: too slow for most pages, too fast for some. So I'd wait for evidence rather than time, and when the expected effect doesn't appear, re-ground on the fresh frame and retry within a bound instead of repeating blindly. That discipline is the difference between finishing a ten-step task and a three-step one.

    Built in step 5: Verify, don’t assume
  7. 32–38 min

    Brakes on the irreversible

    Somewhere in the task is a click that can't be un-clicked: place order, send, delete, enter a password. So I'd put a safety gate between decision and execution. Reversible actions flow freely; the irreversible ones pause with a screenshot and a plain-language description of what's about to happen, and wait for a human. Clicking place order at twelve hundred and forty dollars on its own is liability, and a blanket ban on spending money hands the interesting half of the job straight back to the user. So the split is by consequence — not by frequency, and not by model confidence, which isn't a safety boundary.

    Built in step 6: Gate the irreversible
  8. 38–44 min

    Going long, and leaving a trail

    Real workflows run long — sixty steps across three sites, a confirmation code from page two needed on page nine — and screenshots are enormous while the context window isn't. So I'd keep structured task memory: what's done, what was learned, what remains, with old screenshots aging out. Notes compress, pixels expire. Carrying every frame buries the signal, and restarting a half-finished purchase flow is how you buy two tickets. In parallel the trace records every frame and action outside the window, which is what lets me debug a run and answer what it did with someone's card.

    Built in step 7: Memory and the paper trail
  9. 44–47 min

    The trade-off, and what I’d do next

    To close: a see-think-act loop, hybrid perception, grounding through rects then marks then coordinates, a sandbox with scoped credentials, verification after every action, a gate on the irreversible, task memory and a trace. The trade-off underneath all of it is autonomy against blast radius, and every knob — gate width, retry count, how much memory to carry — spends one to buy the other. With more time I'd chase two questions I don't have clean answers to: whether a run that succeeded can be replayed cheaply next time without giving up verification, and what counts as the screen once one task spans several windows and a native file dialog.

What this teaches

Learn AI system design by building a computer-use / browser agent step by step. An interactive guide covering the see-think-act loop, screenshots vs accessibility trees, grounding "click Submit" into real coordinates, sandboxed VMs, verifying every action against a fresh observation, approval gates for irreversible actions, task memory for long workflows, and why a page that changes mid-task is the defining failure mode.

Key takeaways

  • See-think-act — one verified action per fresh observation
  • Hybrid perception — pixels as truth, a11y/DOM as accelerant
  • Grounding — a11y rects → set-of-marks → raw coords, in that order
  • Sandbox — disposable VM, scoped credentials, live stream
  • Verify effects — every action is a hypothesis; the next frame tests it
  • Safety gate — gate by consequence — approve the irreversible
  • Task memory — notes compress; old screenshots expire
  • Trace — every frame and action, replayable and auditable

Concepts covered

  • The universal API is a screen
  • One loop, one action at a time
  • What does the model actually see?
  • Grounding: where exactly is "Submit"?
  • Execute actions in a sandbox
  • Verify, don’t assume
  • Gate the irreversible
  • Memory and the paper trail
RUN IT YOURSELF

The stale coordinate that clicks the wrong thing and reports success

One recorded click plan, addressed two ways — by the pixel coordinate the model grounded on, and by a scoped selector from the accessibility tree — replayed against the same page after a consent bar appears above the list. It prints what each address actually hit. Change BANNER_PX, hit Run, and watch a plan that never errors delete the wrong message.

HOW TO READ THE CODE — 6 IDEAS
  1. Both addresses are correct on the unchanged page. Shift the content above them and coordinates go 1/5 while selectors stay 5/5 — the plan did not get worse, the page moved (step 3).
  2. The headline is the errors raised 0 column: a coordinate returns whatever is under the point, so 4 wrong clicks all reported success. One of them was a Delete on the wrong row.
  3. The header button still works, because it sits above the insertion point. The agent cannot tell which of its targets moved — which is why grounding runs against the current observation, never a remembered one (steps 2–3).
  4. Retrying the same recorded coordinate makes it worse: each wrong delete pulls the list up, so every attempt destroys a new row — and when one eventually lands, verification passes and the trace says SUCCESS (step 5).
  5. Re-grounding by selector resolves in 1 attempt, and when the row is genuinely gone it returns nothing instead of clicking its replacement. Loud beats silent.
  6. It is not luck that the mis-hits land on buttons: the sweep line replays every shift from 1–400px and 85.9% of the clicks still inside the list hit some control — because a row body covers 44 of every 52px of pitch. Change ROW_GAP and the rate follows the density, not the alignment.
CPython · WebAssembly
built to be reasoned about, not memorized — make the calls, break the page, run the quiz.
Finished this one? 0 / 65 AI System Designs done
NextDesign a Conversational AI Closest AI system design to this one

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More AI System Designs