@beamcloud/beam-js 1.1.0 or later. Configure the SDK before running them.
A VM keeps its name, ID, durable root, and published URLs across restarts. Its runtime and container ID may change.
Inspect state
list displays CPU, memory, configured root disk size, and uptime for the current running boot. get --json includes the specification, state, current container ID, and URLs. States include starting, running, stopping, stopped, paused, and error.
Stop and start
--no-snapshot skips the named snapshot artifact, while still saving the durable root:
Pause and resume
beam vm start also resumes a paused VM; resume is an alias for start.
External network peers can close connections while the VM is paused. Applications should reconnect their database, API, and other external sessions after resuming.
Discard the saved RAM and boot from the disk:
vm.stop(), vm.start(), vm.pause(), vm.resume(), and vm.start(cold=True). JavaScript uses the same lifecycle names, with await vm.start({ cold: true }) for a cold boot.
Idle TTL and automatic resume
Unlike a sandbox lifetime, a VM TTL measures idle time. It does not delete the VM.--idle-action pause to preserve RAM instead:
- Python
- JavaScript
What counts as activity?
Foreground CLI execution, SSH/tunnels, and active desktop or terminal WebSockets keep an activity lease. SDK access to processes or files updates activity. A command running inside the guest by itself is not a continuous activity signal. For a long Python operation on an idle-limited VM, hold a lease:- Python
- JavaScript
Detached commands and background coding agents do not keep the VM awake for
their entire lifetime. Disable the TTL for unattended jobs, or keep an SDK
activity lease open until the job finishes.
SDK client lifetime and readiness
VM.get(name) reads the VM’s state without starting it. VM.connect(name) also starts or resumes it.
To wait for SSH, the browser terminal, or an enabled desktop, use Python vm.wait(services=True) or JavaScript await vm.wait({ services: true }). Desktop and Docker SDK helpers wait automatically.
- Python
- JavaScript
close() and exiting a with VM... block release local client connections. They leave the VM running. Use stop(), pause(), or remove() to release compute.
Remove a VM
beam vm snapshot rm and beam vm template rm to remove artifacts you no longer need.