> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beam.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Install the Beam CLI, sign in, and connect coding agents to the Beam MCP server with `curl -fsSL https://www.beam.cloud/install | sh`. To also create a VM, run `curl -fsSL https://www.beam.cloud/install | sh -s -- --vm`.
> VMs are persistent Linux machines without GPUs. Defaults: 4 CPUs, 8 GiB of RAM, a 50 GiB disk, Ubuntu 24.04, and a browser desktop. A running VM accrues usage until you stop, pause, or remove it, or until an idle timeout puts it to sleep.
> Stopping a VM keeps its disk and discards RAM and processes. Pausing keeps both, and resuming restores them. To pause after 5 idle minutes and wake on access, run `beam vm update NAME --ttl 300 --idle-action pause --auto-resume`.
> Core VM commands: `beam vm new NAME`, `beam vm ssh NAME`, `beam vm sync NAME ./dir`, `beam vm exec NAME -- CMD`, `beam vm expose NAME PORT --protected`, `beam vm fork NAME NEW_NAME`, `beam vm pause NAME`, `beam vm stop NAME`, `beam vm rm NAME`.
> For GPUs, use a sandbox or a deployed endpoint. Sandboxes are disposable environments that boot in seconds and fork from snapshots.
> Current rates are at https://www.beam.cloud/pricing.

# Overview

> Persistent Linux machines with a durable root disk, SSH, and stable URLs

Beam virtual machines are named Linux environments that keep installed software and files between sessions. Each VM runs in a CPU microVM with its own kernel, systemd, a durable root filesystem, and stable service URLs. Use them for development, coding agents, browser automation, or persistent services.

