Skip to content
Goal: Proficient✓ Sources verified 2026-11-24Computer usePlaywrightAccessibility Tree

Computer Use / Mobile Use Agents ​

Letting AI operate web pages, desktop apps or phone screens directly (computer use / mobile use), often for RPA-style automation needs.

Core concepts: two technical approaches ​

Screenshot + coordinates (visual approach)DOM / accessibility tree + selectors (structural approach)
Input to the modelScreenshotsPage structure (accessibility tree snapshot, trimmed DOM)
ActionsClick at (x, y), type, scrollClick an element reference, fill a given input
StrengthsGeneral: works on desktop software, Canvas, remote desktopsPrecise, cheap (fewer text tokens), more stable
WeaknessesMany tokens, slow, coordinate driftOnly works on structured UIs (web pages, apps with accessibility info)
Typical toolsAnthropic computer use toolPlaywright, Appium, ADB

In practice they're often mixed: prefer the structural approach, and fall back to screenshots for Canvas or elements that can't be located.

How it works ​

Anthropic computer use tool (verified 2026-11) ​

  • It is a client-executed tool: the model returns actions such as "screenshot / click at coordinates / type text / press key", your code executes them in a VM or container, and sends back a new screenshot.
  • Version history: computer_20250124 → computer_20251124 (requires the beta header computer-use-2025-11-24) → the new computer_toolset_20260801 (goes in the tools array, no beta header needed). The official docs say newer models only support the new toolset version, while the older tool versions still work on the models listed for them.
  • The docs stress safety measures: run in an isolated VM/container, limit network access, require human confirmation for sensitive actions, and watch out for prompt injection in page content.

Structural approach: Playwright's accessibility snapshots ​

  • locator.ariaSnapshot() returns the accessibility structure (role, name, state) of an element subtree as YAML, which is a very good input for an LLM.
  • Benefit: far shorter than raw HTML, and it keeps only what a user can perceive.

Mobile use ​

  • Android: ADB (screenshots, input events) + UIAutomator's view hierarchy; cross-platform: Appium (WebDriver protocol). Again the approaches split into "screenshots" and "view tree".

In practice: one step of the structural approach ​

python
from playwright.async_api import async_playwright

async def observe(page) -> str:
    # The "observation" shown to the model: current URL + accessibility snapshot of the main region (truncated to keep it short)
    snap = await page.locator("main").aria_snapshot()
    return f"URL: {page.url}\n{snap[:6000]}"

async def act(page, action: dict):
    if action["type"] == "click":
        await page.get_by_role(action["role"], name=action["name"]).click(timeout=5000)
    elif action["type"] == "fill":
        await page.get_by_label(action["label"]).fill(action["text"])

Agent loop: observe → LLM decides an action → act → observe …, plus a max step count, screenshots archived on failure, and handoff to a human before high-risk actions (submit, pay, delete).

Common pitfalls ​

  1. Prompt injection: web content can "command" the agent. Treat page content as data, not instructions, and force human confirmation for high-risk actions.
  2. No isolated environment: running directly in your own browser risks unintended actions. Use a container or a separate browser profile.
  3. Observing before the page has loaded: use Playwright's auto-waiting and expect assertions instead of fixed sleeps.
  4. Only recording the final result: save every step's observation, action and screenshot so you can replay and debug (this is also the pipeline's "traceability" requirement).

Common interview questions ​

  1. What are the pros and cons of the screenshot approach versus the DOM / accessibility tree approach? Which did your project choose, and why?
  2. Who executes the computer use tool? What does the model return?
  3. How do you defend against prompt injection in web pages?
  4. How does the agent hand over to a human when an action fails? How does it continue after the human is done?
  5. How do you measure a browser agent's success rate?

How it relates to my projects ​

To be verified / may go stale

  • The computer use tool's version strings, supported models and beta headers change quickly (as of 2026-11 the docs list both computer_20251124 and computer_toolset_20260801). Check the official page before building.
  • OpenAI also offers computer use capabilities, not covered here; consult OpenAI's official docs when using them.

Sources ​

Vin Amory · AI development × content creation · Technical notes cite official docs in each page’s sources section