Skip to content
C.W.K.
Stream
Lesson 04 of 06 · published

Server Tools, and Computer Use: Who Runs What

~16 min · server-tools, web-search, code-execution, computer-use

Level 0Observer
0 XP0/64 lessons0/13 achievements
0/150 XP to next level150 XP to go0% complete

Two tools Anthropic runs for you, and one it does not

Beyond your custom tools, Anthropic offers server tools — capabilities Anthropic implements and runs: web_search (live internet search) and code_execution (Python sandbox for math/data). You pass them in tools just like custom ones, and the API handles the execution. computer_use (control a desktop) looks the same in the request, but it is a client-side tool: Anthropic defines its schema and trains the model on it, and your code takes the screenshots and performs every click.

web_search and code_execution are productivity wins

web_search adds 2025+ knowledge to a 2024-cutoff model. code_execution lets the model do exact arithmetic instead of guessing. Both are billed; check pricing pages. Both have rate limits and configuration knobs (max searches per request, sandbox memory).

computer_use is a different beast

With computer_use the model asks for mouse and keyboard actions and your harness carries them out on a machine you control, sending a screenshot back after each one. It is intended for automation that drives a virtual desktop you have sandboxed. Use cases: filling forms in legacy GUIs, browsing where headless scraping fails, accessibility testing. Power tool — pair with strict permissions.

Principle: Server tools shrink the surface area of capability you must build. Use them where they fit; do not rebuild what Anthropic ships.

Code

Adding web_search and code_execution·python
resp = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=2048,
    tools=[
        {
            "type": "web_search_20250305",
            "name": "web_search",
            "max_uses": 5,
        },
        {
            "type": "code_execution_20250522",
            "name": "code_execution",
        },
        # ... your custom tools alongside
    ],
    messages=[{"role": "user", "content": "What was the closing S&P 500 yesterday? Show the calculation in Python."}],
)
computer_use sketch (Python)·python
# computer_use runs on YOUR machine: this is only the request shape, and the tool
# version must match the model (check the current computer-use docs for the pair).
resp = client.beta.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=4096,
    tools=[
        {
            "type": "computer_20241022",
            "name": "computer",
            "display_width_px": 1280,
            "display_height_px": 720,
        }
    ],
    betas=["computer-use-2024-10-22"],
    messages=[{"role": "user", "content": "Open Firefox and go to anthropic.com"}],
)
# Each tool_use block is a coordinate-driven action; you stream screenshots back as tool_result.

External links

Exercise

Replace one of your custom tools with a server tool where appropriate (web_search instead of a wrapped Google API, code_execution instead of a Python eval bridge). Compare reliability and cost.
Hint
If your custom tool was rate-limited, server tools usually pay better — but check the pricing page for your specific volume.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.