Skip to main content
JavaScript examples use @beamcloud/beam-js 1.1.0 or later. Configure the SDK before running them.

Open a desktop

Create a desktop VM using the default Ubuntu 24.04 image:
CLI creation includes a desktop for fresh images; use --no-desktop to skip it. In Python or JavaScript, set desktop=True or desktop: true at creation. Custom desktop images support Ubuntu 24.04 (Noble) and 22.04 (Jammy). The desktop has a browser and Terminal launcher. On x86-64, the browser is Chrome; on ARM64 it is Firefox. Applications and user files live on the durable root. Desktop access uses port 8080, protected by default on new VMs. The CLI opens a fresh entry session. See networking for protection toggles. To print the entry URL:
You can also open the desktop from the VM’s dashboard detail page. Keep its browser session private: desktop and terminal access run programs as root inside the VM. A desktop requires at least 1024 MiB RAM (1 GiB). The browser viewer resizes the guest display to its viewport. A larger display or video workload needs more CPU and bandwidth; VMs do not provide GPU acceleration.

Screenshot and resolution

screenshot() returns PNG bytes and optionally saves a file on your local machine. resize(width, height) accepts integer widths from 320 to 4096 and heights from 200 to 2160. The active browser viewer can resize the display again to match its window. vm.desktop_url in Python and vm.desktopUrl in JavaScript return the stable desktop URL. Use vm.access_url(8080) in Python or await vm.accessUrl(8080) in JavaScript for an authenticated entry session when the port is protected.

Mouse and keyboard control

Coordinates refer to guest display pixels. press() uses X11 key names such as Return, ctrl+l, and alt+Tab. write() pastes text with Ctrl+V, so focus a field that supports that shortcut. Use the process API to run terminal commands. click() supports left, middle, and right buttons and counts from 1 to 3; scroll() supports up, down, left, and right with 1–100 steps. Launch a GUI program and get its process handle:

Record the guest screen

Record to an absolute path inside the VM, stop the recording cleanly, then download it:
Recording uses CPU encoding, with an FPS setting from 1 to 60. It is independent of the browser viewer’s frame rate. Use a new output path for each recording; existing files are not overwritten. Finish or stop the recording before stopping, pausing, or restarting the VM.

Desktop lifecycle

Use pause/resume to retain open applications in RAM. Stop/start boots a new desktop session while keeping installed software, launcher files, and user data. Reopen the desktop after stop/start or pause/resume; request a new entry URL if the protected session has expired. For service diagnostics: