跪拜 Guibai
← All articles
AI Programming · GitHub · Database

How AI Agents Really Operate Your Desktop and Browser

By 得物技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

As agents take over real workflows, knowing whether they see the screen or read accessibility data determines reliability and token cost. This breakdown helps developers choose between desktop and browser automation paths, and understand where breakage happens.

Summary

AI agents like Codex now operate desktop apps and browsers, and the mechanics are less mysterious than they seem. Two paths exist: Computer Use drives native apps through OS interfaces, while Browser Use drives web pages via browser APIs. Both rely on an executor that reads the interface and performs clicks and input, while the model only decides what to do next. Observability comes from screenshots, accessibility trees, or DOM structures, each with trade-offs in cost and accuracy.

Two concrete tasks ground these ideas: saving a Word document as PDF on the desktop, and searching a web drive for a meeting note. Scripts can chain uncertain steps, session state tracks the active window or tab, and libraries like PyAutoGUI and Playwright plug into agent frameworks. Ready-made tools via CLI or MCP, and browser extensions that attach to already-open tabs, round out the picture. The appendix covers daemons, CDP, OCR vs accessibility data, cursor animations, and session vs app state.

Takeaways
— Accessibility APIs expose control names and states, letting text-only LLMs drive interfaces without vision.
— Scripts can batch confirmed steps and reuse computed coordinates, reducing model round-trips.
— Browser automation via DOM avoids coordinate guessing; Playwright's click waits for element visibility and actionability.
— Browser extensions let agents attach to existing logged-in tabs, avoiding re-authentication.
— Session state and application state are separate; clearing a tool session does not log out of a website.
— Mouse animations are for human visualization only; real input goes through interfaces.
— OCR recognizes text but not element semantics; accessibility trees provide structure.
— PyAutoGUI and Playwright are common executor libraries; CLI and MCP are integration points for agents.
Conclusions

The split between model judgment and executor action means the bottleneck is often interface fidelity, not model reasoning.

Accessibility trees are a free ride: built for screen readers, they serve agents without extra training.

Visual-only approaches remain necessary for non-standard layouts, but they increase input tokens and latency.

Scripting confirmed steps turns agents from step-by-step thinkers into batch executors, a pragmatic middle ground.

The two pointer animation cases show that human perception and machine input can be fully decoupled.

Concepts & terms
RPA
Robotic Process Automation: automating repetitive tasks with predefined workflows.
Agent
A system that uses a model to decide actions based on goals and observations, calling tools and iterating.
Executor
The program that reads the interface and performs clicks and input on behalf of the model.
Accessibility tree
A structured hierarchy of UI controls with names, types, and states, provided by the OS for assistive technology.
DOM
Document Object Model: the browser's tree representation of a web page's elements and attributes.
MCP
Model Context Protocol: a standard interface for connecting agents to external tools.
CDP
Chrome DevTools Protocol: a set of commands to control Chrome, used for debugging and automation.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