Manage VMs with `beam vm`, the Python or JavaScript `VM` class, or **Virtual machines** in the [dashboard](https://platform.beam.cloud/vms).

## Create your first VM

Install or upgrade the CLI, then sign in:

```bash theme={null}
uv tool install beam-client
# If already installed: uv tool upgrade beam-client
beam login
beam whoami
```

Create a VM and connect over SSH:

```bash theme={null}
beam vm new devbox
beam vm ssh devbox
```

The default VM has **4 CPUs**, **8 GiB RAM**, Ubuntu 24.04, and **50 GiB of writable root storage over the base image**. SSH is enabled. `beam vm new` includes a desktop when building a fresh image; use `--no-desktop` to skip it. Python and JavaScript SDKs enable the desktop only when requested. Templates and prebuilt images retain their settings.

The built-in browser terminal is protected by default; `beam vm terminal devbox` opens it with an authenticated link. Use `beam vm open devbox PORT` for any published HTTP application. CLI SSH uses your workspace credentials and a local SSH key through an authenticated tunnel. A [persistent IPv6 address](https://docs.beam.cloud/v2/vm/networking.md#persistent-ipv6), when allocated, also supports direct SSH and published TCP ports.

## Files survive stop and start

```bash theme={null}
beam vm exec devbox -- sh -c 'echo hello > /root/hello.txt'
beam vm stop devbox
beam vm start devbox
beam vm exec devbox -- cat /root/hello.txt
```

Stopping saves the filesystem and releases compute. Starting boots the same root disk, so files, apt packages, Python environments, and systemd units remain. Use [pause and resume](https://docs.beam.cloud/v2/vm/lifecycle.md#pause-and-resume) to preserve running processes and RAM too.

> [!NOTE]
>
> VMs keep running until you stop or pause them, remove them, or configure an
> idle TTL. Closing your terminal or Python client does not stop a VM. Running
> VMs incur compute usage even when no command is executing.

## Use the SDKs

Install the package for your language. JavaScript examples use Node.js with ES modules:

> [tab] Python
>
> ```bash theme={null}
> python -m pip install --upgrade beam-client
> ```

> [tab] JavaScript
>
> ```bash theme={null}
> npm install @beamcloud/beam-js
> export BEAM_TOKEN=YOUR_BEAM_TOKEN
> ```

> [tab] Python
>
> ```python theme={null}
> from beam import VM
>
> vm = VM("python-devbox").create()
> try:
>     vm.fs.write_text("/workspace/hello.txt", "Hello from Beam\n")
>     process = vm.process.exec("cat", "/workspace/hello.txt")
>     print(process.wait())
>     print(process.stdout.read())
>     print(vm.id)
>     vm.stop()
> finally:
>     vm.close()
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> import { beamOpts, VM } from "@beamcloud/beam-js";
>
> beamOpts.token = process.env.BEAM_TOKEN || "";
> const vm = await VM.create({
>   name: "js-devbox",
> });
> try {
>   await vm.fs.writeText("/workspace/hello.txt", "Hello from Beam\n");
>   const command = await vm.exec(["cat", "/workspace/hello.txt"]);
>   console.log(await command.wait());
>   console.log(await command.stdout.read());
>   console.log(vm.id);
>   await vm.stop();
> } finally {
>   await vm.close();
> }
> ```

Use `VM.get("python-devbox")` to read an existing VM's state, or `VM.connect("python-devbox")` to start or resume it and wait until commands can run. `VM.list()` returns VM records. Names and IDs work for management operations; IDs start with `vm-`.

In JavaScript, `VM.create()`, `VM.get()`, `VM.connect()`, and `new VM(config).create()` all return a `VM` object. See the [SDK guide](https://docs.beam.cloud/v2/vm/sdk.md) for the complete API.

## VMs and sandboxes

| | Virtual machines | Sandboxes |
| - | - | - |
| Lifecycle | Named resource; stop/start and pause/resume | Temporary environment with a sandbox lifetime |
| Root filesystem | Persistent across stop/start | Use snapshots or mounted storage to retain data |
| Runtime | CPU microVM with its own kernel | Container runtime, or microVM with `use_vm=True` |
| GPUs | Unsupported | Supported by GPU-capable sandbox runtimes |
| Services | systemd, SSH, browser terminal, optional desktop | Process and networking APIs |
| URLs | Stay with the VM across lifecycle operations | Belong to the sandbox instance |

`Sandbox(use_vm=True)` selects a microVM runtime for a sandbox. It does not turn the sandbox into a persistent, named `VM` with stop/start and a durable root.

## VM guides

> [card] [Configuration](https://docs.beam.cloud/v2/vm/configuration.md)
>
> Resources, images, environment variables, secrets, and metadata.

> [card] [Secrets](https://docs.beam.cloud/v2/vm/secrets.md)
>
> Bind credentials, scope approved hosts, and rotate values without restarting.

> [card] [Lifecycle](https://docs.beam.cloud/v2/vm/lifecycle.md)
>
> Stop/start, pause/resume, idle TTLs, and automatic resume.

> [card] [Storage and snapshots](https://docs.beam.cloud/v2/vm/storage.md)
>
> Durable files, restore points, forks, and private templates.

> [card] [Commands and SSH](https://docs.beam.cloud/v2/vm/processes.md)
>
> Execution, stdin, logs, systemd, file transfers, and coding agents.

> [card] [Networking](https://docs.beam.cloud/v2/vm/networking.md)
>
> Stable subdomains, protected URLs, private tunnels, and egress controls.

> [card] [Desktop](https://docs.beam.cloud/v2/vm/desktop.md)
>
> Browser access, screenshots, keyboard and mouse control, and recording.

> [card] [Docker and Compose](https://docs.beam.cloud/v2/vm/docker.md)
>
> Build and run containers inside a VM.

> [card] [CLI reference](https://docs.beam.cloud/v2/vm/cli.md)
>
> All VM commands and creation options.

> [card] [SDK](https://docs.beam.cloud/v2/vm/sdk.md)
>
> Python and JavaScript APIs for lifecycle, snapshots, desktop, and networking.

## Usage and billing

See the [pricing page](https://www.beam.cloud/pricing) for VM CPU and memory rates. Stopped and paused VMs release compute; running VMs accrue usage. The dashboard [Usage page](https://platform.beam.cloud/usage) shows VM costs and CSV export under **Virtual machines**, separately from Sandboxes.

Compute and credit allocation are finalized daily at 00:00 UTC. The current billing period can include an estimate for today. See [pricing and billing](https://docs.beam.cloud/v2/resources/pricing-and-billing.md) for credits, invoices, and storage pricing.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.