Skip to content

A Computer for Your AI Agent

See it, click it, type it, reset it. Give an AI agent a whole macOS, Linux or Windows computer that it uses the way a person does, and wipe it back to clean in seconds.

AI agents such as Claude Code, OpenAI Codex CLI, Claude Desktop, Cursor and GitHub Copilot can work with a computer's screen ("computer use"): they look at it, then click, type, scroll and press shortcuts, and check the result after every step. With VirtualProg, that computer is a virtual machine. The agent gets a desktop of its own to test apps, work through setup wizards or drive programs that have no command line, and none of it touches your Mac. When it's done, one restore puts the VM back exactly as it was.

The agent connects through the VirtualProg MCP server. It can run on the Mac itself, or on a Windows or Linux computer that controls the Mac's VMs over the network.

An AI agent sees a Windows VM's screen and clicks and types in it, through VirtualProg


How it works

 AI agent (Claude Code, Codex, …)
        │  MCP over stdio
        ▼
 vpvm mcp --allow-control          on the Mac, or on Windows / Linux
        │  VirtualProg HTTP API (HTTPS for remote)
        ▼
 VirtualProg on the Mac  ──►  VM screen, keyboard and mouse

The MCP server's vm_input tool works in a loop:

  1. The agent takes a screenshot of the VM.
  2. It decides what to do and sends an action at pixel coordinates in that screenshot.
  3. VirtualProg delivers the input to the VM and returns a new screenshot, and the loop repeats.
Action What it does
screenshot Captures the VM's screen; coordinates of the other actions refer to it
click, double_click, right_click Clicks at a point, optionally with modifier keys held
move, drag, scroll Hovers, drags (for example a window or a slider) and scrolls
type Types text, including capitals, symbols and new lines
key Presses a key or shortcut such as enter, ctrl+c, cmd+space, alt+f4 or win

Input goes to the VM directly, as from the web dashboard's remote screen. Nothing needs to be installed in the VM, and it works whether or not the VM's window is open on the Mac.


What you can use it for

  • UI testing: install your app, click through its main flows and check what appears, on macOS, Linux and Windows, and in Safari, Firefox, Chrome and Edge. See Use case: UI testing.
  • Apps without a command line or API: older desktop programs, admin consoles and system settings that can only be used through their windows.
  • Installers and setup wizards: step through them on a clean system and report what each screen asked.
  • Bug reproduction: follow a bug report on a fresh VM or a specific OS version, with screenshots as evidence.
  • Screenshots for docs and tutorials: walk through a feature and capture each step.
  • Untrusted software and websites: let the agent try them in a VM, then throw away whatever it left behind.

Requirements

  • VirtualProg with the CLI Server enabled in Settings → CLI.
  • vpvm for the computer the agent runs on: macOS, Windows or Linux. See Installation.
  • An agent that supports MCP and a model that can read images.
  • Screen Recording permission for VirtualProg, for screenshots of macOS and Linux VMs. See Permissions.
  • Checkpoints and linked clones need macOS 27 or later on the Mac; on earlier versions, use snapshots to reset VMs.

1. Get a desktop VM from the sample registry

VirtualProg publishes ready-to-use desktop VMs on GitHub Container Registry. Pull one to give the agent a working computer without installing an operating system:

Image Operating system Download size Notes
ghcr.io/last-programmer/ubuntu:latest Ubuntu Linux desktop About 12 GB A good first VM for an agent
ghcr.io/last-programmer/windows11:latest Windows 11 About 12 GB Activate Windows with your own license
ghcr.io/last-programmer/goldengate:latest macOS 27 Golden Gate About 35 GB The Mac must run macOS 27 or later

In VirtualProg: open Tools → Registry, click Pull (⬇️), enter the image reference, name the VM (for example Agent Ubuntu) and click Pull.

From a terminal:

vpvm images pull ghcr.io/last-programmer/ubuntu:latest --name "Agent Ubuntu"
vpvm images pull ghcr.io/last-programmer/windows11:latest --name "Agent Windows"
vpvm images pull ghcr.io/last-programmer/goldengate:latest --name "Agent macOS"

From the agent: with --mode full, ask "Pull ghcr.io/last-programmer/ubuntu:latest and name it Agent Ubuntu". The pull runs in the background and the agent can report its progress. With --allow-vm, the new name must be one of the allowed VMs.

You can also use any VM you create yourself. See OCI Registry for details and for sharing your own prepared VMs with your team.


2. Prepare the VM for the agent

