By Sagar Shankaran, Founder of CallSphere
Reusable Claude computer use patterns: operating-procedure prompts, hybrid structured tools, screenshot pruning, recovery rules, and explicit done signals.
Key takeaways
Getting a computer-use agent to click a button once is a demo. Getting it to complete a 40-step task reliably, ten times in a row, is engineering. The difference is almost entirely in the patterns you wrap around the raw loop: how you write the system prompt, how you mix visual control with structured tools, how you manage the flood of screenshots, and how you let the agent recover when reality disagrees with its plan. This post collects the reusable patterns I keep reaching for.
computer tool with structured tools so Claude only uses pixels when no API exists.The single highest-leverage change you can make is to stop treating the system prompt as a vague description and start treating it as a procedure manual. Tell the agent how to behave step by step: look first, then act, then verify. Concretely:
SYSTEM = """You control a desktop via the computer tool.
Procedure for every action:
1. Take a screenshot and describe what you see in one line.
2. Decide the single next action toward the goal.
3. Execute exactly one action, then screenshot again.
4. Confirm the screen changed as expected before continuing.
If an action has no visible effect, do NOT repeat it blindly —
scroll or look elsewhere first. Call done() when the goal is
visibly achieved."""
This costs a few hundred tokens and dramatically reduces the two worst failure modes: clicking blind and repeating a failed action. The agent now narrates its perception, which also makes your logs readable when something goes wrong.
Computer use is the most expensive, least reliable way to accomplish anything that has an API. The pattern that scales is to expose both the visual tool and ordinary structured tools, and to instruct Claude to prefer the structured ones. If you can read the database directly, give it a query_orders tool; reserve clicking for the legacy admin panel that has no API.
flowchart TD
A["Goal"] --> B{"Does an API tool exist?"}
B -->|Yes| C["Call structured tool"]
C --> D["Use exact result"]
B -->|No| E["Take screenshot"]
E --> F["Predict coordinate & click"]
F --> G["Screenshot to verify"]
G --> H{"Verified?"}
H -->|No| E
H -->|Yes| D
This routing keeps the slow visual path as a fallback, not the default. In practice a well-designed hybrid agent spends most of its turns on fast structured calls and only drops to pixels for the genuinely GUI-only steps.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
Screenshots are heavy. A long task accumulates dozens of full-resolution images, and the context cost grows linearly while older images add little value — Claude mostly needs the current screen. The reusable pattern is a sliding window: keep the most recent N screenshots in full, replace older image blocks with a short text placeholder, and let a running summary carry the history.
def prune(messages, keep=3):
seen = 0
for msg in reversed(messages):
for block in msg.get("content", []):
if isinstance(block, dict) and block.get("type") == "tool_result":
img = [c for c in block["content"] if c["type"] == "image"]
if img:
seen += 1
if seen > keep:
block["content"] = [{"type": "text",
"text": "[older screenshot pruned]"}]
return messages
Running this before each API call keeps cost bounded on long sessions while preserving recent visual context. Pair it with a text scratchpad where the agent records what it has accomplished so pruning never loses the thread.
Real UIs misbehave: a modal pops up, a page is still loading, an element is below the fold. Bake recovery into the prompt so the agent does not need a perfect plan. Three reusable moves cover most cases. First, re-observe: if the screen is not what was expected, take another screenshot before doing anything. Second, scroll-to-find: if a target element is not visible, scroll and re-screenshot rather than guessing a coordinate. Third, retry-once-then-escalate: attempt a failed action one more time, and if it still fails, report the blocker instead of looping.
Encoding these as explicit rules turns a brittle agent into a resilient one, because the model has a script for the moments where its mental model and the screen diverge.
Letting an agent end by simply not calling a tool is unreliable — it may keep poking at a finished screen until the step cap fires. A cleaner pattern is a done tool the agent must call, optionally returning a structured summary. This gives you a clean termination signal, a place to capture the result, and a natural spot to run a verification check before accepting success.
{"name": "done", "description": "Call when the goal is visibly complete.",
"input_schema": {"type": "object",
"properties": {"summary": {"type": "string"},
"success": {"type": "boolean"}},
"required": ["success"]}}
Now the loop ends when done is called, you log summary, and you can gate acceptance on success plus your own screenshot check.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
| Pattern | Solves | Cost |
|---|---|---|
| Operating-procedure prompt | Blind clicks, blind retries | A few hundred tokens |
| Hybrid tools | Slow, flaky visual steps | Some integration work |
| Screenshot pruning | Runaway context cost | A little bookkeeping |
| Recovery rules | UI surprises | Prompt length |
| Done signal | Looping past completion | One tool definition |
done tool.Long enough to state the operating procedure, tool-preference rule, and recovery moves — typically a few hundred to a thousand tokens. That investment pays for itself many times over in reliability.
Almost always. Pixels are the fallback for interfaces with no API. The more of the task you can route through exact, fast structured tools, the better the agent behaves.
Not if you keep the most recent few and maintain a text summary of progress. Claude mainly needs the current screen; distant history is better captured as text than as heavy images.
An explicit done signal gives a clean termination point, a structured result, and a hook to verify success before accepting it — far more reliable than waiting for the model to simply stop acting.
These patterns — explicit procedures, tool preference, recovery, clean termination — are exactly what CallSphere's voice and chat agents run on, calling tools mid-conversation and confirming before they commit. Hear it in action at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Held-away 401(k)s, annuities and non-traded alts have no feed into Orion. How browser-driving AI agents cut five days out of the quarter-end reporting run.
Nobody built a connection between veterinary software and the state monitoring portal. Computer use closes that gap - with the limits an owner should insist on.
Carrier order portals and utility interval data have no export. Computer use lets an agent drive those screens, and pulls six days out of your billing cycle.
WH-347 uploads across LCPtracker, AASHTOWare CRL and B2Gnow cost a payroll clerk nine hours a week. What changes when a 2026 agent does the clicking work.
Casinos hand-key FinCEN Form 112 CTRs into BSA E-Filing. An agent can draft them from the Multiple Transaction Log; the compliance officer still submits.
ServiceChannel, Corrigo and FMPilot eat 90 minutes a morning. What changes for a 90-site snow account when an agent drives the screen instead of a coordinator.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI