Run Minecraft in a Windows Sandbox for Computer Use Agents Cua-sandbox 0.3.3 enables running Minecraft Java Edition inside a Windows sandbox driven by an AI agent via the cua-driver MCP server, requiring a Microsoft account, a vision-capable LLM endpoint, and hardware virtualization for local execution. The setup involves booting a Windows Server 2022 sandbox, installing Prism Launcher and Mesa3D's software OpenGL driver, and configuring network interfaces to allow internet access. Run Minecraft in a Windows sandbox Boot a Windows sandbox, install Minecraft Java Edition, and drive it with an agent through the cua-driver MCP server running inside the sandbox. Minecraft exercises almost everything a Windows sandbox can do: it needs internet access, a Java runtime, working OpenGL, and a GUI that only clicks can drive. This guide boots a Windows sandbox, installs Minecraft Java Edition, and hands it to an agent that talks to cua-driver's MCP server inside the sandbox — the same loop against a local sandbox and against Fleet. Before you start before-you-start cua-sandbox 0.3.3 or newer. Windows on Fleet needs 0.3.0, Image.expose on the local QEMU runtime landed in 0.3.1, the sb.exposed ports this guide reads the forwarded port from landed in 0.3.2, and 0.3.3 brought both Image.from registry ..., os type=... and the pull-secret fix that lets Fleet boot an image from a registry outside its own allowlist — which the containerDisk section below needs. A host with hardware virtualisation for the local path — a Linux x86 64 machine with /dev/kvm , or an Intel Mac. This guide passes -cpu host , which QEMU only accepts with KVM or HVF. An x86 64 guest on Apple Silicon runs under TCG emulation, where -cpu host is rejected outright. The Fleet path runs there instead, including the game, with the one extra environment variable described in the Fleet section below. A Microsoft account that owns Minecraft Java Edition. Signing in uses Microsoft device authorization, so one step in the middle is manual: a code appears inside the sandbox and you approve it in your own browser. A vision-capable LLM endpoint for the agent loop. Boot a Windows sandbox boot-a-windows-sandbox Image.windows resolves to a pinned Windows Server 2022 containerDisk. Three things get added on top of the defaults: publishes cua-driver's MCP server, which already runs inside the guest, so the agent can reach it. .expose 3000 A second network interface. The bare-metal runtime attaches its NIC with restrict=on , which isolates the guest. sb.shell.run still works over the forwarded port, but nothing inside Windows can reach the internet — and Minecraft needs to.The default -cpu host . qemu64 model is too thin for a software OpenGL driver: Minecraft creates its window and then dies while loading resources, with no Java exception and no crash log. The last -cpu on the command line wins, so appending it is enough. A warm boot takes about 30 seconds. exposed ports maps each exposed guest port to the host port it landed on, and GET /healthz on that port answers ok once cua-driver is up. Read the port from sb.exposed ports, not from a tunnel. sb.tunnel.forward 3000 — the usual way to get a forwarded port, and the one the Fleet section below uses — raises NotImplementedError: HTTPTransport does not support port forwarding on the local transport. exposed ports is the local equivalent: the runtime picks a free host port at boot, so the mapping is only knowable at runtime, and it is saved with the sandbox state so a later Sandbox.connect can read it back. On Fleet the property is empty, because Fleet publishes services instead — use tunnel.forward there.Give the second NIC its own subnet. Both user-mode networks default to 10.0.2.0/24 and both offer the guest 10.0.2.15 , so Windows drops one interface to a 169.254.x.x link-local address with no gateway and no working DNS. Confirm the guest really has internet before installing anything. Install a launcher and a software OpenGL driver install-a-launcher-and-a-software-opengl-driver The sandbox GPU is the Microsoft Basic Display Adapter , which offers OpenGL 1.1. Minecraft 1.17 and later need OpenGL 3.2, so the game needs Mesa3D's opengl32.dll llvmpipe , which implements OpenGL in software. Both downloads below are MinGW builds on purpose. The MSVC builds of Prism Launcher and Mesa both depend on the Visual C++ redistributable, which Windows Server 2022 does not ship: Prism then exits silently, and Mesa's DLL fails to load so Windows quietly falls back to the system opengl32.dll . Save that as setup.ps1 , push it into the sandbox, and run it. It downloads roughly 100 MB, so allow a generous timeout. Sign in and create an instance sign-in-and-create-an-instance Prism opens a Quick Setup wizard on first run. Screenshot the sandbox, click through it, and stop at the account page. - Work through the wizard to Accounts → Add Microsoft . Prism shows a QR code and an eight-character device code. - Read the code off a screenshot, open https://www.microsoft.com/link in your own browser, enter it, and approve the sign-in. The account then appears with status Ready . - Click Add Instance , search for a version such as 1.20.1 , and click OK . Prism downloads the client jar and assets. Device codes expire after about fifteen minutes, but Prism issues a fresh one automatically and keeps polling, so the dialog can be left open. Take a new screenshot to read the current code rather than reusing an old one. Point the software driver at the launcher's Java point-the-software-driver-at-the-launchers-java Click Launch once. Prism downloads its own Java runtime and the game fails with GLFW error 65542: WGL: The driver does not appear to support OpenGL — expected, because Mesa is not in place yet. Prism may keep using the runtime it downloaded even if you set JavaPath in its config, so copy the Mesa DLLs next to every javaw.exe under the install root. Windows loads opengl32.dll from the running executable's directory before the system directory, which is what makes this work. Deliver it the same way as the first script. Click Launch again. The Minecraft title screen appears after a minute or two. Drive it with an agent over MCP drive-it-with-an-agent-over-mcp The sandbox already runs cua-driver , which serves an MCP endpoint on guest port 3000 — that is what .expose 3000 published. The agent is a small loop: list the MCP tools, hand them to a model as ordinary function tools, call whichever one it picks, feed the result back. Three things about cua-driver's tools shape the loop: A YAML policy governs which tools may actually run, and Every cua-driver release to date advertises the full surface and refuses out-of-policy calls only when you make them, with list tools does not reflect it. Permission denied: user policy: tool 'X' is not allowed by the YAML policy . So the listing is a menu of what exists, not of what you can call. Here that surface was 55 tools, identically over the local and Fleet transports: get desktop state , list apps , list windows , get window state , click , double click , type text , press key , hotkey , launch app , bring to front , scroll and drag ran, while get screen size , get accessibility tree , get config , check permissions , get cursor position and zoom were refused. Treat that split as something to probe on your own image rather than a fixed list — a denial arrives before the tool executes, so probing is cheap. Later drivers filter the listing through the policy, at which point the two finally agree. Clicks are addressed to an application, not the screen. click pid=..., x=..., y=... targets a window belonging to that pid, which you find with list windows . Add delivery mode='foreground' when a background-delivered click does not land. There is no wait tool. The loop waits by calling get desktop state again, so say that in the system prompt or the model will invent something worse. Point it at the exposed port and give it the task. Because the MCP tools are presented as ordinary function tools , this works against endpoints that reject the provider-native computer-use tool types. That is not hypothetical: on the gateway used here, the same model with the same image in the same second returned 200 for an ordinary function tool and 403 for Anthropic's computer 20250124 , and computer use preview was refused outright. The complete wrapper above exists only for that gateway — it is streaming-only, and it rejects role: system . Against an endpoint without those quirks, call litellm.acompletion directly. A full run — launcher to standing in a new world — took 52 steps locally and 51 on Fleet, roughly twenty minutes, most of it waiting on the software renderer. Expect the model to spend long stretches doing nothing but re-screenshotting. Give the model help with coordinates. A vision model without grounding guesses pixel positions and misses: in one run an ungrounded model clicked at 1226, 210 four times, nowhere near the button it wanted, then declared it had no desktop tool. cua-driver's list windows and pid-scoped clicks avoid most of this, and a grounding pass over the screenshot removes the rest. Publish the installed sandbox as a containerDisk publish-the-installed-sandbox-as-a-containerdisk Everything above is a one-time cost, and none of it has to be repeated — least of all on Fleet, where a manual GUI install is the least pleasant part of this guide. A cua sandbox boots from a containerDisk : an OCI image whose entire content is one file at /disk/disk.img . Push the disk you just built as one, and every later sandbox, local or Fleet, starts with Prism, Java, Mesa and the game files already in place. Despite the name, /disk/disk.img is a qcow2 , not a raw image. The puller looks for exactly disk/disk.img or ./disk/disk.img inside the layer tarball and caches whatever it finds under ~/.cua/cua-sandbox/images/container-disks/ . Nothing reads the extension — it is a KubeVirt convention. Sandbox.snapshot is a different feature and not a substitute: it forks a cloud sandbox in place, raises NotImplementedError: Snapshots are only supported for cloud sandboxes on the local runtime, and returns an Image you cannot push or pull. Build the image before you sign in, never after. A disk that has ever held a signed-in Minecraft account cannot be reliably cleaned, and a containerDisk you publish is a disk anyone can pull. Deleting Prism's accounts.json is not enough, and neither is deleting it and then zero-filling the volume's free space. Both were done to a disk where the game had been played, and the Microsoft profile name, the profile UUID and a full Mojang access-token JWT were still recoverable from the exported image. Mapping the byte offsets back to files with ntfscluster put them in three places: — most of them. The JVM heap, swapped out, holding the pagefile.sys --accessToken command line and raw HTTPS response bodies from api.minecraftservices.com . Free-space zeroing cannot reach it, because the pagefile is an allocated file. File slack inside a live log. Clusters allocated to instances/1.20.1/minecraft/logs/latest.log past its valid-data length still held Setting user: