Clipboard, audio and file transfer in an agent's desktop
The gist
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.
Words: VMForAI editors / Out / Fixed up / 6 min
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:
- 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. - xclip stays running. Its default mode is to "fork into the background to wait for requests", and
-loopssets how many pastes to serve; the default of 0 waits until another application takes the selection over (xclip manual). 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, 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, 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, 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 <path> as named share <name>" |
Sources: docker container cp, OSWorld server main.py and xfreerdp manual, 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) ordomainAllowList(up to 100 domains) (Daytona network limits documentation). - E2B: internet access stays on unless
allowInternetAccessis false, andallowOutnames 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=Truerefuses every outbound connection,outbound_cidr_allowlistadmits only listed IP ranges, andoutbound_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:
- Inputs read-only. Mount task inputs read-only, so the agent cannot change the originals.
- Outputs collected once. Copy outputs out at the end of the task, not through a folder the agent can write to the whole time.
- Viewer clipboard off by default. Turn x11vnc's clipboard sync off unless a person is actively helping.
- No host folders. Never share a home directory or a folder that holds credentials with the desktop.
- 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.
What we read for this article
- xclip manual, Debian bookworm, read 2026-11-26
- x11vnc manual, Debian bookworm, read 2026-11-26
- PulseAudio modules, read 2026-11-26
- FFmpeg devices, read 2026-11-26
- docker container cp, read 2026-11-26
- OSWorld server main.py, read 2026-11-26
- xfreerdp manual, Debian bookworm, read 2026-11-26
- Promigence FAQ, https://www.promigence.ai/faq, read 2026-11-26
- Promigence CLI reference, https://www.promigence.ai/docs/cli, read 2026-11-26
- Promigence errors and exit codes, https://www.promigence.ai/docs/errors, read 2026-11-26
- Amazon Bedrock AgentCore Code Interpreter documentation, read 2026-11-26
- Daytona network limits documentation, read 2026-11-26
- E2B internet access documentation, read 2026-11-26
- GKE Agent Sandbox documentation, read 2026-11-26
- Modal Sandbox networking guide, read 2026-11-26
Asked
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.