Do this once, by hand, in the VM's window. A few minutes here makes every agent run more reliable.

  1. Start the VM and sign in. Turn on automatic sign-in, and turn off the screen lock and screen saver, so the agent never lands on a password prompt.
  2. Install Guest Tools. The agent then types with the VM's own keyboard layout, accented letters included. Without them, set a US keyboard layout: the agent types as on a US keyboard.
  3. Choose a moderate resolution, such as 1280 × 800 or 1440 × 900. Screenshots are scaled to at most 1280 pixels on their longest side, so very high resolutions make text hard to read.
  4. Install what the agent needs: the apps it will use, browsers, sample data. Dismiss first-run dialogs and update prompts.
  5. Stay out of Prism. The agent can't control a VM while it's in Prism; see Limits.
  6. Shut down the VM and take a checkpoint named clean (or a snapshot). Every run can start from it.

3. Connect your agent

Screen control is off by default. Turn it on with --allow-control, and limit the agent to its own VMs with --allow-vm:

Use Options
Screen control and power only mcp --allow-control --allow-vm "Agent Ubuntu"
Also pull images, take checkpoints, create linked clones mcp --mode full --allow-control --allow-vm "Agent Ubuntu"
Also reset VMs by restoring checkpoints mcp --mode full --allow-destructive --allow-control --allow-vm "Agent Ubuntu"

--allow-vm applies to every tool, so even destructive actions are limited to the named VMs. Separate several names with commas. In the examples below, replace /path/to/vpvm with the path of your vpvm file.

Claude Code

claude mcp add virtualprog -- /path/to/vpvm mcp --mode full --allow-destructive \
  --allow-control --allow-vm "Agent Ubuntu,Agent Windows,Agent macOS"

Run claude mcp list to check the connection, then start Claude Code.

OpenAI Codex CLI

codex mcp add virtualprog -- /path/to/vpvm mcp --mode full --allow-destructive \
  --allow-control --allow-vm "Agent Ubuntu,Agent Windows,Agent macOS"

Or add the server to ~/.codex/config.toml:

[mcp_servers.virtualprog]
command = "/path/to/vpvm"
args = ["mcp", "--mode", "full", "--allow-destructive", "--allow-control",
        "--allow-vm", "Agent Ubuntu,Agent Windows,Agent macOS"]

Claude Desktop, Cursor and GitHub Copilot

Add the same arguments to the server's args. vpvm prints a ready-to-use configuration:

vpvm mcp --print-config claude-desktop --allow-control --allow-vm "Agent Ubuntu"

See Connecting an AI Assistant for every client.


4. Run the agent on Windows or Linux

The MCP server is part of vpvm for Windows and Linux too. The agent runs on your PC; the VMs run on the Mac. This suits teams whose developers and pipelines work on Windows or Linux.

  1. On the Mac, turn on the CLI Server, External Access and HTTPS in Settings → CLI.
  2. Create an access token for the agent, limited to its VMs. An Operator token allows screen control and power actions; checkpoints, restores and linked clones need an Admin token for those VMs.
vpvm token create --label "AI agent" --vms "Agent Ubuntu,Agent Windows" --scope admin
  1. If the Mac uses its generated certificate, trust it on the PC.
  2. Check the connection from the PC, then connect the agent.

Claude Code on Windows (PowerShell):

$env:VPVM_TOKEN = "<access-token>"
.\vpvm.exe list --server 192.168.1.10 --secure
claude mcp add --scope user virtualprog -- "C:\Tools\vpvm\vpvm.exe" mcp --server 192.168.1.10 --secure --mode full --allow-destructive --allow-control --allow-vm "Agent Ubuntu,Agent Windows"
claude

Claude Code passes VPVM_TOKEN to the server when started from the same PowerShell window.

Codex CLI on Linux (~/.codex/config.toml):

[mcp_servers.virtualprog]
command = "/home/you/.local/bin/vpvm"
args = ["mcp", "--mode", "full", "--allow-destructive", "--allow-control",
        "--allow-vm", "Agent Ubuntu,Agent Windows"]
env = { VPVM_SERVER = "192.168.1.10", VPVM_SECURE = "1", VPVM_TOKEN = "<access-token>" }

Keep files that contain tokens private and out of version control. For every connection option, see Connecting to a Remote Mac.


5. Give the agent a task

Agents follow clear, step-by-step instructions best. Name the VM, the starting state, each step and what the result should be:

Use the VirtualProg MCP server on Agent Windows.

1. Restore checkpoint "clean" of Agent Windows, start the VM and wait until it is ready.
2. Open Settings and turn on Dark mode under Personalization → Colors.
3. Open Notepad and check that its window is dark.
4. Take a screenshot of each step and tell me what you changed.
Reproduce this bug on Agent Ubuntu, starting from checkpoint "clean":
"The app crashes when I open Preferences twice."

