@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:--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:
Screenshot and resolution
- Python
- JavaScript
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
- Python
- JavaScript
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:
- Python
- JavaScript
Record the guest screen
Record to an absolute path inside the VM, stop the recording cleanly, then download it:- Python
- JavaScript