Category: Engineering
Domain: AI Agents
The Computer Use Automation skill helps you design AI agents that operate a graphical interface the way a person does — take a screenshot, reason about what is on screen, then click, type, scroll, or navigate, and repeat. It covers the core perception→reason→action loop, the decision of when computer-use is the right tool versus a structured API/MCP tool (prefer a real API whenever one exists; reach for computer-use only for GUIs with no programmatic surface), reliability patterns (grounding every action in the current screenshot, verifying after each step, recovering from misclicks), safety guardrails (confirmation gates for destructive actions, sandboxing, avoiding blocking dialogs), and how to evaluate a computer-use agent. It is model-agnostic — the patterns apply to any computer-use-capable model and any GUI tool surface.
Before designing or auditing a computer-use agent, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
tool_choice_advisor.py vs action_safety_linter.py).Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
# Decide computer-use vs API/MCP for a target
python scripts/tool_choice_advisor.py --api-exists no --gui-stability high --volume low --json
# Lint a planned action sequence for safety/reliability gaps
python scripts/action_safety_linter.py --file assets/sample_plan_safe.json # CLEAN, exit 0
python scripts/action_safety_linter.py --file assets/sample_plan_risky.json # HIGH, exit 1
# Read actions from stdin and emit a markdown risk report
echo '[{"type":"click","target":"Delete"},{"type":"submit","target":"Confirm"}]' \
| python scripts/action_safety_linter.py --format markdown
| Tool | Purpose | Key Flags |
|---|---|---|
tool_choice_advisor.py | Recommend computer-use vs structured API/MCP for a target, with rationale | --api-exists, --gui-stability, --volume, --reversible, --json |
action_safety_linter.py | Scan a planned action list for destructive verbs, missing verification, missing confirmation gates, and dialog-triggering patterns | --file, --format, --json |
All scripts: Python 3 standard library only, argparse CLI, --json and human-readable output. Run --help for full usage.
Action plan format. A JSON list of objects with type (or its alias action): screenshot, observe, verify, click, type, submit, navigate, upload, ...; target (the visible label); optional text (what gets typed), confirmed (a human or explicit gate approved it) and verified (the step checks its own result). Plain text with one <type> <target> per line also works. An object with no type or action is rejected rather than silently passed.
What the linter flags. High: destructive verbs (delete, send, pay, submit...) without confirmed, state changes on a destructive step with no verification, and typed text that looks like a destructive command (rm -rf, DROP TABLE, sudo...). Medium: unverified state changes, typing into password or payment fields, actions that open native dialogs. Low: actions not preceded by a fresh screenshot.
Exit codes. action_safety_linter.py: 0 no high finding, 1 at least one high finding, 2 unreadable file or an action list it cannot parse. tool_choice_advisor.py: 0 recommendation printed, 2 invalid option value.
Done when:
tool_choice_advisor.py with the target's API/MCP availability, GUI stability, and volume — if it says "use API/MCP," stop and build against the real interface instead.type, target, optional text, verified, confirmed).action_safety_linter.py --file plan.json to flag risky verbs, unverified state changes, ungated destructive actions, and dialog-triggering patterns.In Scope:
tool_choice_advisor.py, based on API availability, GUI stability, volume and reversibilityaction_safety_linter.py for destructive verbs, state changes with no verification, destructive steps with no confirmation gate, and patterns that open blocking dialogsOut of Scope:
engineering/browser-automation/)engineering/mcp-server-builder/)engineering/agent-harness/)Important Caveats:
Mistake: Driving a SaaS dashboard by screenshot when the product has a documented API.
Why it happens: Computer use demos well and needs no integration work up front.
Instead: Run tool_choice_advisor.py first. An API call is cheaper, faster and verifiable; reserve the GUI loop for targets with no programmatic surface.
Mistake: Clicking coordinates taken from a screenshot several steps ago.
Why it happens: Re-capturing feels redundant when nothing seems to have changed.
Instead: Take a fresh screenshot before each action and target what is visible now. Layouts shift after every load, toast and modal.
Mistake: Marking a payment or send step done because the click was issued.
Why it happens: The agent's plan says the click happens, so the outcome is assumed.
Instead: Read the resulting screen (confirmation banner, new row, changed status) before moving on, and gate irreversible steps behind a human approval.
scripts/tool_choice_advisor.py, scripts/action_safety_linter.py — the two CLIs above.assets/sample_plan_safe.json (clean plan) and assets/sample_plan_risky.json (destructive command, payment field, ungated delete).references/computer-use-patterns.md — action loop, decision matrix, reliability and safety patterns, evaluation.