◉CLAUDE LABJP
●2.1.311 — Adds idle-hold options for self-hosted runners and fixes startup freezes and stalled interrupts (10/26)●2.1.307 — Fixes MCP failing to reconnect after sleep or a keychain lock (10/21). 2.1.306 also fixed the false claude -p login message●SONNET 4.5 — Retires on the Claude API on 11/30, 33 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●API — In API version 2026-10-21, passing temperature, top_p or top_k returns a 400 error●NEW — I Put a Ten-Line Promise File at the To…●2.1.311 — Adds idle-hold options for self-hosted runners and fixes startup freezes and stalled interrupts (10/26)●2.1.307 — Fixes MCP failing to reconnect after sleep or a keychain lock (10/21). 2.1.306 also fixed the false claude -p login message●SONNET 4.5 — Retires on the Claude API on 11/30, 33 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●API — In API version 2026-10-21, passing temperature, top_p or top_k returns a 400 error●NEW — I Put a Ten-Line Promise File at the To…
Articles/Claude.ai
◉ Claude.ai/2026-04-20Advanced

Claude Computer Use 2026 — Desktop Automation Across Browser, Desktop, and CLI

The practical guide to Claude Computer Use. Covers the latest setup for macOS general availability, browser and desktop automation patterns, and practical production deployment strategies.

Claude Computer UseDesktop AutomationBrowser AutomationClaude API137RPA

✦ Premium Article

After about six months running Claude Computer Use in production environments, the initial skepticism of "will this actually work?" has shifted to a more interesting question: "how much can I delegate to it?" With general availability on macOS now in place and real-world adoption growing, I want to lay out the full picture of this capability and how to use it effectively.

What Computer Use Actually Is — The Screenshot Loop

The fundamental difference between Computer Use and other AI features is that Claude autonomously runs a "see → decide → act" loop. Internally, it works like this:

Take a screenshot → Claude looks at the image and decides where to click → Execute the specified coordinate click, type, or scroll → Take another screenshot to confirm the result → Move to the next action

The elegant part of this design is that it does not use a dedicated vision model trained on UI analysis. It uses Claude's general-purpose multimodal understanding — which means it can handle unfamiliar interfaces flexibly. The tradeoff is that pixel-coordinate precision has limits, making errors more likely with dense UIs or dynamic content.

Understanding this characteristic before you start is what separates successful production deployments from frustrating experiments.

Setup — From API Key to First Working Task

What you need

pip install anthropic pillow

Use claude-opus-4-6 or claude-sonnet-4-6. Computer Use is available on Bedrock and Vertex AI as well, but the Anthropic API direct connection gets new features fastest.

Minimal working code

import anthropic
import base64
from PIL import ImageGrab
 
client = anthropic.Anthropic()
 
def take_screenshot():
    """Capture screenshot and return as base64"""
    screenshot = ImageGrab.grab()
    screenshot = screenshot.resize(
        (screenshot.width // 2, screenshot.height // 2)
    )  # Resize to reduce token cost
    screenshot.save("/tmp/screen.png")
    with open("/tmp/screen.png", "rb") as f:
        return base64.standard_b64encode(f.read()).decode("utf-8")
 
def run_computer_use_task(task: str):
    screenshot_b64 = take_screenshot()
    
    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=4096,
        tools=[
            {
                "type": "computer_20241022",
                "name": "computer",
                "display_width_px": 1280,
                "display_height_px": 800,
            }
        ],
        messages=[
            {
                "role": "user",
                "content": [
                    {
                        "type": "image",
                        "source": {
                            "type": "base64",
                            "media_type": "image/png",
                            "data": screenshot_b64,
                        },
                    },
                    {"type": "text", "text": task}
                ],
            }
        ],
    )
    return response

The Action Loop

The heart of Computer Use is the loop: when Claude returns a tool_use block, you execute that action, then send the resulting screenshot back to Claude.

import subprocess
import time
 
def execute_action(action: dict) -> str:
    action_type = action.get("action")
    
    if action_type == "screenshot":
        return take_screenshot()
    
    elif action_type == "left_click":
        x, y = action["coordinate"]
        subprocess.run(["cliclick", f"c:{x},{y}"])  # macOS
        time.sleep(0.5)
        return take_screenshot()
    
    elif action_type == "type":
        text = action["text"]
        subprocess.run(["cliclick", f"t:{text}"])
        time.sleep(0.3)
        return take_screenshot()
    
    elif action_type == "key":
        key = action["key"]
        subprocess.run(["cliclick", f"kp:{key}"])
        time.sleep(0.3)
        return take_screenshot()
    
    return take_screenshot()
 
def run_task_with_loop(task: str, max_iterations: int = 20):
    messages = [
        {
            "role": "user",
            "content": [
                {
                    "type": "image",
                    "source": {
                        "type": "base64",
                        "media_type": "image/png",
                        "data": take_screenshot(),
                    },
                },
                {"type": "text", "text": task}
            ],
        }
    ]
    
    for i in range(max_iterations):
        response = client.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=4096,
            tools=[{
                "type": "computer_20241022",
                "name": "computer",
                "display_width_px": 1280,
                "display_height_px": 800,
            }],
            messages=messages,
        )
        
        if response.stop_reason == "end_turn":
            print("Task complete")
            break
        
        tool_results = []
        for block in response.content:
            if block.type == "tool_use" and block.name == "computer":
                new_screenshot = execute_action(block.input)
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": [
                        {
                            "type": "image",
                            "source": {
                                "type": "base64",
                                "media_type": "image/png",
                                "data": new_screenshot,
                            },
                        }
                    ],
                })
        
        messages.append({"role": "assistant", "content": response.content})
        messages.append({"role": "user", "content": tool_results})
    
    return response
✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Step-by-step production deployment from the latest macOS setup, with hands-on code examples
✦Architecture design for choosing between browser, desktop, and CLI automation routes
✦Practical techniques for screenshot optimization, error recovery, and cost management
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◉ Claude.ai2026-10-27
Haiku 4.5's October 15 Floor Has Passed, but No Stop Date Has Been Set
An Active model's date in the deprecations table is a floor, not a schedule. Using the 60-day notice rule and past retirement gaps, here is how I audit pinned model IDs.
◉ Claude.ai2026-10-27
A Retirement Notice Landed This Morning: Three Screens to Open Before You Change Anything
An English deprecation email from Anthropic arrives and you don't write code. Here are three things to check first: whether it concerns you, what the date really means, and who to tell what.
◉ Claude.ai2026-10-04
claude-sonnet-4-5 stops on November 30 — I checked the bill before calling its replacement cheaper
claude-sonnet-4-5-20250929 retires on November 30, 2026. The recommended claude-sonnet-5-5 has lower list prices, but a new tokenizer and a 400 on temperature change the math. After reading, you can audit your own calls and plan the switch in order.