beam-logo
← All use cases

Run computer use agents on persistent Linux desktops

Give each computer use agent a Linux desktop it can screenshot, click, and type in. Pause it between runs to release compute, and it resumes with the same apps open.

Why Beam

Give your agent a full desktop

A real Ubuntu machine with root access and a persistent disk, isolated in its own microVM.

How it works

How to run a computer use agent on a Linux desktop

01

Create a desktop VM

Set desktop=True in Python or desktop: true in JavaScript, or run beam vm new, which includes a desktop by default.

02

Run the screenshot loop

Send each screenshot to your model and turn its reply into a click, key press, or pasted text.

03

Record and pause

Save the run as an MP4, then pause the VM so the next run starts with the same apps open.

agent_loop.py
from beam import VM

def ask_model(png: bytes) -> dict: ...  # call your model

vm = VM("agent-desktop", desktop=True).create()
rec = vm.desktop.record("/workspace/run.mp4")

for _ in range(50):
    action = ask_model(vm.desktop.screenshot())
    kind = action.pop("type")
    if kind == "click":
        vm.desktop.click(**action)  # x, y, count
    elif kind == "write":
        vm.desktop.write(action["text"])  # pastes it
    elif kind == "press":
        vm.desktop.press(*action["keys"])
    else:
        break  # "done" ends the run

vm.desktop.stop_recording(rec)
vm.pause()  # open apps stay in RAM
FAQ

Frequently asked questions

What is a computer use sandbox?

An isolated machine with a real desktop that an AI agent operates through screenshots, clicks, and keystrokes. On Beam it's a Linux VM with its own kernel, kept apart from your laptop and other workloads.

Which AI models can drive the desktop?

Any model you can call from code. Your loop sends it each screenshot and maps its reply to a call like click, press, or write. The agent works from pixels only, with no accessibility tree, and there are no mouse-down, key-hold, or cursor-position calls.

Can the desktop stay logged in between runs?

Yes, if you pause it. The browser stays in RAM with its sessions intact until a site expires them. A stop or fork keeps the browser profile on disk but starts apps fresh, so session-only logins are lost.

How do I watch or take over the agent's desktop?

Run beam vm desktop with the VM's name to open it in your browser, then take the mouse whenever you need to. The viewer resizes the display to fit your window, so the agent should read coordinates from its latest screenshot.

Is it safe to give an agent a desktop?

Each desktop runs in a microVM with its own kernel, so the agent's root access stays inside the VM. You can block outbound traffic or allow up to 64 hosts or IP ranges, and secrets reach the VM only as placeholders, swapped for real values in HTTPS headers to approved hosts.

Can I run Windows or macOS desktops?

No, desktops are Linux only: Ubuntu 24.04 by default, or 22.04 in a custom image. The browser is Chrome on x86-64 and Firefox on ARM64.

Does the desktop have a GPU?

No. VMs are CPU-only, so the display and any video render on the CPU. Create the VM with more CPUs for a larger display or video-heavy apps.

How much does a computer use sandbox cost?

Beam VMs bill per second while running: $0.0252 per vCPU-hour plus $0.0054 per GiB of RAM per hour, with a 50 GiB root disk included. At the default 4 CPUs and 8 GiB, a desktop costs about $0.144 an hour. A paused or stopped desktop stops accruing compute charges.

Pay as you gobilled by the millisecond

Give Your Agent Superpowers

Start shipping today and bring your vision to life