Execute commands
exec options before the VM name. Everything after the name is the remote command. -- makes the boundary explicit. Arguments are literal; use sh -c or bash -lc for shell variables, pipes, and redirection.
Foreground execution streams stdout and stderr and returns the command’s exit status. --timeout sets a command deadline in seconds; 0, the default, waits indefinitely. This deadline is separate from the VM’s idle TTL.
Processes in Python
process.exec() returns a handle immediately. Supply text, bytes, or a binary file as stdin; SDK input is uploaded before execution and followed by EOF. Use SSH for an interactive terminal.
For live logs:
process.wait(timeout=30) bounds how long the caller waits; it does not itself kill the command. Use process.kill() to cancel it. See process management for run_code, environment overrides, process handles, and async behavior. The same process API is available through vm.process and vm.aio.process.
Detached commands and logs
--container-id prevents killing a reused PID after the VM has restarted. Managed process handles belong to the current runtime; use a systemd unit for a service that must start again after a cold boot.
Use only one log selector at a time: --pid, --unit, or --session. Without a selector, logs reads the systemd journal. Detached work does not maintain an idle lease after the CLI exits; disable the TTL for unattended jobs.
SSH and browser terminal
ssh, ssh-keygen, and scp) to use these commands.
The browser terminal uses port 7681. terminal opens your browser; --url prints the entry URL instead. Protect browser access as described in networking.
Copy and sync files
NAME:/path argument. Quote paths with spaces. Sync uploads the local directory’s contents to /workspace/, excludes .git, and can watch for local changes. Install rsync locally to use sync; it is installed in the prepared VM image. Sync is an upload operation, not bidirectional synchronization, and does not delete remote files absent locally.
Systemd services
VMs boot systemd and support your own units. For example, create a service that starts a web server on every cold boot:Coding agents
Prepared VM images include Claude Code and Codex CLIs. Configure the selected agent’s authentication or provider credentials inside the VM;beam vm prompt does not supply an agent subscription or API key.
prompt-... session ID and starts a systemd transient unit. Read its durable output with:
/workspace/.beam-vm/logs/. Those files survive stop/start; an agent launched as a transient unit does not automatically rerun after a cold boot.
Metrics
vm.metrics() samples guest CPU, memory, and root-disk usage over one second. It counts as activity and can wake a VM with automatic resume enabled. It is a current sample, not historical billing data; use the dashboard Usage page for costs.