Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Anthropics Anthropic sdk python BetaToolComputerUse 20241022

From Leeroopedia
Knowledge Sources
Domains API_Types, Beta_Features
Last Updated 2026-02-15 12:00 GMT

Overview

BetaToolComputerUse20241022Param is a TypedDict defining the parameter structure for the October 2024 version of the computer use tool. It specifies the display dimensions and configuration needed to enable the model to interact with a computer desktop environment.

Description

BetaToolComputerUse20241022Param is one of the earliest versioned computer use tool definitions. It allows the model to control a virtual computer by sending mouse clicks, keyboard input, and screenshot requests. The tool requires display dimensions so the model can reason about screen coordinates.

This version is identified by the type literal "computer_20241022" and the name literal "computer". It supports the following configuration:

  • Required fields: Display width/height in pixels, name (always "computer"), and type (always "computer_20241022")
  • Optional fields: Display number for X11 environments, cache control, deferred loading, allowed callers, input examples, and strict schema validation

Usage

Use BetaToolComputerUse20241022Param when you need to enable the October 2024 version of the computer use tool in a beta API request. Pass it as one of the tool definitions in the tools parameter. This is the original computer use version; consider using newer versions (January 2025 or November 2025) for enhanced features.

Code Reference

Source Location

  • Repository: Anthropic SDK Python
  • File: src/anthropic/types/beta/beta_tool_computer_use_20241022_param.py

Signature

class BetaToolComputerUse20241022Param(TypedDict, total=False):
    display_height_px: Required[int]
    display_width_px: Required[int]
    name: Required[Literal["computer"]]
    type: Required[Literal["computer_20241022"]]
    allowed_callers: List[Literal["direct", "code_execution_20250825"]]
    cache_control: Optional[BetaCacheControlEphemeralParam]
    defer_loading: bool
    display_number: Optional[int]
    input_examples: Iterable[Dict[str, object]]
    strict: bool

Import

from anthropic.types.beta import BetaToolComputerUse20241022Param

I/O Contract

Field Type Required Description
display_height_px int Yes The height of the display in pixels
display_width_px int Yes The width of the display in pixels
name Literal["computer"] Yes Tool name; always "computer"
type Literal["computer_20241022"] Yes Tool version identifier
allowed_callers List[Literal["direct", "code_execution_20250825"]] No Which callers may invoke this tool
cache_control Optional[BetaCacheControlEphemeralParam] No Cache control breakpoint for this tool definition
defer_loading bool No If true, tool is not included in initial system prompt
display_number Optional[int] No X11 display number (e.g., 0, 1)
input_examples Iterable[Dict[str, object]] No Example inputs for the tool
strict bool No When true, guarantees schema validation on tool names and inputs

Usage Examples

Basic Computer Use Tool Definition

from anthropic.types.beta import BetaToolComputerUse20241022Param

tool: BetaToolComputerUse20241022Param = {
    "type": "computer_20241022",
    "name": "computer",
    "display_width_px": 1920,
    "display_height_px": 1080,
}

With X11 Display Number

from anthropic.types.beta import BetaToolComputerUse20241022Param

tool: BetaToolComputerUse20241022Param = {
    "type": "computer_20241022",
    "name": "computer",
    "display_width_px": 1024,
    "display_height_px": 768,
    "display_number": 1,
}

Passing to the API

import anthropic

client = anthropic.Anthropic()

message = client.beta.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    tools=[
        {
            "type": "computer_20241022",
            "name": "computer",
            "display_width_px": 1920,
            "display_height_px": 1080,
        }
    ],
    messages=[{"role": "user", "content": "Take a screenshot of the desktop."}],
    betas=["computer-use-2024-10-22"],
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment