Anthropic native computer-use extension for the pi coding agent.
This package is the standalone extraction of senpi's former builtin anthropic-computer-use extension.
When PI_ANTHROPIC_COMPUTER_USE is enabled, dimensions are valid, API is anthropic-messages, and the selected model supports Anthropic's native computer-use beta, the extension:
- Registers a function tool named
computerwith a 16-action executor:screenshot,key,type,mouse_moveleft_click,right_click,middle_click,double_click,triple_clickleft_click_drag,cursor_position,left_mouse_down,left_mouse_upscroll,hold_key,wait
- Rewrites outgoing Anthropic payloads to ensure native
computer_20250124is present. - Strips function-shape
computerentries when they are not nativecomputer_*tool types. - Injects beta requirements in request payload:
- header:
anthropic-beta: computer-use-2025-01-24 - extra body:
betas: ["computer-use-2025-01-24"]
- header:
- Appends a system-prompt section informing the model about display dimensions and computer tool usage.
Claude Opus 4.7 does not currently support computer_20250124. For Opus 4.7 model ids, the extension does not rewrite the provider payload, add the computer-use beta, or append the native-computer system prompt.
PI_ANTHROPIC_COMPUTER_USE— opt-in switch (1,true,yes,on)PI_ANTHROPIC_COMPUTER_USE_WIDTH— required positive integer when enabledPI_ANTHROPIC_COMPUTER_USE_HEIGHT— required positive integer when enabledPI_ANTHROPIC_COMPUTER_USE_DISPLAY_NUMBER— optional positive integer (X11 multi-display)
If width/height are missing or invalid while enabled, the extension disables itself for that session and logs an error.
- macOS: supported via
screencapture,osascript, andcliclick - Linux: supported via
scrotandxdotool - Windows: unsupported (actions fail with a clear message)
Install dependencies:
- macOS:
brew install cliclick - Linux: install
xdotoolandscrotvia your distro package manager
# From npm (once published)
pi install npm:pi-anthropic-computer-use
# From git
pi install git:github.com/code-yeongyu/pi-anthropic-computer-use
# Manual placement
git clone https://github.com/code-yeongyu/pi-anthropic-computer-use ~/.pi/agent/extensions/pi-anthropic-computer-use
cd ~/.pi/agent/extensions/pi-anthropic-computer-use && npm install
# Dev / one-shot test
pi -e /path/to/pi-anthropic-computer-use/src/index.tsnpm install
npm test
npm run typecheck
npm run checkPorted from packages/coding-agent/src/core/extensions/builtin/anthropic-computer-use/index.ts in code-yeongyu/senpi-mono.
MIT.
- senpi — the fork/runtime these extensions are extracted from.
- Ultraworkers Discord — community link from the senpi README.
- Dori — the product powered by senpi under the hood.