Computer Use and Browser Agents

Agents that operate GUIs, browsers and terminals through screenshots and actions, plus the sandboxing they require.

Advanced · about 4 hours · difficulty 4/5

Learn first: Designing Tools for Agents

Some tasks have no API: legacy web apps, desktop software, forms behind logins. Computer use agents look at screenshots and issue mouse and keyboard actions, while browser agents drive a real browser through tools such as Playwright. Coding agents operate a terminal and file system.

How it works

The model receives a screenshot (or an accessibility tree / DOM snapshot), decides an action such as click at coordinates, type text or scroll, your harness executes it, and a new screenshot comes back. It is the agent loop with very large observations.

Practical realities

  • Slow and expensive: each step carries an image. Prefer an API or DOM-level tool whenever one exists and use vision only as a fallback.
  • Brittle: layouts change, pop-ups appear, pages load slowly. Build in waits, retries and verification after each action.
  • Structured alternatives: DOM or accessibility snapshots are cheaper and more precise than raw pixels for web tasks.

Safety is mandatory

  • Run in an isolated sandbox: a container or VM with no access to your real accounts, files or network beyond what the task needs.
  • Web pages can contain prompt injection aimed at the agent. Limit what a compromised agent could do.
  • Require human confirmation for purchases, sending messages, or entering credentials.

Good enough to move on

You can run a browser agent in a container that completes a multi-step task on a test site, logs screenshots per step, and refuses to proceed past a payment page without approval.

Key concepts

  • Screenshot-action loops
  • Browser automation with Playwright
  • DOM and accessibility snapshots
  • Coding agents and terminals
  • Sandboxed containers and VMs
  • Human confirmation gates

Mini project

Use a computer use or browser agent inside a Docker container to fill out a multi-page form on a local demo site, with a screenshot log and a hard stop before final submission.

Check yourself

Why should a browser agent never run in the same browser profile you use for your bank?

Free resources