Skip to main content

๐Ÿš€ agent2win

Universal Bridge Between Web / Cloud AI Agents & Windows OS

Control your Windows PC or Server directly from web-based AI platforms like ChatGPT, Gemini, Grok, Claude, or custom cloud agents.

License: MIT Python 3.9+ Platform: Windows API: REST & WebSocket


๐Ÿ’ก Turn Any Web AI Into a Windows Agent:
Any AI model or platform with web/API browsing capabilities (ChatGPT / Custom GPTs, Gemini, Grok, Claude, OpenAI Assistants, LangChain, CrewAI) can be transformed into an autonomous computer-use agent to control your local Windows PC or remote Windows Server via secure REST / WebSocket endpoints.


๐Ÿ“– 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 building custom autonomous agents or connecting conversational web AIs (chatgpt.com, gemini.google.com, grok.com) via Custom Actions / API tools, agent2win provides full control over your OS environment.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Web & Cloud AI Ecosystem                                         โ”‚
โ”‚ โ€ข chatgpt.com (Custom GPTs / Actions)   โ€ข gemini.google.com      โ”‚
โ”‚ โ€ข 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: Turn web-based models (ChatGPT Actions, Gemini, Grok, Claude) into remote operators for your Windows machines.
  • โšก Zero-Config Public Tunnel: Instant public HTTPS endpoint generated automatically using Cloudflare Tunnel (cloudflared) or ngrok. No static IP or port forwarding required.
  • ๐Ÿ–ฅ๏ธ Virtual Desktop Isolation: Create dedicated hidden/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), list/kill processes, inspect Windows Services, and edit Registry keys.
  • ๐Ÿ”’ Comprehensive Security Layer: Token authentication (Bearer), real-time desktop approval prompts for risky commands, system tray killswitch, and audit logging.

โšก Quick Start

1. Install

Clone repository and install dependencies:

git clone https://github.com/harikasinkaya/agent2win.git
cd agent2win
pip install -r requirements.txt

Or double-click install.bat on Windows.

2. Run Server

python main.py

Or double-click start.bat.

3. Connect Any AI Agent

The console displays your live public HTTPS tunnel:

๐ŸŒ Tunnel: https://xxxx-xxxx-xxxx.trycloudflare.com

Connect your AI agent (e.g. ChatGPT Custom Action schema, LangChain tool, or web agent) using this URL.


๐Ÿค– Using With Web AIs (ChatGPT, Gemini, Grok, Claude)

๐Ÿ“‹ Direct Prompt to Connect Any Web AI

Copy and paste this prompt directly into ChatGPT, Gemini, Grok, Claude, or any web AI with browsing/fetching capabilities:

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_OR_LEAVE_EMPTY>

Please inspect the system info, capture the screen, and follow my instructions to control my Windows machine.

ChatGPT Custom GPTs / Actions

  1. Open ChatGPT -> Create a GPT -> Configure -> Add Action.
  2. Set Server URL to your tunnel address (https://xxxx.trycloudflare.com).
  3. Set Authentication to API Key (Bearer token) if configured.
  4. Import endpoints from AGENT_PROTOCOL.md to let ChatGPT inspect your screen, run commands, and click UI elements.

Gemini, Grok & Cloud Agents

Pass the public tunnel URL and API endpoints into your agent execution loop. The agent can take screenshots (/api/screen), process images with vision models, and issue input commands (/api/mouse/click, /api/keyboard/type).


๐Ÿ› ๏ธ CLI Options

Flag Description
--port <PORT> Server port (Default: 7770)
--host <IP> Bind IP address (Default: 0.0.0.0)
--key <SECRET> Set Bearer token for API authentication
--unrestricted Disable action approval prompts (โš ๏ธ use carefully)
--tunnel <PROVIDER> Tunnel provider (cloudflared or ngrok)
--no-tunnel Local-only mode (disables tunnels)
--no-tray Disable Windows system tray icon
--settings Open graphical configuration GUI

๐Ÿ“ก API Reference Overview

Full protocol specifications available in AGENT_PROTOCOL.md.

๐Ÿ–ฅ๏ธ Virtual Desktops (Background Mode)

  • POST /api/desktops/setup โ€” Create agent virtual desktop.
  • POST /api/desktops/switch_agent โ€” Switch active view to agent desktop.
  • POST /api/desktops/switch_user โ€” Switch active view back to user desktop.

๐Ÿ“ธ Screen & Windows

  • GET /api/screen โ€” Full desktop screenshot (Base64 JPEG).
  • GET /api/windows โ€” List active windows with handles (hwnd) and coordinates.
  • POST /api/windows/screenshot โ€” Capture specific window by hwnd.
  • POST /api/windows/focus โ€” Bring window to foreground.

๐Ÿ–ฑ๏ธ Mouse & Keyboard

  • POST /api/mouse/click โ€” {"x": 500, "y": 300, "button": "left"}
  • POST /api/mouse/scroll โ€” {"clicks": -5}
  • POST /api/keyboard/type โ€” {"text": "Hello World", "unicode": true}
  • POST /api/keyboard/hotkey โ€” {"keys": ["ctrl", "c"]}

๐Ÿ’ป Shell & Filesystem

  • POST /api/command โ€” {"cmd": "dir C:\\", "timeout": 10}
  • GET /api/fs/list?path=C:\ โ€” List directory contents.
  • POST /api/fs/read โ€” Read file contents.
  • POST /api/fs/write โ€” Write file contents.

๐Ÿ”’ Security & Approvals

  • Safe Mode (Default): Critical actions (destructive shell commands, file deletions, registry writes, system reboot/shutdown) trigger desktop approval prompts.
  • Unrestricted Mode (--unrestricted): Disables interactive confirmation for headless/autonomous agents.
  • Audit Logs: All executions recorded in logs/audit.log.
  • Tray Killswitch: Pause or stop the server directly from the Windows taskbar.

๐Ÿ“„ 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

agent2win-1.0.1.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent2win-1.0.1-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

Details for the file agent2win-1.0.1.tar.gz.

File metadata

  • Download URL: agent2win-1.0.1.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for agent2win-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e1aac361ebc5d5a2b1fdf6ec704b3711fa0fb1bda287a0174e74270e5761c390
MD5 c09a901bd8a12c0bed3e7e0cc56868cb
BLAKE2b-256 94d5d559c522e54e9d1bc0c6ba44f150f34084037c9052ccc1b64ac4337481c4

See more details on using hashes here.

File details

Details for the file agent2win-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: agent2win-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 51.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for agent2win-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 526cdd38bd2e952f68006ed84ce7130e7d842e902ddbc4fb9f34060410d07015
MD5 201f73a9a117aa04ac153364604ce987
BLAKE2b-256 94b969044187b9facb9d8458948806707a19fcc0407cbb9107ba2a0ced608758

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page