# πŸšƒ Boxcar **A disposable desktop sandbox where LLM agents drive a real Windows 11 or Ubuntu machine.** [![CI](https://github.com/Status-Labs/boxcar/actions/workflows/ci.yml/badge.svg)](https://github.com/Status-Labs/boxcar/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) Boxcar is a single-script QEMU/KVM setup that boots a Windows 11 or Ubuntu Desktop VM, then hands the keyboard, mouse, and shell to an LLM so it can complete real GUI tasks on its own (computer-use). Bake a provisioned VM into a golden image once and **spawn fresh, disposable instances in seconds** as copy-on-write overlays β€” each one a clean, throwaway "boxcar" for an agent to work in. **Highlights** - πŸ–₯️ **One script per VM** β€” `./win11.sh` / `./ubuntu.sh`, fully unattended installs. - πŸ€– **Provider-agnostic agent** β€” Anthropic, OpenAI, or any OpenAI-compatible endpoint; Windows (PowerShell/SSH) and Ubuntu (bash) targets. - ⚑ **Golden images** β€” bake once, spawn disposable CoW clones in milliseconds. - 🧠 **DSPy variant** β€” an optimizable policy you can compile per-OS. - πŸ“Š **Scored benchmark suite** β€” 9 real tasks with verifiable end-states, an end-to-end eval runner (scorecard + JSON report, `--samples K` for pass-rate), and a rollout-bootstrapping optimizer. See [docs/evals.md](docs/evals.md). - β™Ώ **Accessibility trees** β€” opt-in AT-SPI / UI Automation grounding (`--a11y`). - 🎬 **Ready-made scenarios** β€” webmail, downloads, invoices, a multi-page sign-up wizard, issue triage, expense reporting, and desktop-app tasks. > ⚠️ Boxcar lets an LLM run arbitrary commands and control a desktop inside a VM. > The VM is a sandbox, not a hardened security boundary β€” see [SECURITY.md](SECURITY.md). Each VM is a single script. Disks, UEFI vars, and TPM state live in `vms/`. ## What's included | File | Purpose | |-------------------|------------------------------------------------------| | `win11.sh` | Run / install / bake the Windows 11 VM (UEFI + TPM) | | `ubuntu.sh` | Run / install / bake the Ubuntu Desktop VM (autoinstall) | | `spawn.sh` | Spawn fast VMs from a baked base (CoW overlays) | | `lib/common.sh` | Shared config (paths, KVM, disk, UEFI, swtpm) | | `lib/qmp.py` | QMP helper (auto-keypress, screenshots) | | `control/winvm.py`| Python library to fully control the Windows VM | | `control/agent.py`| Let an LLM drive the VM autonomously (computer-use) | | `control/agent_dspy.py`| Same agent built with DSPy (CLI over `policy` + `runner`) | | `control/policy.py`| DSPy Signatures, action execution, LM + decider construction | | `control/runner.py`| The lookβ†’actβ†’look loop (`run_agent`) returning a scored `RunResult` | | `control/evals.py`| **End-to-end benchmark**: drive the scenario suite on a VM, score it, scorecard | | `control/optimize.py`| Compile-time optimizer β€” tunes the agent's policy (per-OS) | | `control/bootstrap_rollouts.py`| Harvest demos from *passing* runs β†’ back into the optimizer | | `control/os_context.py`| Loads the per-OS agent guide (single source of truth) | | `control/guides/*.md`| Editable OS "user guides" given to the agent as context | | `scenarios/framework.py`| Scenario spec (`task`/`setup`/`check`) + in-process host server | | `scenarios/registry.py`| Discovers every scenario; `select()` by name/target/tag | | `scenarios/webmail/`| Self-contained demo: log in + draft an email reply | | `scenarios/download/`| Cross-app demo: browser download β†’ process in the shell | | `scenarios/invoices/`| Readβ†’extractβ†’act demo: find the overdue row, act on it | | `scenarios/signup/`| Multi-page web wizard: Account β†’ Profile β†’ Review β†’ Create | | `scenarios/triage/`| Reason over tickets β†’ pick the critical one β†’ set a ``/checkbox stalls | | **total** | | **66/90 = 73.3%** | | ~$10.6 / full pass | **Headline:** the desktop suite is **40/40** with `--a11y`. Every residual failure is a **web** scenario: Chrome page content does not appear in the Linux AT-SPI tree, so `click_element` can't ground web widgets and the agent falls back to pixel-guessing on small form controls. The next lever is **CDP (Chrome DevTools Protocol) grounding**. ### Run history | date | commit | config | total | notes | |------|--------|--------|-------|-------| | 2026-07-05 | `07d012b` | gpt-5, `--a11y` | **66/90 (73.3%)** | desktop 40/40; residual = web grounding | | 2026-07-04 | `07d012b` | gpt-5, no a11y | 53/90 (58.9%) | ablation: `files` 0/10 without a11y (vs 10/10 with) β€” a11y is decisive for click-bound desktop flows | ### Reproducing ```bash # spawn 3 headless clones and log them into the desktop, then: make eval-parallel NAMES=val1,val2,val3 SAMPLES=10 EVAL_ARGS=--a11y # single scenario, single clone: make eval NAME=val1 SCENARIO=triage SAMPLES=10 EVAL_ARGS=--a11y ``` JSON reports land in `control/optim/reports/eval-*.json` (written only on full completion). Run with `--a11y` for comparable numbers β€” the desktop scenarios are grounded via AT-SPI and score far lower without it. A full n=10 pass costs roughly **$8–11** of gpt-5 usage; probe your API quota with one small call before launching (an `insufficient_quota` mid-run invalidates the affected scenarios at 0 steps). ## Fast VM spawning (golden images) A full install is slow (~15–25 min) and you only need to pay it once. **Bake** a provisioned VM into a read-only base image, then **spawn** fresh VMs from it as copy-on-write overlays β€” created in milliseconds, booted in ~30s. ```bash # 1. Bake once (after install + provisioning), VM powered off: ./ubuntu.sh bake # β†’ vms/ubuntu-base.qcow2 (read-only) + base NVRAM ./win11.sh bake # 2. Spawn instances in seconds (each gets its own overlay/NVRAM/TPM/SSH port): ./spawn.sh ubuntu test1 # prints its SSH port + QMP socket ./spawn.sh ubuntu test2 ./spawn.sh win11 qa1 # 3. Reset an instance to clean = delete its overlay: rm vms/ubuntu/clones/test1.qcow2 ``` Each overlay starts at ~200 KB and only stores its diffs from the base. Point the agent at an instance with its printed `VM_SSH_PORT` / `VM_QMP_SOCK` (or the `.env` vars). For running **many clones at once**, generalize first (regenerate hostname / machine-id / SSH host keys; `sysprep` on Windows) β€” see `docs/golden-images.md`. Design notes and the autoinstall gotchas live there too. ## Tuning Override resources with env vars, e.g.: ```bash RAM=12G CPUS=8 ./win11.sh ``` ### Run headless (in the background, hands-free) The agent never uses your real mouse/keyboard β€” QMP injects input into the VM's *virtual* devices, and `screendump` reads the framebuffer directly. The only reason you see activity is the QEMU window. Set `DISPLAY_MODE` to run with **no window at all**, so a VM/agent works in the background while you keep using your machine: ```bash DISPLAY_MODE=none ./spawn.sh ubuntu work1 # headless β€” no window, full agent DISPLAY_MODE=vnc ./spawn.sh ubuntu work1 # headless but watchable via VNC RAM=12G ./win11.sh # also honored by win11.sh / ubuntu.sh ``` - `gtk` (default) β€” shows a window on your desktop. - `none` β€” **headless**: no window, runs in the background. Agent works unchanged (verified: `screendump` + SSH function with no display). - `vnc` β€” headless but viewable: connect a VNC client to `127.0.0.1:5900` (`+VNC_DISPLAY`) to watch; it won't grab your input. ## Notes - Networking is QEMU user-mode (NAT) β€” outbound internet works out of the box, no root needed. The host can't reach the VM by IP directly. - Mouse is an absolute USB tablet, so the pointer tracks without grabbing. - Release the keyboard/mouse grab (if any) with **Ctrl+Alt+G**. ## Contributing Contributions are welcome β€” bug reports, docs, new scenarios, provider backends, and OS-guide recipes. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and the PR checklist, and please follow our [Code of Conduct](CODE_OF_CONDUCT.md). Found a security issue? See [SECURITY.md](SECURITY.md). ## License [MIT](LICENSE) Β© Ben Siewert