Desktop AI Agent powered by Claude Computer Use — controls mouse, keyboard & shell via natural language
Project description
GenWorker
A desktop AI agent powered by Claude Computer Use. GenWorker takes natural-language tasks and executes them on your desktop by controlling the mouse, keyboard, and shell — using Claude's computer, bash, and text editor tools.
Features
- Computer Use — mouse clicks, keyboard input, and screenshots via Claude's computer tool
- Shell Execution — runs PowerShell/CMD/bash commands
- File Editing — view, create, and edit files with the str_replace_editor tool
- Multi-monitor support — select which display to control
- Adaptive screenshots — fast for CLI, slower for GUI loads, with JPEG compression
- Retry & error recovery — exponential backoff on API errors, automatic recovery hints
- Context management — token tracking, smart compaction, and image pruning
- Task timeout — configurable time limit with graceful termination
Installation
With pip:
pip install genworker-ai
With uv (recommended):
uv pip install genworker-ai
Or run it directly without installing — uv will create a temporary environment, resolve dependencies, and execute the command in one step:
uv run --with genworker-ai genworker "Open Chrome and search for Python docs"
You can also use uvx (shorthand for uv tool run) to run it as a CLI tool:
uvx genworker-ai "Open Notepad and write Hello World"
Requirements
- Python 3.13+
- An Anthropic API key
Quick start
-
Create a
.envfile (or export the variable):ANTHROPIC_API_KEY=sk-ant-... -
Run a task:
genworker "Open Notepad and write Hello World"
Or start interactively:
genworker
Or with
uv(no install needed):uv run --with genworker-ai genworker "Open Notepad and write Hello World"
Usage
genworker [OPTIONS] [TASK]
| Option | Description |
|---|---|
TASK |
Natural-language task to execute (interactive prompt if omitted) |
--monitor, -m |
Monitor index to use (default: 0) |
--list-monitors, -l |
List available monitors and exit |
--no-thinking |
Disable Claude's extended thinking |
--timeout, -t |
Task timeout in seconds (default: 600) |
--gui |
Launch the graphical interface |
You can also run it as a Python module:
python -m genworker "Open Chrome and search for Python docs"
Platform Setup Guide
GenWorker controls your desktop — mouse, keyboard, and screen capture. Each operating system requires specific permissions and setup. Follow the instructions for your platform below.
macOS
1. Grant Accessibility Permission (Required)
macOS blocks apps from controlling the mouse and keyboard unless you explicitly grant Accessibility access. Without this, GenWorker will run but mouse clicks and key presses will silently do nothing.
- Open System Settings (or System Preferences on older macOS)
- Go to Privacy & Security → Accessibility
- Click the + button (you may need to unlock with your password)
- Add the terminal app you use to run GenWorker:
- Terminal.app —
/Applications/Utilities/Terminal.app - iTerm2 —
/Applications/iTerm.app - VS Code integrated terminal — add
/Applications/Visual Studio Code.app - PyCharm terminal — add the PyCharm application
- Terminal.app —
- Make sure the toggle next to your app is ON
- Restart your terminal after granting access (required for the permission to take effect)
How do I know if this is working? GenWorker runs built-in diagnostics at startup on macOS. Look for:
🔍 macOS mouse diagnostics ────────────────────────────────────────────────── ✅ Accessibility: GRANTEDIf you see
❌ Accessibility: DENIED, follow the steps above.
2. Grant Screen Recording Permission (Required for screenshots)
GenWorker takes screenshots to see what's on your screen. macOS requires Screen Recording permission for this.
- Open System Settings → Privacy & Security → Screen Recording
- Click + and add the same terminal app from step 1
- Toggle it ON
- Restart your terminal
On first run, macOS may show a popup asking for Screen Recording permission — click Allow.
3. Retina Display Notes
GenWorker automatically detects Retina (HiDPI) displays and handles coordinate scaling. The startup diagnostics will report:
📐 CoreGraphics logical = 1512×982
📐 CoreGraphics physical = 3024×1964
📐 Retina scale factor = 2.0×
✅ Coordinate scaling: screeninfo matches logical points
If a mismatch is detected, GenWorker will auto-correct. No manual action is needed.
4. macOS Quick Start
# Install (pick one)
pip install genworker-ai
# or
uv pip install genworker-ai
# Set your API key
export ANTHROPIC_API_KEY=sk-ant-...
# Run (diagnostics will confirm permissions are OK)
genworker "Open Safari and search for Python documentation"
# Or use the GUI
genworker --gui
# Or run without installing (uv handles everything)
uv run --with genworker-ai genworker "Open Safari and search for Python documentation"
Windows
1. Display Scaling (DPI)
Windows display scaling (100%, 125%, 150%, etc.) can cause mouse clicks to land at wrong positions. For best results:
- Option A — Set display scaling to 100% in Settings → Display → Scale
- Option B — If you need a higher scaling, GenWorker will attempt to handle it automatically, but 100% is the most reliable setting
To check your current scaling:
- Right-click the desktop → Display settings
- Look at Scale and layout → Scale
2. Running as Administrator
Some tasks require elevated privileges (e.g., interacting with apps running as admin, or modifying system settings). If GenWorker can't click on certain windows:
- Right-click your terminal (Command Prompt, PowerShell, or Windows Terminal)
- Select Run as administrator
- Run GenWorker from that elevated terminal
For most tasks, standard (non-admin) mode works fine. Only escalate if you encounter permission issues.
3. Antivirus / Security Software
Some antivirus programs may flag GenWorker's mouse/keyboard control as suspicious. If you encounter issues:
- Add your Python installation directory to your antivirus exclusions
- Or temporarily disable the protection while using GenWorker
4. Windows Quick Start
# Install (pick one)
pip install genworker-ai
# or
uv pip install genworker-ai
# Set your API key (PowerShell)
$env:ANTHROPIC_API_KEY = "sk-ant-..."
# Or set it permanently via System Environment Variables:
# Settings → System → About → Advanced system settings → Environment Variables
# Run
genworker "Open Notepad and write Hello World"
# Or use the GUI
genworker --gui
# Or run without installing (uv handles everything)
uv run --with genworker-ai genworker "Open Notepad and write Hello World"
Linux
On most Linux desktop environments, GenWorker works without special permissions. If you encounter issues:
- Wayland —
pyautoguirequires X11. If your desktop uses Wayland, either switch to an X11 session or run withXDG_SESSION_TYPE=x11 - Headless servers — GenWorker requires a display. Use a virtual display like Xvfb:
sudo apt install xvfb xvfb-run genworker "your task"
GUI Mode
All platforms support an optional graphical interface:
genworker --gui
The GUI provides:
- A multi-line task input with Enter to submit
- Live screenshot preview of what the agent sees
- Start/Stop controls, timeout and step configuration
- Colour-coded output log
You can also launch it directly:
genworker-gui
Configuration
All settings can be configured via environment variables or a .env file:
| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY |
— | Required. Your Anthropic API key |
MODEL |
claude-sonnet-4-5-20250929 |
Claude model to use |
MAX_STEPS |
100 |
Maximum agent loop iterations |
TASK_TIMEOUT |
600 |
Task timeout in seconds |
THINKING_BUDGET |
4096 |
Token budget for extended thinking |
SCREENSHOT_INTERVAL |
1.0 |
Seconds between screenshots |
SCREENSHOT_QUALITY |
75 |
JPEG compression quality (1-100) |
MAX_CONTEXT_IMAGES |
15 |
Max screenshots kept in context |
BASH_TIMEOUT |
30 |
Shell command timeout in seconds |
MONITOR_INDEX |
0 |
Default monitor index |
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genworker_ai-0.2.1.tar.gz.
File metadata
- Download URL: genworker_ai-0.2.1.tar.gz
- Upload date:
- Size: 54.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
464c66a32f1a00aa768681ff13619994452c6fbd9705cc7dbc98d813c5d511be
|
|
| MD5 |
a493d2d022bd7d338696dd7d29425d0b
|
|
| BLAKE2b-256 |
afc0de2314d5fd301ed6228d3299d2e6c8ef500ec36bfadbff1dd1004868c38d
|
File details
Details for the file genworker_ai-0.2.1-py3-none-any.whl.
File metadata
- Download URL: genworker_ai-0.2.1-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98b5a28ff1ca67b9f56e2a5b752775759a81678ccc4fbf7d409cbadbc5bc7d30
|
|
| MD5 |
281f76ea11ab089bb87bedd43d23ca23
|
|
| BLAKE2b-256 |
220d490e00053178f96802600ccd8957b2d22871686b1ee12cea181aec715ec2
|