Install the attached .deb, follow the report, and capture the screen when it fails.
Report the exact steps that trigger the crash, or say that it doesn't happen.

Tips for reliable runs:

  • Prefer keyboard shortcuts for menus and small targets: they don't depend on exact positions.
  • Give slow apps time: ask the agent to wait a few seconds after launching an app or loading a page (wait_ms up to 10 seconds per action).
  • Use test accounts and sample data only. The agent asks before signing in, buying, sending email or deleting files on your behalf; say so in the task when that is intended.
  • Keep the task focused. Several short tasks are faster and cheaper than one long one, since every step sends a screenshot to the model.

6. Reset and run agents in parallel

Reset after each run. Restore the clean checkpoint (or snapshot), and the VM is exactly as you prepared it, whatever the agent did. The agent can do this itself with --allow-destructive.

Run in parallel with linked clones (macOS 27+): create one linked clone of the prepared VM per agent. Clones start in seconds and share the parent's disk, so ten VMs take little extra space. Give each agent its own clone with --allow-vm, so agents never click in each other's VMs. Delete the clones when you're done.


Use case: UI testing

UI testing is where a computer for your agent pays off most: the agent tests your app the way a user would, on every operating system, and every run starts from the same clean machine.

  1. Prepare one VM per platform as in step 2, with your app or a browser installed, and take a clean checkpoint.
  2. Write the test as a task with a clear pass condition:

    Use the VirtualProg MCP server to test sign-up on Agent Ubuntu.
    
    1. Restore checkpoint "clean" of Agent Ubuntu, start the VM and wait until it is ready.
    2. Open Firefox and go to https://staging.example.com/signup.
    3. Sign up as "Test User", [email protected], password Test-1234.
    4. Expected: the page shows "Welcome, Test User".
    5. After each step, check the screenshot. On any error, capture the screen and stop.
    6. Report pass or fail for each step, then shut down the VM.
    
  3. Run it everywhere: give the same task for Agent Windows (in Edge) and Agent macOS (in Safari) to check every platform and browser.

  4. Scale out: with linked clones, run one clone per test or per agent at the same time, and delete them afterwards.

The screenshots the agent captures on failure make a ready-made bug report.


Limits

  • Prism: the agent can't control a VM while it's in Prism: its apps are then Mac windows, and the VM's screen doesn't show what you see. Exit Prism first.
  • Keyboard: typing assumes a US layout in the VM, and only plain ASCII text, new lines and tabs. Other characters are refused before any key is pressed.
  • Shortcuts: use ctrl on Windows and Linux and cmd on macOS; win, super and cmd are the same key.
  • One user at a time: the agent moves the VM's pointer and focus. Don't use the VM while the agent works in it.
  • The VM must be running, not paused or suspended.

Security checklist

An agent that can click and type can do anything a person signed in to the VM can do.

  • [ ] The VM is used only for the agent: no personal accounts, passwords or private files.
  • [ ] The MCP server uses --allow-vm, limited to the agent's VMs.
  • [ ] Remote agents use an access token limited to those VMs, over HTTPS.
  • [ ] A clean checkpoint or snapshot exists, and the VM is reset after each run.
  • [ ] Tool approval stays on for vm_input until you trust the task.
  • [ ] --audit-log records what the agent did; see Activity log.
  • [ ] Web pages and documents in the VM can contain instructions aimed at the agent. Treat what it reads there as untrusted, and review its report before acting on it.

Troubleshooting

The agent has no vm_input tool. Add --allow-control to the server's arguments, with --mode operate (the default) or full, and restart the agent or reload its MCP servers.

"VM is in Prism". Exit Prism on the Mac, then ask the agent to continue.

"VM is stopped" or "paused". Start or resume the VM; the agent can do this itself.

"Could not capture the screen" for a macOS or Linux VM. Give VirtualProg Screen Recording permission in System Settings → Privacy & Security.

Windows screenshots fail right after the VM starts. Windows needs a few seconds before its screen is available. Ask the agent to wait, then retry.

Typed text has wrong characters. Install or update Guest Tools in the VM and sign in, so the agent types with the VM's layout. On a VM without Guest Tools, set the keyboard layout to US.

"The guest is using an input method". A Chinese, Japanese or Korean input method turns keys into composed text. Switch it to its English or alphanumeric mode, or to a keyboard layout, before the agent types.

Clicks land in the wrong place. The VM's resolution changed since the last screenshot. Ask the agent to take a new screenshot.

"This VirtualProg version doesn't support vm_input". Update VirtualProg on the Mac to the same version as vpvm.


See also