Most agentic AI tooling assumes there is an API to call. Computer-use agents drop that assumption entirely - they look at a screenshot, decide where to click or what to type, take the action, and look again. No API, no DOM access required, just pixels in and coordinates out. After wiring several of these into client automation pipelines alongside my usual Playwright-based scrapers, here is what actually works and where the approach still breaks.
How Computer-Use Agents Actually Work
The loop is deceptively simple: capture a screenshot, send it to a vision-capable model along with the task and action history, get back a structured action (click at x,y; type text; scroll; press key), execute it, capture a new screenshot, repeat. The model is reasoning entirely from pixels - it has no privileged access to the underlying HTML, DOM tree, or accessibility layer unless you explicitly provide one alongside the image.
Screenshot
│
▼
Vision Model (task + action history + screenshot)
│
▼
Structured Action: {"type": "click", "x": 412, "y": 88}
│
▼
Execute via OS-level input (pyautogui / CDP / xdotool)
│
▼
New Screenshot → loopThis is fundamentally different from traditional RPA (robotic process automation), which relies on fixed coordinates or accessibility tree selectors that break the moment a UI shifts by a few pixels or a vendor ships a redesign. A computer-use agent re-reads the screen every step, so it adapts to layout changes the same way a human would - by looking again.
Where This Beats API and DOM-Based Automation
| Scenario | Why | Best Fit |
|---|---|---|
| No API exists (legacy desktop software) | Only option is screen-level control | Computer-use agent |
| Web app with no stable selectors | DOM structure changes weekly | Computer-use agent |
| High-volume structured scraping | Speed and cost matter more than adaptability | Traditional scraper (Playwright + selectors) |
| One-off task across unfamiliar SaaS tools | Setup cost of a custom integration isn't worth it | Computer-use agent |
| CAPTCHA-gated, anti-bot-hardened targets | Vision agents are still slow and detectable | Traditional scraper + stealth tooling |
The sweet spot is legacy software with no API - old ERP systems, internal admin panels nobody wants to reverse-engineer, or third-party SaaS dashboards that change their DOM structure every release. For high-throughput scraping where you already know the page structure, a traditional Playwright scraper is still faster, cheaper, and more reliable.
Building a Minimal Computer-Use Loop
Anthropic's Claude models support a computer-use tool definition that returns structured actions directly. Here's the core loop, simplified:
import anthropic
import pyautogui
import base64
from io import BytesIO
client = anthropic.Anthropic()
def screenshot_b64() -> str:
img = pyautogui.screenshot()
buf = BytesIO()
img.save(buf, format="PNG")
return base64.b64encode(buf.getvalue()).decode()
def execute_action(action: dict):
if action["type"] == "click":
pyautogui.click(action["x"], action["y"])
elif action["type"] == "type":
pyautogui.typewrite(action["text"], interval=0.02)
elif action["type"] == "key":
pyautogui.press(action["key"])
elif action["type"] == "scroll":
pyautogui.scroll(action["amount"])
def run_task(task: str, max_steps: int = 25):
messages = [{
"role": "user",
"content": [
{"type": "text", "text": task},
{"type": "image", "source": {
"type": "base64", "media_type": "image/png",
"data": screenshot_b64(),
}},
],
}]
for step in range(max_steps):
response = client.beta.messages.create(
model="claude-opus-4-5-20251101",
max_tokens=1024,
tools=[{"type": "computer_20250124", "name": "computer",
"display_width_px": 1920, "display_height_px": 1080}],
messages=messages,
betas=["computer-use-2025-01-24"],
)
tool_use = next((b for b in response.content if b.type == "tool_use"), None)
if not tool_use:
break # model produced a final text answer, task done
execute_action(tool_use.input)
messages.append({"role": "assistant", "content": response.content})
messages.append({
"role": "user",
"content": [{
"type": "tool_result",
"tool_use_id": tool_use.id,
"content": [{"type": "image", "source": {
"type": "base64", "media_type": "image/png",
"data": screenshot_b64(),
}}],
}],
})The critical detail most people miss: the model needs the full action history in context, not just the current screenshot. Without it, the model has no memory of what it already tried, and will happily click the same broken button five times in a row.
Failure Modes That Actually Show Up
- -Coordinate drift on high-DPI displays. Screenshot resolution and click coordinate space must match exactly. A mismatch between the image sent to the model and the actual screen resolution silently misfires every click.
- -Small target elements. Dense UIs with 16px icons packed close together are the single biggest source of misclicks. Zooming the browser to 125-150% before starting the task measurably improves click accuracy.
- -Loading state confusion. If the agent screenshots mid-transition (a modal fading in, a spinner still spinning), it reasons about a UI state that no longer exists by the time the action executes. A short fixed delay after each action, or an explicit "wait for stable" check, fixes most of this.
- -Getting stuck in loops. Without action-history awareness, agents can oscillate between two states indefinitely. Cap max_steps and log the full trajectory so you can see exactly where it looped.
Hybrid Architecture: The Practical Middle Ground
The most reliable production setups I've built don't use computer-use agents in isolation. They combine DOM/accessibility-tree access where available with vision as a fallback: try the fast, structured path first (accessibility tree query, known selector, API call), and only fall back to screenshot-based reasoning when the structured path fails or the target has no accessible structure at all. This keeps the speed and cost profile of traditional automation for the 90% of steps that are predictable, while gaining the adaptability of vision reasoning for the 10% that aren't.
Frequently Asked Questions
Is computer-use automation reliable enough for production?
For well-scoped, lower-frequency tasks - yes, with retries and step-count limits. For high-volume, latency-sensitive pipelines, it is still slower and more expensive per action than a traditional scraper or API integration. Use it where no better option exists, not as a default replacement for structured automation.
How much does a computer-use agent cost to run per task?
Cost scales with the number of screenshot round-trips, since each step sends a full image plus growing conversation history. A 15-20 step task typically costs a few cents to low tens of cents depending on the model. Long-running tasks with dozens of steps can get expensive quickly if you're not pruning old screenshots from the context.
Can computer-use agents handle CAPTCHAs and bot detection?
No better than a human clicking through would - they're subject to the same detection signals as any automated input (mouse movement patterns, timing, browser fingerprints), and typically worse because their timing is less naturally variable. For anti-bot-hardened targets, dedicated stealth scraping techniques remain the more reliable approach.
Do I need a separate vision model or does the same LLM handle it?
Current frontier multimodal models (Claude Opus/Sonnet, GPT-4o and successors) handle both the visual reasoning and the action-planning in a single model call - no separate vision pipeline needed. The model reads the screenshot directly as part of its normal multimodal input.
