# VMForAI.com > Desktops and virtual machines for computer-use agents: Linux displays, VNC viewing, Windows VMs, screen size and DPI, input, recording and sizing. --- # Clipboard, audio and file transfer in an agent's desktop URL: https://www.vmforai.com/issue/clipboard-audio-and-file-transfer-in-an-agent-desktop/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 On a Linux agent desktop, read and set the clipboard with xclip, give applications a sound device with a PulseAudio null sink and record its monitor, and move files with docker cp, a dedicated shared folder or an upload endpoint in the desktop. Keep each channel one-way where you can. Clipboard, audio and files are the three side channels of an agent desktop: ways for data to move that are not a screenshot or a click. Tasks need them (paste this table, check that the video plays, download the report), and graders need them to check results. They are also the paths by which data leaves the desktop, so set each one up on purpose. ## How does an agent read and set the clipboard on Linux? An agent reads and sets the clipboard with xclip, choosing the clipboard selection explicitly. ``` export DISPLAY=:99 xclip -selection clipboard -o # print what Ctrl+C copied printf '%s' "$TEXT" | xclip -selection clipboard -i xclip -selection clipboard -o -t TARGETS # list the formats on offer ``` From the xclip manual (read 2026-11-26): the `-selection` option takes "primary", "secondary" or "clipboard", and primary is the default. `-o` will "print the selection to standard out", and `-t` asks for a specific format, with `TARGETS` listing the valid ones. Two behaviours surprise people: 1. **The default is the wrong selection.** X has a primary selection (highlighted text, pasted with the middle button) and a clipboard selection (Ctrl+C, Ctrl+V). Agents almost always want the clipboard, so always pass `-selection clipboard`. 2. **xclip stays running.** Its default mode is to "fork into the background to wait for requests", and `-loops` sets how many pastes to serve; the default of 0 waits until another application takes the selection over ([xclip manual](https://manpages.debian.org/bookworm/xclip/xclip.1.en.html)). This is how X clipboards work: the program that copied owns the data. If the harness kills every background process between steps, the clipboard empties. If people watch through x11vnc, its clipboard sync runs both ways. `-noclipboard` stops x11vnc from polling "the CLIPBOARD selection for changes to send back to clients", and `-nosetclipboard` stops it setting the clipboard from viewers ([x11vnc manual](https://manpages.debian.org/bookworm/x11vnc/x11vnc.1.en.html), read 2026-11-26). Use both when an observer should not see what the agent copies, or be able to paste into its session. ## How do I give a headless desktop audio? Give a headless desktop audio with a PulseAudio null sink, then record from its monitor if you need to check sound. The module "Provides a simple null sink"; "All data written to this sink is silently dropped"; and "All sinks have a corresponding "monitor" source which makes the null sink a practical way to plumb output to input". Its sample defaults are format `s16`, rate 44100 and 2 channels ([PulseAudio modules](https://wiki.freedesktop.org/Software/PulseAudio/Documentation/User/Modules/), read 2026-11-26). ``` pactl load-module module-null-sink sink_name=agent_out pactl set-default-sink agent_out pactl list short sources # find the monitor source of agent_out ffmpeg -f pulse -i agent_out.monitor -t 10 sound-check.wav ``` FFmpeg's pulse device is a "PulseAudio input device", and its documented example records the default device with `ffmpeg -f pulse -i default` ([FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26). Confirm the monitor's name from the source list before recording. Why bother on a desktop no one listens to: a machine with no output device at all is not what applications expect from a real desktop, and tasks that play or check media need somewhere for the sound to go. A null sink gives them a device without any hardware. ## How do I move files in and out of an agent desktop? Move files through one channel you control, chosen by where the desktop runs. Table: Ways to move files in and out of an agent desktop | Method | Works for | Notes | |---|---|---| | `docker cp` | Containers | Works on running and stopped containers; not for `/proc`, `/sys`, `/dev`, tmpfs or mounts made in the container | | A shared folder (bind mount) | Containers and VMs | Simple, but a live channel for the whole run; mount read-only for inputs | | An upload and download endpoint in the desktop | VMs | OSWorld's in-VM server has `/setup/upload` and `/file` routes for this | | Remote Desktop drive redirection | Windows | FreeRDP's `/drive` will "Redirect directory as named share " | Sources: [docker container cp](https://docs.docker.com/reference/cli/docker/container/cp/), [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py) and [xfreerdp manual](https://manpages.debian.org/bookworm/freerdp2-x11/xfreerdp.1.en.html), read 2026-11-26. docker cp's two forms are `docker container cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-` and `docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH`. With `-` it writes or reads a tar stream, and `-a` keeps the source's ownership (docker container cp, read 2026-11-26). Copying results out after the container stops is a clean pattern for graders: ``` docker cp agent-run-42:/home/agent/output ./results/run-42 ``` ## How do I keep these channels from leaking data? Keep the channels from leaking data by giving each one a direction and a lifetime, starting with the network. An agent that can reach any address can upload whatever it can read. As a worked example of closing it, Promigence's FAQ says each of its sandboxes can have full outbound access, none, or an outbound allow-list, and that "refused connections are recorded"; it pairs the allow-list with agents that read untrusted input, such as web pages or user uploads (Promigence FAQ, read 2026-11-26). Its CLI reference adds two controls for a desktop that should go quiet partway through a task: `promigence sandbox network SID` "Shows what a sandbox may reach on the network and, when it has an allow-list, the hosts it was refused", and its `--cut` option "turns off its outbound access for good", for example once the task's inputs are in place (Promigence CLI reference, read 2026-11-26). Its error reference says what happens if the allow-list asked for is not applied: "the sandbox was discarded rather than started without the restriction you asked for" (Promigence errors and exit codes, read 2026-11-26). The same control, outbound traffic off or held to a list, goes by other names on other hosted services (read 2026-11-26): - **AWS:** a custom Amazon Bedrock AgentCore Code Interpreter is created in one of three network modes: Sandbox, described as "limited external network access to AWS services" with Amazon S3 reachable, Public, with internet access, or VPC, inside your own private network (AgentCore Code Interpreter documentation). - **Daytona:** each sandbox takes one of `networkBlockAll`, `networkAllowList` (up to 10 IPv4 CIDR blocks) or `domainAllowList` (up to 100 domains) (Daytona network limits documentation). - **E2B:** internet access stays on unless `allowInternetAccess` is false, and `allowOut` names the IP addresses, CIDR blocks or domains a sandbox may still reach (E2B internet access documentation). - **Google Cloud:** Agent Sandbox on GKE lets traffic in only through its router and blocks outbound traffic to private address ranges and the metadata server by default, while the public internet stays reachable (GKE Agent Sandbox documentation). - **Modal:** `block_network=True` refuses every outbound connection, `outbound_cidr_allowlist` admits only listed IP ranges, and `outbound_domain_allowlist`, in Beta, "Only allows TLS traffic (port 443) to the listed domain names" (Modal Sandbox networking guide). On your own hosts, the do-it-yourself equivalent is a separate network per desktop with an egress proxy that allows only the task's sites. Then close the other channels: 1. **Inputs read-only.** Mount task inputs read-only, so the agent cannot change the originals. 2. **Outputs collected once.** Copy outputs out at the end of the task, not through a folder the agent can write to the whole time. 3. **Viewer clipboard off by default.** Turn x11vnc's clipboard sync off unless a person is actively helping. 4. **No host folders.** Never share a home directory or a folder that holds credentials with the desktop. 5. **Reset with the desktop.** The clipboard and the audio setup live in processes on the desktop; restoring the desktop's snapshot clears them, as described in [OSWorld-style VM environments](https://www.vmforai.com/issue/osworld-style-vm-environment-setup/). ## What we read for this article - [xclip manual, Debian bookworm](https://manpages.debian.org/bookworm/xclip/xclip.1.en.html), read 2026-11-26 - [x11vnc manual, Debian bookworm](https://manpages.debian.org/bookworm/x11vnc/x11vnc.1.en.html), read 2026-11-26 - [PulseAudio modules](https://wiki.freedesktop.org/Software/PulseAudio/Documentation/User/Modules/), read 2026-11-26 - [FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26 - [docker container cp](https://docs.docker.com/reference/cli/docker/container/cp/), read 2026-11-26 - [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26 - [xfreerdp manual, Debian bookworm](https://manpages.debian.org/bookworm/freerdp2-x11/xfreerdp.1.en.html), read 2026-11-26 - Promigence FAQ, [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - Promigence CLI reference, [https://www.promigence.ai/docs/cli](https://www.promigence.ai/docs/cli), read 2026-11-26 - Promigence errors and exit codes, [https://www.promigence.ai/docs/errors](https://www.promigence.ai/docs/errors), read 2026-11-26 - [Amazon Bedrock AgentCore Code Interpreter documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-resource-management.html), read 2026-11-26 - [Daytona network limits documentation](https://www.daytona.io/docs/en/network-limits), read 2026-11-26 - [E2B internet access documentation](https://docs.e2b.dev/sandbox/internet-access), read 2026-11-26 - [GKE Agent Sandbox documentation](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/agent-sandbox), read 2026-11-26 - [Modal Sandbox networking guide](https://modal.com/docs/guide/sandbox-networking), read 2026-11-26 ## FAQ ### How does an agent read the clipboard on Linux? With xclip -selection clipboard -o, which prints the clipboard selection to standard output. Without -selection, xclip uses the primary selection, which is the highlighted text, not what Ctrl+C copied. ### Why does xclip seem to hang? It does not hang. By default xclip forks into the background and keeps serving the selection until another program takes it over, because X selections are owned by a running program, not stored by the server. ### How do I give a headless desktop a sound card? Load PulseAudio's module-null-sink. Applications play to it as if it were a real device, and every sink has a monitor source you can record from, for example with FFmpeg's pulse input. ### How do I copy files out of an agent's container? docker cp CONTAINER:/path DEST works on running and stopped containers. It cannot copy /proc, /sys, /dev, tmpfs or mounts made inside the container; use tar through docker exec for those. --- # Resource sizing for a desktop agent: memory, processors, disk and screenshots URL: https://www.vmforai.com/issue/desktop-agent-resource-sizing/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 Data as of: 2026-11-26 Data files: https://www.vmforai.com/data/desktop-agent-resource-sizing.csv (CSV), https://www.vmforai.com/data/desktop-agent-resource-sizing.json (JSON) Size a desktop agent's machine from the operating system's published minimum, then add its applications, a browser and capture. The table lists minimums for Windows 11 VMs, Ubuntu Desktop and Debian; two worked grids give an example hourly cost per size and a screenshot's raw size. Table: Published minimum memory and disk for desktop operating systems an agent may use | Operating system and setting | Memory (GB) | Disk (GB) | Processor, as stated | Source | Checked | |---|---:|---:|---|---|---| | Windows 11, virtual machine | 4 | 64 | Two or more virtual processors | [learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements](https://learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements) | 2026-11-26 | | Ubuntu Desktop 26.04.1 LTS | 6 | 25 | 2 GHz dual-core processor or better | [ubuntu.com/download/desktop](https://ubuntu.com/download/desktop) | 2026-11-26 | | Debian with desktop, minimum | 1 | 10 | Not given in the requirements table | [www.debian.org/releases/stable/amd64/ch03s04.en.html](https://www.debian.org/releases/stable/amd64/ch03s04.en.html) | 2026-11-26 | | Debian with desktop, recommended | 2 | 10 | Not given in the requirements table | [www.debian.org/releases/stable/amd64/ch03s04.en.html](https://www.debian.org/releases/stable/amd64/ch03s04.en.html) | 2026-11-26 | Table: Example: running cost per hour of a desktop's size at 0.0504 USD per vCPU-hour and 0.0162 USD per GiB-hour, the list rates of Promigence, Daytona and E2B (Cost per hour, USD) | vCPUs / Memory (GiB) | 4 | 6 | 8 | 16 | 32 | |---|---:|---:|---:|---:|---:| | 2 | 0.1656 | 0.1980 | 0.2304 | 0.3600 | 0.6192 | | 4 | 0.2664 | 0.2988 | 0.3312 | 0.4608 | 0.7200 | | 8 | 0.4680 | 0.5004 | 0.5328 | 0.6624 | 0.9216 | Formula: `vcpus * vcpu_rate + gib * gib_rate`, where vcpu\_rate = 0.0504; gib\_rate = 0.0162. Table: Uncompressed size of one 24-bit screenshot (worked out, an example) (Raw screenshot size, MiB) | Screen height (px) / Screen width (px) | 1,280 | 1,366 | 1,920 | |---|---:|---:|---:| | 720 | 2.64 | 2.81 | 3.96 | | 768 | 2.81 | 3.00 | 4.22 | | 1,024 | 3.75 | 4.00 | 5.63 | | 1,080 | 3.96 | 4.22 | 5.93 | Formula: `width * height * bytes_per_pixel / mib`, where bytes\_per\_pixel = 3; mib = 1,048,576. ## Method Each row was read on the checked date from the operating system's own requirements page, with memory and disk in GB and the processor wording as published; these are minimums for the operating system alone. ## How do I size a desktop agent's machine? Start from the operating system's published minimum, then add what the agent runs on it. The table above lists those minimums as their publishers state them, read on 2026-11-26. They cover the operating system only. 1. **Memory.** Take the minimum from the table, then add the task's applications. A browser on the desktop usually needs the most. 2. **Shared memory.** In a container, raise `/dev/shm`. Docker uses 64 MB when `--shm-size` is left out ([Docker run reference](https://docs.docker.com/engine/containers/run/), read 2026-11-26). 3. **Processors.** Windows 11 VMs need "Two or more virtual processors" ([Windows 11 requirements](https://learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements), read 2026-11-26). Add processors for screen recording and for applications that compile, render or run a browser. 4. **Disk.** The table's figures are for the system. Add the task files, the browser's cache, recordings and screenshots kept for debugging. 5. **Limits.** Set a memory and processor limit per desktop, so one runaway task cannot starve its neighbours. Docker's `--memory` sets the memory limit (its stated minimum is 6M) and `--cpus` the number of CPUs (Docker run reference). Then check the size by running real tasks and reading peak memory and processor use, not by trusting the minimum. ## How much memory do screenshots and recordings take? A screenshot takes width times height times 3 bytes uncompressed at 24-bit colour, which the second grid works out per screen size. It is an example calculation, not a measurement: the stored PNG is far smaller, but the agent's harness holds the raw image in memory while it resizes and encodes it, and keeps several when it sends a history of screens to the model. Recording adds an encoder process. Plan a processor for it at high frame rates; [recording an agent's desktop session](https://www.vmforai.com/issue/record-an-agent-desktop-session/) covers frame rates and file sizes. ## What does a size cost per hour of running time? A size's running cost is its vCPUs times the vCPU rate plus its memory times the memory rate. Promigence, used here as a worked example, lists $0.0504 per vCPU-hour plus $0.0162 per GiB-hour, metered per second (Promigence FAQ, read 2026-11-26), and Daytona and E2B list the same two rates, billed per second (Daytona and E2B pricing pages, read 2026-11-26), so the first grid's sums are the same at all three. With those rates, the Ubuntu Desktop minimum of 2 vCPUs and 6 GB, counted as 6 GiB, comes to $0.198 per hour, and the first grid does the same sum for other sizes. Two cautions before you use the grid. Providers sell sizes in steps of their own, so round your desktop up to the nearest size your provider offers and price that size. And providers bill processors in different units, some per vCPU, some per physical core, some on the processor time actually used, so redo the sum with your own provider's published rates and unit. ## Sources - [Windows 11 requirements](https://learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements), read 2026-11-26 - [Ubuntu Desktop download page](https://ubuntu.com/download/desktop), read 2026-11-26 - [Debian installation guide, minimum system requirements](https://www.debian.org/releases/stable/amd64/ch03s04.en.html), read 2026-11-26 - [Docker run reference](https://docs.docker.com/engine/containers/run/), read 2026-11-26 - Promigence FAQ, [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - [Daytona pricing page](https://www.daytona.io/pricing), read 2026-11-26 - [E2B pricing page](https://e2b.dev/pricing), read 2026-11-26 ## FAQ ### How much memory does a Windows 11 agent VM need? Microsoft lists 4 GB or more for a Windows 11 virtual machine, with two or more virtual processors and 64 GB or more of disk. That is the floor for Windows alone; the agent's applications come on top. ### How much memory does a Linux desktop for an agent need? It depends on the desktop. Ubuntu Desktop 26.04.1 LTS lists 6 GB, while Debian's installation guide gives 1 GB minimum and 2 GB recommended with a desktop. A bare Xvfb display with a light window manager is lighter than a full desktop environment, but a browser on it is not. ### Why does a browser crash in my agent's desktop container? Often because /dev/shm is too small. Docker gives a container 64 MB of shared memory when --shm-size is left out, and browsers use shared memory between their processes. Raise it, for example to 1 GB. ### How big is one screenshot? Uncompressed, width times height times 3 bytes at 24-bit colour. A 1920x1080 screen is about 5.93 MiB raw. PNG compression makes the stored file much smaller, but the raw size is what sits in memory while the image is processed. --- # How to set up a Linux desktop for an AI agent with Xvfb, a window manager and noVNC URL: https://www.vmforai.com/issue/linux-desktop-for-an-ai-agent/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 A Linux desktop for an AI agent is five programs on one machine or container: a virtual display (Xvfb), a light window manager, an input tool such as xdotool, a screenshot tool, and optionally a VNC server with noVNC so a person can watch. Start them in that order, as a non-root user. A Linux desktop for an AI agent is a virtual screen plus the few programs that make it behave like a normal computer. The agent never needs a monitor: it needs pixels to look at, a way to send mouse and keyboard events, and a window manager so applications open where they should. ## What are the parts of an agent desktop? An agent desktop has five parts, each a separate open-source program. Table: The parts of a Linux desktop for an agent | Part | What it does | Common open-source choice | |---|---|---| | Virtual display | Holds the screen in memory and runs X applications | Xvfb | | Window manager | Draws title bars, places and focuses windows | Openbox (or another light one) | | Input | Sends mouse moves, clicks and key presses to the display | xdotool, or pyautogui from Python | | Screenshot | Captures the screen as an image for the model | FFmpeg's x11grab device, or the agent framework's own capture | | Viewer (optional) | Lets a person watch or take over in a browser | x11vnc with noVNC and websockify | Xvfb's manual describes it as "an X server that can run on machines with no display hardware and no physical input devices" which "emulates a dumb framebuffer using virtual memory" ([Xvfb manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26). Openbox describes itself as "a minimalistic, highly configurable, next generation window manager with extensive standards support" ([Openbox](https://openbox.org/), read 2026-11-26). ## Step 1: How do I start the virtual display? Start Xvfb on a free display number with an explicit screen size and depth, and switch off TCP listening. ``` export DISPLAY=:99 Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp & ``` `-screen 0 1280x1024x24` "creates screen screennum and sets its width, height, and depth" (Xvfb manual). Always set it: the default depth differs between documentation versions, as our [Xvfb setup guide](https://www.vmforai.com/issue/xvfb-virtual-display-setup/) shows. `-nolisten tcp` is the X server option that disables TCP/IP connections ([Xserver manual](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26), so only programs on the same machine can draw on or read the screen. Programs started too early fail with "cannot open display". Wait until the display answers before going on, for example by looping on `xdpyinfo`, a utility "for displaying information about an X server" ([xdpyinfo manual](https://manpages.debian.org/bookworm/x11-utils/xdpyinfo.1.en.html), read 2026-11-26). ## Step 2: Why start a window manager, and which one? Start a window manager so that windows get focus, borders and sensible positions. Without one, new windows appear at the top-left corner with no title bar, and keyboard focus may not follow the window the agent clicked. Any light window manager works. Openbox is a common choice because it is small and needs no configuration to start: ``` openbox & ``` ## Step 3: How does the agent send input and take screenshots? The agent sends input with a tool that injects events into the X server and takes screenshots by reading the screen. - **Input.** xdotool "does this using X11's XTEST extension and other Xlib functions" ([xdotool manual](https://manpages.debian.org/bookworm/xdotool/xdotool.1.en.html), read 2026-11-26). `xdotool mousemove 640 512 click 1` moves and left-clicks. See [mouse and keyboard input for agents](https://www.vmforai.com/issue/xdotool-mouse-and-keyboard-input-for-agents/). - **Screenshots.** FFmpeg's x11grab device "allows one to capture a region of an X11 display" ([FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26). One frame as a PNG: `ffmpeg -y -f x11grab -video_size 1280x1024 -i :99 -frames:v 1 shot.png`. The `-frames` option means "Stop writing to the stream after framecount frames" ([ffmpeg manual](https://ffmpeg.org/ffmpeg.html), read 2026-11-26). ## Step 4: How do I let a person watch? Let a person watch by running a VNC server on the display and noVNC in front of it, both kept off public addresses. ``` mkdir -p ~/.vnc x11vnc -storepasswd "$VNC_PASSWORD" ~/.vnc/passwd x11vnc -display :99 -localhost -rfbport 5900 -rfbauth ~/.vnc/passwd -forever -shared & VNC_HOST=localhost websockify --web /usr/share/novnc 6080 "${VNC_HOST}:5900" & ``` `-localhost` restricts x11vnc to connections from the same machine, and websockify "translates WebSockets traffic to normal socket traffic" so a browser can reach it ([websockify](https://github.com/novnc/websockify), read 2026-11-26). The details, including view-only mode, are in [watching an agent desktop with VNC and noVNC](https://www.vmforai.com/issue/watch-an-agent-desktop-with-vnc-and-novnc/). ## What does a complete example look like? The example below puts the four steps in one container image. It is an example to adapt, not a hardened image. The package names are Debian's: the `novnc` package installs the web client under `/usr/share/novnc` ([novnc file list](https://packages.debian.org/bookworm/all/novnc/filelist), read 2026-11-26) and `python3-websockify` installs the `websockify` command ([python3-websockify file list](https://packages.debian.org/bookworm/all/python3-websockify/filelist), read 2026-11-26). The start script, `start-desktop.sh`: ``` #!/bin/bash set -euo pipefail export DISPLAY=:99 Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp & for _ in $(seq 1 50); do xdpyinfo >/dev/null 2>&1 && break; sleep 0.1; done openbox & mkdir -p ~/.vnc x11vnc -storepasswd "$VNC_PASSWORD" ~/.vnc/passwd x11vnc -display :99 -localhost -rfbport 5900 -rfbauth ~/.vnc/passwd -forever -shared & VNC_HOST=localhost websockify --web /usr/share/novnc 6080 "${VNC_HOST}:5900" & wait ``` The image: ``` FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ xvfb x11-utils openbox x11vnc novnc python3-websockify \ xdotool xclip ffmpeg \ && rm -rf /var/lib/apt/lists/* RUN useradd -m agent COPY --chown=agent start-desktop.sh /home/agent/start-desktop.sh USER agent WORKDIR /home/agent CMD ["/bin/bash", "/home/agent/start-desktop.sh"] ``` Run it with an init process, more shared memory than the default, and the viewer port published only on the host's loopback interface. Docker's `--init` will "Run an init inside the container that forwards signals and reaps processes", and Docker warns that it "publishes the port on all interfaces" by default, so put a host address in front of the port in `-p` ([docker container run](https://docs.docker.com/reference/cli/docker/container/run/), read 2026-11-26). `/dev/shm` is 64 MB when `--shm-size` is left out ([Docker run reference](https://docs.docker.com/engine/containers/run/), read 2026-11-26), which is small for a browser on the desktop. ``` docker run --rm --init --shm-size=1g \ -e VNC_PASSWORD="$(openssl rand -hex 12)" \ -p "${HOST_LOOPBACK}:6080:6080" \ agent-desktop ``` Set `HOST_LOOPBACK` to the host's loopback address, then open `/vnc.html` on port 6080 in a browser on that host. ## How do I check that the desktop is working? Check the desktop by asking each part for proof, not by watching the logs. 1. `xdpyinfo -display :99` prints the screen; the dimensions should match the `-screen` value. 2. `xdotool getmouselocation` prints the pointer's position and screen. 3. Take one screenshot with FFmpeg and open it: the window manager's desktop should be visible. 4. Open the noVNC page, connect with the password, and confirm that a click from xdotool shows up in the viewer. ## What we read for this article - [Xvfb manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26 - [Xserver manual](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26 - [xdpyinfo manual](https://manpages.debian.org/bookworm/x11-utils/xdpyinfo.1.en.html), read 2026-11-26 - [Openbox](https://openbox.org/), read 2026-11-26 - [xdotool manual](https://manpages.debian.org/bookworm/xdotool/xdotool.1.en.html), read 2026-11-26 - [FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26 - [ffmpeg manual](https://ffmpeg.org/ffmpeg.html), read 2026-11-26 - [websockify](https://github.com/novnc/websockify), read 2026-11-26 - [novnc file list, Debian bookworm](https://packages.debian.org/bookworm/all/novnc/filelist), read 2026-11-26 - [python3-websockify file list, Debian bookworm](https://packages.debian.org/bookworm/all/python3-websockify/filelist), read 2026-11-26 - [docker container run](https://docs.docker.com/reference/cli/docker/container/run/), read 2026-11-26 - [Docker run reference](https://docs.docker.com/engine/containers/run/), read 2026-11-26 ## FAQ ### Do I need a real graphics card to give an agent a Linux desktop? No. Xvfb is an X server that, in its manual's words, can run on machines with no display hardware and no physical input devices. It keeps the screen in memory, which is all a screenshot-based agent needs. ### Why does an agent desktop need a window manager? Xvfb provides the screen but does not decorate, place or focus windows. A light window manager such as Openbox gives windows title bars, focus and stacking, so dialogs and menus behave the way a model expects from screenshots of ordinary desktops. ### Is VNC needed for the agent to work? No. The agent reads screenshots and sends input directly on the display. VNC and noVNC are for people who want to watch a run or take over, so they can be left out of unattended runs. ### Which display number should I use? Any free one. xvfb-run uses 99 by default, which is a common choice for virtual displays; set DISPLAY to the same number for every program in the desktop. --- # How to build a resettable desktop VM environment for agents, the way OSWorld does URL: https://www.vmforai.com/issue/osworld-style-vm-environment-setup/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 An OSWorld-style environment is a desktop VM image with a small HTTP server inside, a named snapshot of the clean desktop, and a per-task setup config. The harness restores the snapshot, runs setup, lets the agent act, then a script checks the VM's final state. An OSWorld-style environment is a resettable desktop computer that a harness drives over the network: a virtual machine image, a control server inside it, a clean snapshot, and a task format that says how to set up the desktop and how to check the result. OSWorld's repository is the clearest public example of the pattern, and its design choices answer most of the questions you meet when building your own. This page is about building the environment, not about the benchmark's tasks or scores. ## What are the parts of a resettable desktop environment? A resettable desktop environment has five parts. Table: Parts of an OSWorld-style environment, with OSWorld's choices | Part | What it is | OSWorld's choice | |---|---|---| | VM image | A desktop OS with the task applications installed | An Ubuntu desktop image, plus optional Windows | | Control server | An HTTP service inside the VM that the harness calls | A Flask app started at boot as a system service | | Clean snapshot | The saved state every task starts from | Snapshot named `init_state` by default | | Task config | Setup steps for one task, and how to grade it | Download files, open files or tabs, change window size; then an evaluation function | | Harness | Code outside the VM that restores, sets up, loops and grades | `DesktopEnv`, with `reset()` and `step()` | Sources: [OSWorld repository](https://github.com/xlang-ai/OSWorld), [desktop_env.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/desktop_env.py), [server README](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/README.md) and the [OSWorld paper](https://arxiv.org/html/2404.07972), read 2026-11-26. ## Why put the desktop in a virtual machine? Put the desktop in a VM for safety, reset and scale. The paper says a "Virtual machine offers a safe isolated environment", "The snapshot feature also enables efficient reset of the virtual environment", and "Multiple virtual machines can run simultaneously on a single host machine, thereby parallelizing training and evaluation" (OSWorld paper, section 2.2, read 2026-11-26). For good speed, the host needs hardware virtualisation. The repository's check is `egrep -c '(vmx|svm)' /proc/cpuinfo`: "If the return value is greater than zero, the processor should be able to support" it (OSWorld repository, read 2026-11-26). ## What should the server inside the VM expose? The server inside the VM should expose everything the harness and the grader need, and nothing else. OSWorld's server is a useful checklist (server main.py, read 2026-11-26): Table: Control server endpoints in OSWorld's VM server (selection) | Need | Endpoint | |---|---| | Observe | `GET /screenshot` (PNG, with the cursor drawn), `GET /accessibility` (tree as XML), `POST /screen_size`, `GET /cursor_position` | | Act and set up | `POST /execute`, `POST /run_python`, `POST /run_bash_script`, `POST /setup/launch`, `POST /setup/open_file`, `POST /setup/activate_window`, `POST /setup/close_window` | | Files | `POST /setup/upload`, `POST /setup/download_file`, `POST /file`, `POST /list_directory` | | Record | `POST /start_recording`, `POST /end_recording` (FFmpeg) | Source: [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26. On Linux the server takes screenshots with `pyautogui.screenshot()` and pastes the cursor image on top; agents act through pyautogui, OSWorld's default action space. An endpoint that runs arbitrary commands is a full remote shell, so the server's port must be reachable only from the harness. OSWorld's defaults are port 5000 for the server, 9222 for the browser's debugging port, 8006 for VNC and 8080 for a media player (desktop_env.py, read 2026-11-26). ## How should the VM image be prepared? Prepare the image once, with every setting that would otherwise vary between runs fixed. OSWorld's server README lists its steps (read 2026-11-26): 1. Install the server files and their packages; the README lists `python3-tk`, `python3-dev`, `gnome-screenshot`, `wmctrl`, `ffmpeg`, `socat` and `xclip`, plus the Python requirements. 2. Install it as a system service that "automatically starts at boot time". 3. Set the screen: "The required screen resolution for the virtual machine is 1920x1080 in OSWorld." 4. Switch the session from Wayland to Xorg, and check with `echo $XDG_SESSION_TYPE`. 5. Turn on automatic login for the desktop user. 6. Set screen blank to never and automatic suspend to off. Then shut down and take the snapshot. Each of these steps removes a way for the same task to start differently: a lock screen, a sleeping display, a different screen size or an input tool that cannot reach a Wayland session. ## How does reset work between tasks? Reset works by reverting the VM to its named snapshot before each task. In OSWorld's harness, `DesktopEnv` takes `snapshot_name` (default `"init_state"`), and `reset()` reverts only "if environment has been used (step/setup)", an optimisation the code says is "especially important for cloud providers". The code also notes that setup "may mutate the guest before failing", so a failed setup must still trigger a restore before the next attempt (desktop_env.py, read 2026-11-26). The order for each task: 1. Restore the clean snapshot (or skip if the VM is still clean). 2. Run the task's setup: the paper describes downloading files or scripts, then running commands to "open files or tabs, change the window size, etc." (section 2.2.2). 3. Run the agent loop: screenshot, model, action, pause. OSWorld's `step` waits two seconds after each action by default (`pause=2`). 4. Post-process: the paper's task manager does "file saving, or reopening certain apps" before grading. 5. Grade with a script that reads the VM's final state through the server. ## How do I run many environments at once? Run many environments by giving each its own VM, server port and snapshot, and limiting how many run per host. OSWorld's parallel example runs its multi-environment script with `--num_envs 10` (OSWorld repository, read 2026-11-26). The constraint is the host's memory and processors: each VM needs the full memory of a desktop, and our [resource sizing page](https://www.vmforai.com/issue/desktop-agent-resource-sizing/) has the figures to start from. ## What goes wrong when building one, and how is it guarded against? Most of what goes wrong is a mismatch between the saved image and the harness code, and the guard is to save a clean state only after a check passes on it. Promigence is a worked example of that guard for its snapshots: you declare a container image, setup steps and a verify command, the snapshot is stored only if verification passes, and it is named by a hash of its contents, so a later run can start from exactly the same state (Promigence FAQ and quickstart, read 2026-11-26). The same check can run again as each task starts: `--verify-each` will "Re-run the snapshot's verify command in each sandbox before CMD runs", and the FAQ adds that a snapshot "is kept until you delete it" (Promigence CLI reference and FAQ, read 2026-11-26). Other hosted services decide in their own ways when a prepared state is saved, and how long it is kept (read 2026-11-26): - **AWS:** Amazon Bedrock AgentCore Runtime V2 "takes the snapshot when your agent's health check first passes", and if the health check does not pass in time, "the create or update fails with a health check error" (AgentCore Runtime documentation). - **Daytona:** a snapshot's base image "must include either a tag or a digest", with the `latest`, `lts` and `stable` tags not supported, and a snapshot whose creation or build fails is marked Error or Build Failed (Daytona snapshots documentation). - **E2B:** a template's ready command "is executed in an infinite loop until it returns a successful exit code 0", and only then is the snapshot created (E2B start and ready command documentation). - **Google Cloud:** a Pod snapshot for Agent Sandbox on GKE is taken by a manual trigger or when "the sandboxed application itself signals when it's ready to be saved", and GKE "restores a Pod only from a snapshot that's ready" (GKE Pod snapshots documentation). - **Modal:** a snapshot is taken when your code asks for one; filesystem snapshots are kept for 30 days by default unless you set another TTL, and memory snapshots, an experimental feature, expire 7 days after creation (Modal Sandbox snapshots guide). In a do-it-yourself desktop VM, the same check is a call to the in-VM server's version endpoint plus one screenshot with the pointer in it, run before the snapshot is taken. It catches these mismatches: - **A stale server in the image.** The OSWorld README warns that the published Ubuntu image "may contain an older guest server than this checkout" and that updating the host code "does not update the guest screenshot handler". Version the image and the harness together. - **A missing cursor.** A comment in the server notes that on virtual machines "the cursor is not captured", which is why it pastes the cursor image itself. Check a screenshot for the pointer before trusting the image. - **A dirty start.** Skipping the restore after a failed setup leaves half-done changes in the next task. ## What we read for this article - [OSWorld repository](https://github.com/xlang-ai/OSWorld), read 2026-11-26 - [OSWorld desktop_env.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/desktop_env.py), read 2026-11-26 - [OSWorld server README](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/README.md), read 2026-11-26 - [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26 - [OSWorld paper (arXiv 2404.07972)](https://arxiv.org/html/2404.07972), read 2026-11-26 - Promigence FAQ, [https://www.promigence.ai/faq](https://www.promigence.ai/faq), read 2026-11-26 - Promigence quickstart, [https://www.promigence.ai/docs/quickstart](https://www.promigence.ai/docs/quickstart), read 2026-11-26 - Promigence CLI reference, [https://www.promigence.ai/docs/cli](https://www.promigence.ai/docs/cli), read 2026-11-26 - [Amazon Bedrock AgentCore Runtime documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-how-it-works.html), read 2026-11-26 - [Daytona snapshots documentation](https://www.daytona.io/docs/en/snapshots), read 2026-11-26 - [E2B start and ready command documentation](https://docs.e2b.dev/template/start-ready-command), read 2026-11-26 - [GKE Pod snapshots documentation](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/agent-sandbox-pod-snapshots), read 2026-11-26 - [Modal Sandbox snapshots guide](https://modal.com/docs/guide/sandbox-snapshots), read 2026-11-26 ## FAQ ### What does the server inside the VM do? It is the harness's only way in. In OSWorld it returns screenshots, the accessibility tree and the screen size, runs commands and scripts, uploads and downloads files, opens and activates windows, and starts and stops screen recording, all over HTTP. ### How is the VM reset between tasks? By reverting to a named snapshot of the clean desktop. OSWorld's default snapshot is called init_state, and its reset skips the revert when the environment has not been used since the last one. ### Why use a VM instead of a container for a desktop agent? A VM can run any desktop operating system, including Windows, and gives a full machine to break and restore. The OSWorld paper names safety, reset by snapshot and running several VMs on one host as its reasons. ### What screen settings does the OSWorld image use? Its server README says the required resolution is 1920x1080, the session must use Xorg rather than Wayland, the user logs in automatically, and screen blanking and automatic suspend are turned off. --- # How to record an agent's desktop session with FFmpeg URL: https://www.vmforai.com/issue/record-an-agent-desktop-session/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 Record an agent's Linux desktop with FFmpeg's x11grab device at a low, fixed frame rate, encode with x264 at a fast preset, and save the screenshot and action of every step beside the video. The video shows what happened between steps; the per-step log shows exactly what the model saw. Recording an agent's desktop session means capturing the screen to a video file for the whole task, alongside a log of every screenshot and action. FFmpeg can do the capture on any X display, including Xvfb, with one command. ## How do I record an X display with FFmpeg? Record an X display with the x11grab input device, which "allows one to capture a region of an X11 display" ([FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26): ``` ffmpeg -y -f x11grab -framerate 5 -video_size 1920x1080 -i :99 \ -c:v libx264 -preset veryfast -pix_fmt yuv420p session.mp4 ``` The input is the display name (here Xvfb's `:99`). FFmpeg's own example is `ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg`, and adding `+X,Y` after the display, as in `:0.0+10,20`, captures a region starting at that offset. `-y` will "Overwrite output files without asking" ([ffmpeg manual](https://ffmpeg.org/ffmpeg.html), read 2026-11-26). ## Which x11grab options matter for agent recordings? Four options decide what the recording shows (FFmpeg devices, read 2026-11-26): Table: x11grab options for agent recordings | Option | Documented default | Setting for agents | |---|---|---| | `framerate` | `ntsc`, "corresponding to a frame rate of 30000/1001" | Set low and fixed, for example 2 to 5 | | `video_size` | "the full desktop or window" | Set to the screen size, so every file is the same shape | | `draw_mouse` | `1` (the pointer is drawn) | Keep it: misclicks are easier to see | | `window_id` | `0`, the whole screen (root window) | Keep the whole screen; dialogs open outside the app window | `follow_mouse` and `show_region` are for people recording a part of a large screen; agent desktops are usually recorded whole. ## How do I choose the encoder settings? Choose a fast x264 preset so the encoder keeps up without taking processor time from the agent. x264 is "free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format" ([x264](https://www.videolan.org/developers/x264.html), read 2026-11-26). Its presets, from fastest to slowest, are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow and placebo, and its tunings include `stillimage` and `zerolatency` ([x264.h](https://raw.githubusercontent.com/mirror/x264/master/x264.h), read 2026-11-26). In FFmpeg, libx264's `crf` option sets "the quality for constant quality mode" ([FFmpeg codecs](https://ffmpeg.org/ffmpeg-codecs.html), read 2026-11-26). Desktop video is mostly still, with small changes, so a low frame rate and a constant-quality setting keep files small. Measure the size on your own tasks: it depends on how much of the screen changes. ## How do I start and stop the recording from a harness? Start the recording before the task's first step and stop it after the last, so the file covers setup, the agent's work and the final state the grader reads. 1. Start FFmpeg in the background with its own process group, and keep its process ID. 2. Run the task. 3. Stop FFmpeg with SIGINT (the same as pressing Ctrl+C), or give it a duration with `-t`, so it writes the end of the file. 4. Check the file plays and has the expected length before the desktop is reset. OSWorld's in-VM server follows this pattern: it has `/start_recording` and `/end_recording` endpoints that run an FFmpeg recording and return the video file ([OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26). ## What should I save besides the video? Save the per-step record, because the video does not show what the model was given. 1. **The screenshot sent to the model**, at the size it was sent, for every step. 2. **The action** the model returned, and the scaled coordinates actually sent to the screen. 3. **Timestamps** for both, so a step can be found in the video. 4. **The screen settings**: size, depth and scaling, as described in [screen resolution and DPI for computer-use agents](https://www.vmforai.com/issue/screen-resolution-and-dpi-for-computer-use-agents/). Screenshots can contain whatever the agent opened, including personal data and secrets typed into forms. Store recordings with the same access rules as the data the tasks use, and delete them on a schedule. ## How do I take a single screenshot with FFmpeg? Take a single frame by stopping after one: `-frames:v 1`, where `-frames` means "Stop writing to the stream after framecount frames" (ffmpeg manual). ``` ffmpeg -y -f x11grab -video_size 1920x1080 -i :99 -frames:v 1 step-001.png ``` ## What we read for this article - [FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26 - [ffmpeg manual](https://ffmpeg.org/ffmpeg.html), read 2026-11-26 - [FFmpeg codecs](https://ffmpeg.org/ffmpeg-codecs.html), read 2026-11-26 - [x264](https://www.videolan.org/developers/x264.html), read 2026-11-26 - [x264.h, mirror of the x264 source](https://raw.githubusercontent.com/mirror/x264/master/x264.h), read 2026-11-26 - [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26 ## FAQ ### What frame rate should I record an agent desktop at? Lower than for a person. x11grab's default is ntsc, which is 30000/1001 frames a second; agents act every few seconds, so a few frames a second usually shows every change. Set -framerate explicitly so every recording uses the same rate. ### Does x11grab record the mouse pointer? Yes by default. FFmpeg's draw_mouse option defaults to 1; set it to 0 to leave the pointer out. Keep it in for agent recordings, because where the pointer was is often the question. ### How do I stop an FFmpeg recording cleanly? Send it SIGINT, the signal Ctrl+C sends, or give it a duration with -t, so it finishes writing the file. Check that the file plays before the desktop is reset. ### Is a screen recording enough to debug an agent? No. The model acted on the screenshots it was sent, possibly resized, at the moment of each step. Save those images and the actions with timestamps; use the video for what happened between them. --- # Screen resolution, scaling and DPI for screenshot-based computer-use agents URL: https://www.vmforai.com/issue/screen-resolution-and-dpi-for-computer-use-agents/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 Pick one screen size per environment, set it on the virtual display and keep it fixed. If screenshots are resized before the model sees them, scale every coordinate back to the real screen. Keep scaling at 100 percent (96 DPI) unless the task needs otherwise. Screen resolution is the size of the screen in pixels, and for a computer-use agent it sets two things at once: how much detail the model gets in each screenshot, and the coordinate system of every click it sends back. DPI, the dots per inch the system reports, decides how large applications draw text and controls inside that screen. Getting either one wrong shows up as an agent that reads the screen correctly and still clicks the wrong spot. ## Why does screen resolution matter for a screenshot-based agent? Screen resolution matters because the model reads the screen as an image and answers with pixel coordinates in that image. A bigger screen gives more detail but a bigger image to process; a smaller screen gives less detail and less room for windows. Research results point both ways, which is why you should measure on your own tasks. The OSWorld authors set "The raw resolution of the screen" to 1920x1080 and tested downsampling it. For screenshot-only input they found that "an increase in resolution directly correlates with enhanced performance". With set-of-mark input, a reduction "to 768×432 (down-sampling ratio of 0.4) leads to an improvement", while a 0.2 ratio "results in a noticeable decline in performance" ([OSWorld paper, sections 4.1 and 5.2](https://arxiv.org/html/2404.07972), read 2026-11-26). ## How do I scale coordinates when screenshots are resized? Scale coordinates by the ratio between the real screen and the image the model saw. If a 1920x1080 screen is sent to the model as a smaller image, a click the model places in that image has to be multiplied back up before it is sent to the display. Worked example (an example, not a recommendation): the screen is 1920x1080 and the harness resizes each screenshot to 1280x720 before sending it. Table: Example coordinate scaling from a resized screenshot | | Width | Height | |---|---|---| | Real screen | 1920 | 1080 | | Image the model saw | 1280 | 720 | | Scale factor (real / image) | 1.5 | 1.5 | | Model's click in the image | 400 | 300 | | Click sent to the screen | 600 | 450 | Three rules prevent most misclicks: 1. **Keep the aspect ratio.** Resize width and height by the same factor, or padding and stretching will shift every point. 2. **Scale in one place.** Do the conversion in the harness, next to the code that sends input, never partly in the prompt. 3. **Round once, at the end.** Convert to whole pixels only after scaling, and clamp to the screen edges. ## How do I set the screen size on a Linux agent desktop? Set the screen size when the virtual display starts, and do not let anything change it during a run. On Xvfb the `-screen` option "creates screen screennum and sets its width, height, and depth" ([Xvfb manual](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26): ``` Xvfb :99 -screen 0 1920x1080x24 -dpi 96 -nolisten tcp & ``` xrandr "is used to set the size, orientation and/or reflection of the outputs for a screen", and `xrandr --query` "will display the current state of the system" ([xrandr manual](https://manpages.debian.org/bookworm/x11-xserver-utils/xrandr.1.en.html), read 2026-11-26). Use the query in your start-up checks. Avoid changing the size in the middle of a run: VNC viewers with remote resizing, or a task that opens display settings, can do it by accident. ## What does DPI change on an agent desktop? DPI changes how many pixels applications use for text and controls. The same dialog at a higher DPI is larger in pixels, so less of the screen fits in one screenshot, and small text becomes easier to read. - **On Linux (X11)**, the X server's `-dpi` option "sets the resolution for all screens, in dots per inch" ([Xserver manual](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26). Toolkits and desktop settings can apply their own scaling on top, so check a screenshot rather than trusting the number. - **On Windows**, 96 DPI is the 100 percent baseline. Microsoft's guide says applications that are not DPI-aware "render at a fixed DPI value of 96 (100%)" and on a screen above 96 DPI "Windows will stretch the application bitmap", which "results in the application appearing blurry" ([High DPI desktop application development on Windows](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows), read 2026-11-26). Blurry, stretched controls are harder for a model to read, which is a reason to keep Windows agent desktops at 100 percent scaling unless the task is about scaling. ## Why can coordinates differ between the screenshot and the input tool on Windows? Coordinates can differ because Windows may report sizes to an application in scaled units. Microsoft's guide warns that "if a DPI-unaware thread queries the screen size while running on a high-DPI display, Windows will virtualize the answer given to the application as if the screen were in 96 DPI units" (High DPI guide, read 2026-11-26). If the screenshot tool and the input tool run with different DPI awareness, they can disagree about where a point is. At 100 percent scaling both see the same numbers. ## What should I record about the screen for every run? Record the screen settings with every run so results can be repeated and misclicks can be explained: 1. The real screen width, height and depth. 2. The size of the image sent to the model, and the scale factor. 3. The DPI or scaling setting of the desktop. 4. Whether the pointer is drawn in screenshots. These four values belong in the run log next to the model name and the step limit. ## What we read for this article - [OSWorld paper (arXiv 2404.07972)](https://arxiv.org/html/2404.07972), read 2026-11-26 - [Xvfb manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26 - [Xserver manual](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26 - [xrandr manual, Debian bookworm](https://manpages.debian.org/bookworm/x11-xserver-utils/xrandr.1.en.html), read 2026-11-26 - [High DPI desktop application development on Windows](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows), read 2026-11-26 ## FAQ ### What screen resolution should a computer-use agent use? There is no single right answer, but it must be fixed and recorded. OSWorld, a widely used desktop benchmark, sets the raw screen to 1920x1080. Smaller screens give the model fewer pixels to read; larger ones may be downscaled by the agent framework anyway. ### Why does my agent click in the wrong place? Most often because the screenshot the model saw was resized and the coordinates were not scaled back, or because the screen size changed between the screenshot and the click. Log the screenshot size and the screen size with every action. ### Does a lower screenshot resolution hurt agents? Often. The OSWorld authors found that for screenshot-only input, higher resolution went with better performance. With their set-of-mark input, a 0.4 downsampling ratio helped and 0.2 hurt, so test on your own tasks. ### What DPI should an agent desktop use? 96 DPI, the Windows 100 percent baseline, is the safe default. Higher DPI makes text and controls larger in pixels, so fewer fit on screen, and applications that are not DPI-aware may be stretched and look blurry. --- # How to watch an agent's desktop in a browser with x11vnc and noVNC URL: https://www.vmforai.com/issue/watch-an-agent-desktop-with-vnc-and-novnc/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 To watch an agent's desktop in a browser, run x11vnc on its display with a password and -localhost, put websockify and noVNC in front, and reach the page only over a private, authenticated path. Use x11vnc's -viewonly when people should watch but not touch. Watching an agent's desktop in a browser takes three programs: a VNC server attached to the agent's display, websockify to turn the VNC connection into a WebSocket, and noVNC as the client page. The agent does not need any of them. They are for the people who debug runs, approve risky steps or take over when the agent gets stuck. ## How do the pieces fit together? The VNC server reads the X display, websockify relays its traffic to the browser, and noVNC draws it. Table: The viewing chain for an agent desktop | Piece | Role | Default port | |---|---|---| | x11vnc | Serves an existing X display (for example Xvfb's :99) over VNC | 5900, "the default VNC server port" | | websockify | "translates WebSockets traffic to normal socket traffic" and can serve the web files | Set on the command line; 6080 in noVNC's launcher | | noVNC | The VNC client that runs in the browser | Served by websockify | Sources: [x11vnc manual](https://manpages.debian.org/bookworm/x11vnc/x11vnc.1.en.html), [websockify](https://github.com/novnc/websockify) and [noVNC's novnc_proxy script](https://raw.githubusercontent.com/novnc/noVNC/master/utils/novnc_proxy), read 2026-11-26. noVNC "follows the standard VNC protocol, but unlike other VNC clients it does require WebSockets support". Some servers speak WebSockets themselves; for the rest, the project points to websockify ([noVNC repository](https://github.com/novnc/noVNC), read 2026-11-26). ## Step 1: How do I start x11vnc safely? Start x11vnc with a stored password, bound to the local machine, and kept running between viewers. ``` mkdir -p ~/.vnc x11vnc -storepasswd "$VNC_PASSWORD" ~/.vnc/passwd x11vnc -display :99 -rfbauth ~/.vnc/passwd -localhost -rfbport 5900 -forever -shared ``` What each option does, from the x11vnc manual (read 2026-11-26): - `-storepasswd pass file`: "Store password pass as the VNC password in the file file. Once the password is stored the program exits." - `-localhost`: "Basically the same as" allowing only the loopback address, so remote machines cannot connect directly. - `-forever`: "Keep listening for more connections rather than exiting as soon as the first client(s) disconnect." - `-shared`: "more than one viewer can connect at the same time (default off)." The manual says "use of a VNC password (-rfbauth or -passwdfile) is strongly recommended", and also that the `-rfbauth` file "is NOT encrypted, only obscured with a fixed key". Generate a new random password per desktop and keep the file readable only by its owner. ## Step 2: How do I put noVNC in front of it? Put noVNC in front by running websockify with noVNC's web files and the VNC server as its target. ``` VNC_HOST=localhost websockify --web /usr/share/novnc 6080 "${VNC_HOST}:5900" ``` `--web DIR` makes websockify serve a directory "on the same port as the proxy" (websockify, read 2026-11-26). The path above is where Debian's `novnc` package installs `vnc.html` ([novnc file list](https://packages.debian.org/bookworm/all/novnc/filelist), read 2026-11-26). noVNC's own launcher does the same job. Its defaults are port 6080, described as "Default: 6080 (on all interfaces)", and a VNC target on port 5900 of the same machine. The README shows how to keep the web server private by giving `--listen` a loopback address (noVNC repository and novnc_proxy script, read 2026-11-26). ## Step 3: How do I keep the viewer off the internet? Keep the viewer off the internet by binding it to a private address and reaching it through something that authenticates. 1. **Bind privately.** Give websockify or `--listen` a loopback or private address. In a container, Docker "publishes the port on all interfaces" unless `-p` names a host address ([docker container run](https://docs.docker.com/reference/cli/docker/container/run/), read 2026-11-26). 2. **Encrypt.** websockify accepts `--cert`, `--key` and `--ssl-only`, and the launcher's `--ssl-only` will "Disable non-https connections" (websockify and novnc_proxy, read 2026-11-26). 3. **Authenticate in front.** websockify "can demand authentication for websocket connections" through `--auth-plugin`, and a token plugin lets one websockify reach many desktops by a `token` parameter. A reverse proxy with your own sign-in does the same job. 4. **Expire it.** The launcher's `--idle-timeout` makes the server exit "after SEC seconds if there are no" active connections. ## How do I make it watch-only? Make the viewer watch-only on the server with x11vnc's `-viewonly`, where "All VNC clients can only watch (default off)" (x11vnc manual). noVNC also has a `view_only` setting, "If the remote session should be in non-interactive mode" ([noVNC embedding settings](https://novnc.com/noVNC/docs/EMBEDDING.html), read 2026-11-26), but a client-side setting can be changed by whoever opens the page. Use the server option for observers and a separate full-access password for the person allowed to take over; x11vnc's `-viewpasswd` provides that split. ## Which noVNC settings help when watching an agent? These noVNC settings, passed in the page URL, make a viewer easier to use (noVNC embedding settings, read 2026-11-26): Table: noVNC settings for watching an agent | Setting | What it does | |---|---| | `autoconnect` | "Automatically connect as soon as the page has finished loading." | | `reconnect` | Reconnects if the connection drops, useful when a desktop restarts between tasks | | `view_only` | "non-interactive mode" in the client | | `resize` | `off`, `scale` or `remote`; use `scale` so the viewer never changes the agent's screen size | | `quality`, `compression` | JPEG quality and compression level, 0 to 9 | | `password` | The VNC password; the page notes the fragment form (after `#`) "is not sent to the server" | Avoid `resize=remote` on agent desktops: it asks the server to change the screen size to fit the browser window, and the agent's coordinates depend on that size. See [screen resolution and DPI for computer-use agents](https://www.vmforai.com/issue/screen-resolution-and-dpi-for-computer-use-agents/). ## What we read for this article - [x11vnc manual, Debian bookworm](https://manpages.debian.org/bookworm/x11vnc/x11vnc.1.en.html), read 2026-11-26 - [noVNC repository](https://github.com/novnc/noVNC), read 2026-11-26 - [noVNC novnc_proxy script](https://raw.githubusercontent.com/novnc/noVNC/master/utils/novnc_proxy), read 2026-11-26 - [noVNC embedding settings](https://novnc.com/noVNC/docs/EMBEDDING.html), read 2026-11-26 - [websockify](https://github.com/novnc/websockify), read 2026-11-26 - [novnc file list, Debian bookworm](https://packages.debian.org/bookworm/all/novnc/filelist), read 2026-11-26 - [docker container run](https://docs.docker.com/reference/cli/docker/container/run/), read 2026-11-26 ## FAQ ### What is noVNC? noVNC is, in its project's words, both an HTML VNC client JavaScript library and an application built on top of that library. It runs in the browser and needs a WebSockets connection, which websockify provides for VNC servers that do not speak WebSockets. ### What port does noVNC use? The novnc_proxy launch script listens on 6080 by default, on all interfaces, and proxies to a VNC server on port 5900 of the same machine. Change both with --listen and --vnc. ### How do I make the viewer watch-only? Start x11vnc with -viewonly, so all VNC clients can only watch, or open noVNC with the view_only setting. The server-side option is stronger, because it does not depend on the client. ### Is the x11vnc password file encrypted? No. The x11vnc manual says the -rfbauth file is not encrypted, only obscured with a fixed key. Protect it with file permissions and keep the VNC port off the network. --- # How to prepare a Windows VM for a computer-use agent URL: https://www.vmforai.com/issue/windows-vm-for-an-ai-agent/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 A Windows VM for an agent needs a licensed Windows edition, at least the documented VM minimums (for Windows 11: 2 virtual processors, 4 GB memory, 64 GB disk, Secure Boot and a virtual TPM), a fixed screen at 100 percent scaling, an input and screenshot channel, and a clean snapshot per task. A Windows VM for a computer-use agent is an ordinary Windows installation prepared for three extra jobs: being driven by software instead of a person, being watched, and being put back exactly as it was after each task. Windows has more setup steps than a Linux desktop (licensing, first-run screens, scaling), and each one can break an agent run if it is left to chance. ## What hardware does a Windows agent VM need? A Windows 11 VM needs at least the minimums Microsoft lists for virtual machines. Table: Windows 11 virtual machine requirements, as listed by Microsoft | Setting | Requirement | |---|---| | Generation | 2 (generation 1 VMs cannot be upgraded in place) | | Storage | 64 GB or greater | | Memory | 4 GB or greater | | Processor | Two or more virtual processors, on a host processor that meets the Windows 11 processor requirements | | Security | Secure Boot capable, virtual TPM enabled | | Display (physical devices) | High definition (720p), 8 bits per colour channel | Source: [Windows 11 requirements](https://learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements), read 2026-11-26. These are minimums for Windows itself. An agent's applications, a browser and screen capture come on top, so size above them; our [resource sizing page](https://www.vmforai.com/issue/desktop-agent-resource-sizing/) collects the figures. ## Which Windows licence can an agent VM use? Use an edition and licence that cover how you run it; for short trials, Microsoft offers an evaluation. The Windows 11 Enterprise evaluation is "full-featured software for a 90-day evaluation", delivered as ISO files after registration, and the page says that once it expires "the PC will shut down every hour" ([Windows 11 Enterprise evaluation](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-11-enterprise), read 2026-11-26). The page also says you must sign in to the PC with a Microsoft account. For agents this has two practical effects: an evaluation snapshot has a fixed life, and an hourly shutdown in the middle of a task looks like an agent failure. Note the evaluation's start date in the image's metadata and rebuild before it runs out. Benchmarks hit the same constraint. OSWorld's Windows tasks "could only be used after activation due to copyright restrictions" ([OSWorld project site](https://osworld-v1.xlang.ai/), read 2026-11-26). ## How do I build a reusable Windows image? Build one reference installation, generalize it with Sysprep, and create every agent VM from that image. 1. Install Windows in the reference VM and boot into Audit Mode. 2. Install the agent's applications and your input and screenshot service. Microsoft warns not to install or update Microsoft Store apps before generalizing, because "Installing new Microsoft Store apps or updating your existing Microsoft Store apps before generalizing a Windows image will cause Sysprep to fail." 3. Generalize and shut down: `%WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe`. Generalizing "removes computer-specific information such as installed drivers and the computer security identifier (SID)." 4. If the image will run as a virtual disk on the same virtualisation platform, add `/mode:vm`, as Microsoft's note on that command describes. Source for all four steps: [Sysprep (Generalize) a Windows installation](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation), read 2026-11-26. The same page says Sysprep can run "up to 1001 times on a single Windows image" on Windows 8.1 and later, after which the image must be recreated. Microsoft's page also describes running Sysprep with an unattend answer file, which lets you script the settings a clone applies instead of clicking through them by hand. ## How should the screen be set? Set a fixed resolution and 100 percent display scaling. At 100 percent, Windows uses 96 DPI, and Microsoft's guide explains that applications that are not DPI-aware are otherwise bitmap-stretched and appear "blurry" ([High DPI desktop application development on Windows](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows), read 2026-11-26). Blur makes small text harder for a model to read, and mixed DPI awareness can make a screenshot tool and an input tool disagree about coordinates. More on this in [screen resolution and DPI for computer-use agents](https://www.vmforai.com/issue/screen-resolution-and-dpi-for-computer-use-agents/). ## How does the agent see the screen and send input? The agent needs a small service inside the VM, or a remote desktop session, that returns screenshots and accepts input. - **A service inside the VM.** OSWorld's in-VM server is a model: on Windows it takes screenshots with `ImageGrab.grab()` and draws the cursor with Windows calls ([OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26). Input can come from pyautogui, which "works on Windows, macOS, and Linux" ([PyAutoGUI documentation](https://pyautogui.readthedocs.io/en/latest/), read 2026-11-26). - **Remote Desktop.** Remote Desktop listens on port 3389 by default ([Change the Remote Desktop listening port](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/change-listening-port), read 2026-11-26). Microsoft notes that Professional, Enterprise, Education and Server editions "can act as hosts", and "Windows Home editions can't serve as Remote Desktop hosts" ([Enable Remote Desktop](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/remotepc/remote-desktop-allow-access), read 2026-11-26). From Linux, the open-source FreeRDP client sets the size with `/size` (default 1024x768) and can redirect the clipboard and a folder with `/clipboard` and `/drive` ([xfreerdp manual](https://manpages.debian.org/bookworm/freerdp2-x11/xfreerdp.1.en.html), read 2026-11-26). Microsoft's Remote Desktop page warns that enabling it "opens a port on your PC" and recommends Network Level Authentication. Keep port 3389 reachable only from the harness's network, never from the internet. ## How do I reset the VM between tasks? Reset the VM by restoring a snapshot taken at the clean, signed-in desktop. This is the same method OSWorld describes: "The snapshot feature also enables efficient reset of the virtual environment" ([OSWorld paper, section 2.2](https://arxiv.org/html/2404.07972), read 2026-11-26). The steps: 1. Boot a fresh clone, sign in, wait for start-up tasks and updates to finish. 2. Check the screen size, scaling and the input service. 3. Shut down cleanly or pause, and take the snapshot. 4. Restore it before every task, and never reuse a VM that ran a task without restoring. Turn off automatic updates during runs, or apply them only when you rebuild the snapshot, so two runs of the same task start from the same Windows build. ## What we read for this article - [Windows 11 requirements](https://learn.microsoft.com/en-us/windows/whats-new/windows-11-requirements), read 2026-11-26 - [Windows 11 Enterprise evaluation](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-11-enterprise), read 2026-11-26 - [Sysprep (Generalize) a Windows installation](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/sysprep--generalize--a-windows-installation), read 2026-11-26 - [High DPI desktop application development on Windows](https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows), read 2026-11-26 - [Enable Remote Desktop on your PC](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/remotepc/remote-desktop-allow-access), read 2026-11-26 - [Change the Remote Desktop listening port](https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/change-listening-port), read 2026-11-26 - [xfreerdp manual, Debian bookworm](https://manpages.debian.org/bookworm/freerdp2-x11/xfreerdp.1.en.html), read 2026-11-26 - [PyAutoGUI documentation](https://pyautogui.readthedocs.io/en/latest/), read 2026-11-26 - [OSWorld server main.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/main.py), read 2026-11-26 - [OSWorld paper (arXiv 2404.07972)](https://arxiv.org/html/2404.07972), read 2026-11-26 - [OSWorld project site](https://osworld-v1.xlang.ai/), read 2026-11-26 ## FAQ ### What are the minimum VM settings for Windows 11? Microsoft lists generation 2, 64 GB or more of disk, 4 GB or more of memory, two or more virtual processors, and Secure Boot with a virtual TPM enabled. A host processor that meets the Windows 11 processor requirements is also needed. ### Can I use the Windows evaluation edition for agent testing? Microsoft offers a 90-day evaluation of Windows 11 Enterprise as ISO files, aimed at IT professionals trying it for their organisation. After it expires, the page says the PC shuts down every hour, so evaluation images need rebuilding before day 90 and are no substitute for a licence in long-running use. ### Which Windows editions can accept Remote Desktop connections? Professional, Enterprise, Education and Windows Server editions can host Remote Desktop. Microsoft says Windows Home editions can't serve as Remote Desktop hosts. ### Should I run Sysprep before cloning an agent VM? Yes, when you deploy one image to many VMs. Generalizing removes computer-specific information such as the security identifier (SID). Windows 8.1 and later allow up to 1001 Sysprep runs on one image. --- # Mouse and keyboard input for desktop agents: xdotool, pyautogui and ydotool URL: https://www.vmforai.com/issue/xdotool-mouse-and-keyboard-input-for-agents/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 On an X11 desktop, send an agent's actions with xdotool (mousemove, click, type, key) or pyautogui from Python; both inject events through the X server. On Wayland, use a tool below the display server such as ydotool. Wait for the screen to settle before the next screenshot. An agent's actions reach the desktop through an input tool that turns "click at (612, 344)" into real pointer and keyboard events. On an X11 desktop, xdotool from the shell and pyautogui from Python are the usual choices. The tool matters less than three habits: one command per action, the right coordinate space, and a pause before the next screenshot. ## How do I send a click and a key press with xdotool? Send a click with `mousemove` then `click`, and keys with `type` for text and `key` for shortcuts. These commands assume `DISPLAY` points at the agent's display: ``` export DISPLAY=:99 xdotool mousemove --sync 612 344 click 1 # move, wait until moved, left click xdotool click --repeat 2 1 # double click xdotool type --delay 30 'quarterly report' # type text, 30 ms between keys xdotool key ctrl+s # keyboard shortcut xdotool key Return ``` From the xdotool manual (read 2026-11-26): Table: xdotool commands an agent harness uses | Command | What the manual says | Agent note | |---|---|---| | `mousemove X Y` | "Move the mouse to the specific X and Y coordinates on the screen." | Add `--sync` to "wait until the mouse is actually moved" | | `click BUTTON` | "Left mouse is 1, middle is 2, right is 3, wheel up is 4, wheel down is 5." | `--repeat 2` for a double click | | `mousedown` / `mouseup` | Only a press or only a release | Build drags: mousedown, mousemove, mouseup | | `type TEXT` | "Delay between keystrokes. Default is 12ms." | Raise `--delay` if characters go missing | | `key KEYS` | Same 12 ms default delay | Use for shortcuts such as `ctrl+s` | | `getmouselocation` | "Outputs the x, y, screen, and window id of the mouse cursor." | Log it after each action | | `search` / `windowactivate` | Find windows by name or class, then activate | Useful in setup scripts, not as agent actions | Source: [xdotool manual, Debian bookworm](https://manpages.debian.org/bookworm/xdotool/xdotool.1.en.html), read 2026-11-26. The manual explains how it works: "It does this using X11's XTEST extension and other Xlib functions", and warns "If your X server does not support XTEST, then some typing and mouse movement features may not work." Check for XTEST in your desktop's start-up test. ## How do I map model actions to input commands? Map each kind of model action to one input call, and keep the table in your harness, not in the prompt. Table: Example mapping from agent actions to xdotool (an example) | Model action | xdotool command | |---|---| | click(x, y) | `xdotool mousemove --sync x y click 1` | | double_click(x, y) | `xdotool mousemove --sync x y click --repeat 2 1` | | right_click(x, y) | `xdotool mousemove --sync x y click 3` | | drag(x1, y1, x2, y2) | `xdotool mousemove --sync x1 y1 mousedown 1 mousemove --sync x2 y2 mouseup 1` | | scroll_down(n) | `xdotool click --repeat n 5` | | type(text) | `xdotool type --delay 30 "text"` | | key(combo) | `xdotool key combo` | Before sending, convert the model's coordinates from the screenshot it saw to the real screen, as described in [screen resolution and DPI for computer-use agents](https://www.vmforai.com/issue/screen-resolution-and-dpi-for-computer-use-agents/). Pass text as a separate argument, never through a shell string the model wrote, so a model cannot inject shell commands through "text". ## When should I use pyautogui instead? Use pyautogui when the harness is in Python or must also run on Windows or macOS. Its documentation says "PyAutoGUI lets your Python scripts control the mouse and keyboard to automate interactions with other applications" and that it "works on Windows, macOS, and Linux" ([PyAutoGUI documentation](https://pyautogui.readthedocs.io/en/latest/), read 2026-11-26). It is also the action language of OSWorld, whose actions are Python calls to pyautogui ([OSWorld paper, section 2.4](https://arxiv.org/html/2404.07972), read 2026-11-26). Two defaults change agent behaviour (PyAutoGUI documentation): - **Fail-safe.** If the mouse is "in any of the four corners of the primary monitor" when a function is called, pyautogui raises `pyautogui.FailSafeException`. The project strongly advises against turning it off; if an agent must work near corners, handle the exception in the harness. - **Pause.** Every call is followed by a delay "set by the `pyautogui.PAUSE` setting, which is `0.1` by default." pyautogui works only with the primary monitor, so give agent desktops a single screen. ## What about Wayland desktops? On a Wayland session, use a tool that works below the display server, because xdotool reaches only the X server. ydotool "uses the kernel's uinput framework to emulate an input device" and is "not limited to Wayland". Since version 1.0.0 its background daemon `ydotoold` must be running, and it needs access to `/dev/uinput`, "which usually requires root privileges" ([ydotool repository](https://github.com/ReimuNotMoe/ydotool), read 2026-11-26). Its moves are relative unless asked otherwise: `ydotool mousemove --absolute -x 100 -y 100` moves to a screen position. Its `key` command takes raw key codes, not names. For most agent desktops, the simpler path is an X11 session, which is also what OSWorld's in-VM server setup asks for: it says to switch from Wayland to Xorg ([OSWorld server README](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/README.md), read 2026-11-26). ## How long should the harness wait after an action? Wait until the screen has settled, not a fixed time you hope is enough. Applications animate, load and redraw after a click; a screenshot taken too early shows the old state and the model repeats the action. OSWorld's environment waits about two seconds after each action before it takes the observation: its `step` function has `pause=2` and calls `time.sleep(pause)` ([OSWorld desktop_env.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/desktop_env.py), read 2026-11-26). A tighter approach is to take screenshots in a short loop and continue when two in a row are the same, with a time limit. ## What we read for this article - [xdotool manual, Debian bookworm](https://manpages.debian.org/bookworm/xdotool/xdotool.1.en.html), read 2026-11-26 - [PyAutoGUI documentation](https://pyautogui.readthedocs.io/en/latest/), read 2026-11-26 - [ydotool repository](https://github.com/ReimuNotMoe/ydotool), read 2026-11-26 - [OSWorld paper (arXiv 2404.07972)](https://arxiv.org/html/2404.07972), read 2026-11-26 - [OSWorld server README](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/server/README.md), read 2026-11-26 - [OSWorld desktop_env.py](https://github.com/xlang-ai/OSWorld/blob/main/desktop_env/desktop_env.py), read 2026-11-26 ## FAQ ### How does xdotool send input? Its manual says it uses X11's XTEST extension and other Xlib functions. If the X server does not support XTEST, some typing and mouse movement features may not work, so check for the extension when the desktop starts. ### How fast does xdotool type? The default delay between keystrokes is 12 milliseconds for both type and key. Raise it with --delay if an application drops characters. ### Does xdotool work on Wayland? xdotool talks to the X server, so on a Wayland session it reaches only X applications. ydotool works through the kernel's uinput framework instead, and is not limited to Wayland. ### Why does pyautogui raise FailSafeException? Its fail-safe is on by default. If the mouse is in any of the four corners of the primary monitor when a pyautogui function is called, it raises pyautogui.FailSafeException. Agents that click near corners need to know this. --- # Xvfb for agent desktops: the options that matter and the defaults that surprise URL: https://www.vmforai.com/issue/xvfb-virtual-display-setup/ Author: VMForAI editors Published: 2026-11-26 Updated: 2026-11-26 Start Xvfb with an explicit screen, for example Xvfb :99 -screen 0 1280x1024x24 -nolisten tcp, rather than relying on defaults. Its documented default depth differs between versions (8 in older manuals, 24 in the X.Org 21.1 manual), and xvfb-run adds its own defaults on top. Xvfb is the X Window System's virtual framebuffer server: an X server that draws into memory instead of onto a monitor. For a computer-use agent it is the screen. Getting its few options right decides what the model sees and who else can see it. ## What is Xvfb? Xvfb is "an X server that can run on machines with no display hardware and no physical input devices", and it "emulates a dumb framebuffer using virtual memory" ([Xvfb manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26). The manual says it was meant for server testing, and lists other uses, including "providing an unobtrusive way to run applications that don't really need an X server but insist on having one anyway". A desktop agent is a heavier use: it runs ordinary graphical applications on the virtual screen and reads the pixels back. ## Which Xvfb options matter for an agent? Five options cover almost every agent desktop. The first two are Xvfb's own; the rest are options every X server accepts. Table: Xvfb and X server options for an agent display | Option | What it does | Why it matters for an agent | |---|---|---| | `-screen 0 WxHxD` | "creates screen screennum and sets its width, height, and depth" | Fixes the size of every screenshot and the range of every click | | `-fbdir DIR` | Puts the framebuffer in memory-mapped files in DIR | Lets other tools read the screen as a file | | `-dpi N` | "sets the resolution for all screens, in dots per inch" | Changes how large applications draw text and controls | | `-nolisten tcp` | Disables TCP/IP connections | Keeps the display local to the machine | | `-nocursor` | "disable the display of the pointer cursor" | Hides the pointer; most agents want to see it, so leave it out | Sources: the [Xvfb manual](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html) and the [Xserver manual](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26. Two options to avoid: `-ac`, which "disables host-based access control mechanisms. Enables access by any host" and comes with the warning "Use with extreme caution" (Xserver manual), and leaving TCP open on a machine other people can reach. ## What is the default screen, and why set it yourself? The default is one screen of 1280x1024, but the documented depth depends on which manual you read, so always pass `-screen`. Table: Documented Xvfb defaults | Source | Default screen | |---|---| | Xvfb manual for X.Org server 21.1, Debian bookworm | 1280x1024x24 | | Xvfb manual in the X.Org documentation archive | 1280x1024x8 | | xvfb-run, Debian bookworm | `-screen 0 1280x1024x24` passed by the script | Sources: [Xvfb manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), [Xvfb manual, X.Org archive](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xvfb.1.xhtml), [xvfb-run manual](https://manpages.debian.org/bookworm/xvfb/xvfb-run.1.en.html), all read 2026-11-26. An 8-bit screen has 256 colours, so screenshots taken from it look nothing like a normal desktop. A model trained on ordinary screenshots should be shown a 24-bit screen. Writing `-screen 0 1280x1024x24` (or the size you chose) removes the dependence on the installed version. ## Should I use xvfb-run or start Xvfb myself? Use xvfb-run for one command that needs a display, and start Xvfb yourself for a desktop that lives for a whole agent session. xvfb-run is a wrapper script. Its manual gives the defaults: server arguments "-screen 0 1280x1024x24", display number 99, and `-a` to "Try to get a free server number, starting at 99". It creates a temporary X authority file and removes it when the command exits, and it "requires the xauth command to function" (xvfb-run manual, read 2026-11-26). That is ideal for a test or a single tool run: ``` xvfb-run -a -s "-screen 0 1920x1080x24 -nolisten tcp" python3 run_task.py ``` An agent desktop is different: a window manager, a VNC server and the agent all connect to the same display for minutes or hours. Start Xvfb directly, export `DISPLAY`, and start the other programs against it, as in our [Linux desktop setup](https://www.vmforai.com/issue/linux-desktop-for-an-ai-agent/). ## How do I keep the display private? Keep the display private with three settings: no TCP listener, an authority file, and no `-ac`. 1. `-nolisten tcp` so only local programs can connect. 2. `-auth FILE`, which "specifies a file which contains a collection of authorization records used to authenticate access" (Xserver manual). xvfb-run does this for you. 3. Run Xvfb and the agent as a normal user, not root, so a program on the display cannot write anywhere on the system. Anything that can connect to the X display can read the screen and inject input, so treat display access like a login. ## How do I read the screen without a viewer? Read the screen with FFmpeg or from the framebuffer file. FFmpeg's x11grab device "allows one to capture a region of an X11 display" ([FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26): ``` ffmpeg -y -f x11grab -video_size 1280x1024 -i :99 -frames:v 1 screen.png ``` Or start Xvfb with `-fbdir`, which the manual says sets "the directory in which the memory mapped files containing the framebuffer memory should be created", and view the file with xwud. The X.Org manual's example is `Xvfb -pixdepths 3 27 -fbdir /var/tmp` followed by `xwud -in /var/tmp/Xvfb_screen0` (Xvfb manual, X.Org archive). ## How do I check the display is set up right? Check the display with three commands before the agent starts: 1. `xdpyinfo -display :99`: xdpyinfo is "a utility for displaying information about an X server" and shows its screens and visuals ([xdpyinfo manual](https://manpages.debian.org/bookworm/x11-utils/xdpyinfo.1.en.html), read 2026-11-26). Confirm the dimensions and depth match your `-screen`. 2. `xdpyinfo -display :99 -ext XTEST`: input tools such as xdotool need the XTEST extension. 3. One screenshot with FFmpeg: it should be the size you set, in full colour. ## What we read for this article - [Xvfb manual, Debian bookworm (X.Org server 21.1)](https://manpages.debian.org/bookworm/xvfb/Xvfb.1.en.html), read 2026-11-26 - [Xvfb manual, X.Org documentation archive](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xvfb.1.xhtml), read 2026-11-26 - [Xserver manual, X.Org documentation archive](https://xorg.freedesktop.org/archive/current/doc/man/man1/Xserver.1.xhtml), read 2026-11-26 - [xvfb-run manual, Debian bookworm](https://manpages.debian.org/bookworm/xvfb/xvfb-run.1.en.html), read 2026-11-26 - [xdpyinfo manual, Debian bookworm](https://manpages.debian.org/bookworm/x11-utils/xdpyinfo.1.en.html), read 2026-11-26 - [FFmpeg devices](https://ffmpeg.org/ffmpeg-devices.html), read 2026-11-26 ## FAQ ### What is the default Xvfb screen size? 1280x1024. The depth depends on the version of the manual you read; Debian bookworm's Xvfb 21.1 manual says 1280x1024x24, while the X.Org archive manual says 1280x1024x8. Set -screen yourself so the question never matters. ### What does xvfb-run do? It starts Xvfb, creates a temporary X authority file, runs your command with DISPLAY set, and stops the server when the command exits. Its default server arguments are -screen 0 1280x1024x24 and its default display is 99. ### How do I stop other machines from connecting to my Xvfb display? Add -nolisten tcp, and do not use -ac, which the X server manual says disables host-based access control and should be used with extreme caution. ### Can I see what is on an Xvfb screen without VNC? Yes. Start Xvfb with -fbdir so the framebuffer is kept in a memory-mapped file, then read it with xwud, or take a screenshot with FFmpeg's x11grab device. --- # Who we are VMForAI.com is about the computer a computer-use agent sits in front of: the virtual display, the window manager, the way you watch it, the screen size the model sees, the input it sends, and the virtual machine that can be put back to a clean state after every task. Articles are written by the editors as a desk. Every default, option and limit in them comes from the tool's own manual page, documentation, repository or paper, listed at the end with the day it was read. Each article shows the day it was first published and the day it was last checked. When a tool changes, the article is corrected and its updated date moves. The site does not rank providers, and it carries no advertising.