๐ agent2win
Universal Bridge Between Web / Cloud AI Agents & Windows OS
Control your Windows PC or Server directly from AI agents (Arena.ai, ChatGPT Custom Actions, Claude, Grok, LangChain, CrewAI) via secure REST API & WebSocket.
โ ๏ธ Platform Requirement:
agent2win is designed exclusively for Microsoft Windows (Windows 10, Windows 11, and Windows Server 2016+). It utilizes native Win32 APIs, COM interfaces (pyvda,pycaw), and Windows system controls.
[!WARNING] Never expose agent2win to the public internet without an API key.
Unrestricted mode permits remote command execution, filesystem access, input control, and system administration without interactive approval. Use--unrestrictedonly in trusted environments and stop the server immediately after use. Do not share your real API keys in public prompts, screenshots, or GitHub issues.
๐ Overview
agent2win is a lightweight, high-performance middleware server for Windows. It exposes a unified REST & WebSocket API, instantly accessible over the public internet through automatic Cloudflare or ngrok tunnels with zero router configuration.
Whether you are using AI environments executing curl requests in their sandboxes (like Arena.ai), connecting Custom Actions via ChatGPT, or driving automation loops with Claude, agent2win gives external models complete programmatic control over your Windows desktop.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Web & Cloud AI Ecosystem โ
โ โข Arena.ai & curl-capable agents โข chatgpt.com (Actions) โ
โ โข grok.com / xAI โข claude.ai / Anthropic โ
โ โข Autonomous Frameworks (LangChain, CrewAI, AutoGen, AutoGPT) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS / WSS (API Key Auth)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Cloudflare / ngrok Public Tunnel (Zero Port-Forwarding) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ agent2win Server (:7770) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Screen & Window Capture โ โข Mouse & Keyboard Emulation โ
โ โข Shell & Command Runner โ โข Virtual Desktop Isolation โ
โ โข Filesystem & Registry โ โข Process & Service Manager โ
โ โข Clipboard & Audio Controls โ โข Security & Approval Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โจ Key Features
- ๐ Web AI Compatibility: Connect web-based models (ChatGPT Actions, Claude, Grok, Arena.ai) to operate your Windows machines.
- โก Zero-Config Public Tunnel: Instant public HTTPS endpoint generated automatically using Cloudflare Tunnel (
cloudflared) orngrok. No static IP or port forwarding required. - ๐ฅ๏ธ Virtual Desktop Isolation: Create dedicated secondary virtual desktops (
/api/desktops). The agent works autonomously on Desktop 2 without interfering with your active tasks on Desktop 1. - ๐ธ Vision & Window Capture: Full display screenshots or targeted window-handle (
hwnd) captures in Base64 format for visual reasoning. - ๐ฑ๏ธ Hardware Input Emulation: Mouse click, drag, scroll, and keyboard typing with complete Unicode / international character support.
- ๐ป OS & System Administration: Run PowerShell/CMD scripts, manage filesystem (read/write/search/mkdir), list/kill processes, inspect Windows Services, and edit Registry keys.
- ๐ Security Layer: Bearer token authentication (
Authorization: Bearer <key>), real-time desktop approval prompts for risky commands, system tray killswitch, and audit logging.
โก Quick Start
1. Install from PyPI
pip install agent2win
2. Run Server (Recommended Secure Public Tunnel)
agent2win --key YOUR_STRONG_RANDOM_API_KEY --tunnel cloudflared
The console displays your live public HTTPS tunnel:
๐ Public Tunnel : https://xxxx.trycloudflare.com
Local-Only Usage (No Public Tunnel)
agent2win --no-tunnel
๐ค Using With AI Agents & curl-Capable Platforms (Arena.ai, ChatGPT, Claude, Grok)
๐ Direct Prompt to Connect Any AI / Agent
Copy and paste this prompt directly into Arena.ai, ChatGPT, Claude, Grok, or any AI capable of web fetching or executing curl requests:
Read the official agent2win control protocol from this URL:
https://raw.githubusercontent.com/harikasinkaya/agent2win/refs/heads/main/AGENT_PROTOCOL.md
You are now an autonomous Windows controller agent.
My agent2win server URL is: <PASTE_YOUR_TUNNEL_URL_HERE>
My API key is: <PASTE_YOUR_API_KEY_HERE>
Always include the header `Authorization: Bearer <API_KEY>` in all requests.
Please inspect the system info, capture the screen, and follow my instructions to control my Windows machine.
โก Example curl Commands (With Authentication)
# 1. Get system info
curl "https://xxxx.trycloudflare.com/api/info" \
-H "Authorization: Bearer YOUR_API_KEY"
# 2. Capture desktop screenshot (Base64 JPEG)
curl "https://xxxx.trycloudflare.com/api/screen" \
-H "Authorization: Bearer YOUR_API_KEY"
# 3. Execute command
curl -X POST "https://xxxx.trycloudflare.com/api/command" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"cmd":"whoami"}'
# 4. Click at screen coordinates
curl -X POST "https://xxxx.trycloudflare.com/api/mouse/click" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"x": 500, "y": 300, "button": "left"}'
# 5. Type Unicode text
curl -X POST "https://xxxx.trycloudflare.com/api/keyboard/type" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello from AI Agent ๐", "unicode": true}'
# 6. Write file (supports forward and backslashes)
curl -X POST "https://xxxx.trycloudflare.com/api/files/write" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "C:\\Users\\Public\\test.txt", "content": "agent2win test"}'
๐ค WebAPI Agent Mode (OpenAI-Compatible Gateways & GUI)
agent2win includes an autonomous agent runtime that transforms any standard OpenAI-compatible LLM gateway (DeepSeek Web, Gemini Web, vLLM, LiteLLM, Ollama) into a full Windows automation agent using plain JSON tool calling (no native function calling required).
Launch WebAPI Control Panel
agent2win --webapi
Features:
- Interactive Settings GUI: Configure API Base URL, API Key, Model dropdown (with auto
/modelsdiscovery), timeout settings, and step limits. - Allowed Folders Containment: Restrict file tools strictly to specified directories with canonical path resolution.
- Encrypted Storage: API keys are encrypted at rest using native Windows DPAPI (
CryptProtectData). - OpenAI-Compatible Endpoints:
POST /v1/chat/completionsโ Standard Chat Completion endpoint executing autonomous multi-step agent loops.POST /v1/responsesโ Unified response format endpoint.GET /v1/modelsโ Proxied model listing.GET /api/webapi/status,POST /api/webapi/start,POST /api/webapi/stopโ Runtime lifecycle control.
๐ ๏ธ CLI Options
| Option | Description |
|---|---|
--webapi |
Open WebAPI Agent GUI to configure & connect OpenAI-compatible LLMs |
--port <PORT> |
Server port (Default: 7770) |
--host <IP> |
Bind IP address (Default: 0.0.0.0) |
--key <SECRET> |
Set Bearer token for API authentication |
--tunnel <PROVIDER> |
Tunnel provider (cloudflared or ngrok, default: cloudflared) |
--no-tunnel |
Local-only mode (disables public tunnel) |
--no-tray |
Disable Windows system tray icon |
--unrestricted |
Disable action approval prompts (โ ๏ธ use carefully) |
--settings |
Open graphical configuration GUI |
โ ๏ธ Advanced / High Risk: Unrestricted Mode
For automated benchmarks and continuous integration pipelines where interactive desktop approval dialogs are not possible:
agent2win --key YOUR_STRONG_RANDOM_API_KEY --unrestricted
๐จ Security Notice: In unrestricted mode, all valid command execution, file modifications, and OS actions are executed without confirmation prompts. Never run unrestricted mode on public networks without an API key.
๐ก API Reference Overview
Full protocol specifications available in AGENT_PROTOCOL.md.
๐ฅ๏ธ Virtual Desktops (Background Mode)
GET /api/desktopsโ List all virtual desktops.POST /api/desktops/setupโ One-click create agent virtual desktop.POST /api/desktops/switch_agentโ Shift active view to agent desktop.POST /api/desktops/switch_userโ Switch active view back to user primary desktop.POST /api/desktops/createโ Create virtual desktop{"name": "Agent"}.POST /api/desktops/switchโ Switch desktop{"index": 2}.POST /api/desktops/removeโ Remove desktop{"index": 2}.
๐ธ Screen & Windows
GET /api/screenโ Full desktop screenshot (Base64 JPEG).GET /api/screen/infoโ Monitor resolutions and coordinates.GET /api/windowsโ List active windows with HWND handles, titles, and processes.GET /api/windows/foregroundโ Get active foreground window.POST /api/windows/screenshotโ Capture specific window byhwnd.POST /api/windows/focusโ Bring window to foreground{"hwnd": 12345}.POST /api/windows/closeโ Close window{"hwnd": 12345}.
๐ฑ๏ธ Mouse & Keyboard
POST /api/mouse/clickโ{"x": 500, "y": 300, "button": "left"}POST /api/mouse/moveโ{"x": 500, "y": 300}POST /api/mouse/scrollโ{"clicks": -5}POST /api/keyboard/typeโ{"text": "Hello World", "unicode": true}POST /api/keyboard/pressโ{"key": "enter"}POST /api/keyboard/hotkeyโ{"keys": ["ctrl", "c"]}
๐ป Shell & Filesystem
POST /api/commandโ{"cmd": "whoami", "timeout": 15}(persistent server:{"cmd": "npm start", "background": true})GET /api/files/list?path=C:\Usersโ List directory contents.GET /api/files/read?path=C:\test.txtโ Read text file.POST /api/files/writeโ Write file{"path": "C:\\test.txt", "content": "..."}.POST /api/files/mkdirโ Create directory{"path": "C:\\folder"}.POST /api/files/deleteโ Delete file or directory{"path": "C:\\test.txt"}.GET /api/files/drivesโ List available drive letters and free space.GET /api/files/search?dir=C:\&pattern=*.txtโ Search files matching pattern.
๐ Audio & System
GET /api/audio/volumeโ Get volume level{"level": 50, "muted": false}.POST /api/audio/volumeโ Set volume{"level": 50}.POST /api/audio/mute/POST /api/audio/unmuteโ Mute/unmute master audio.GET /api/audio/devicesโ List playback and recording audio devices (active,disabled,unplugged,not_present).GET /api/services?filter=spoolerโ List Windows services.GET /api/clipboard/POST /api/clipboardโ Read/write clipboard.
๐ง Development Installation
To install from source for development:
git clone https://github.com/harikasinkaya/agent2win.git
cd agent2win
pip install -e .
๐ License
Distributed under the MIT License. See LICENSE for details.
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 agent2win-1.1.4.tar.gz.
File metadata
- Download URL: agent2win-1.1.4.tar.gz
- Upload date:
- Size: 82.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc74e2f51c2910f082d96b92a89346e097e414ec38f061bea6e49af8608ecc62
|
|
| MD5 |
6cf2247c3e08529c3f7a9b9b429a9d8f
|
|
| BLAKE2b-256 |
8aeb525dd28d95499bb45c4afdd38339d0c20267bbc5c4c4d87b6346cc5eb649
|
File details
Details for the file agent2win-1.1.4-py3-none-any.whl.
File metadata
- Download URL: agent2win-1.1.4-py3-none-any.whl
- Upload date:
- Size: 94.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f76572c6bc10f46f4e94715b13abe1622e86b76a11c264b181a1d15154885e0d
|
|
| MD5 |
efa360e2e500f54d227445716bbe1762
|
|
| BLAKE2b-256 |
bf9eb5fa6d0fb4b24c42b8ce03156c096457e7f13e75bb35b202be6d2f5f4818
|