> ## 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.

# Capacity Tiers

> Choose between Performance, Shared, and Spot CPU capacity, or route workloads to dedicated compute pools

CPU workloads can choose a capacity tier:

| Tier | Behavior |
| - | - |
| Spot | Uses spare capacity and may be interrupted with 30 seconds' notice. |
| Shared | Shared vCPUs, not preemptible. Up to 8 vCPU / 16 GiB. |
| Performance | No CPU sharing, not preemptible. |

See [current rates](https://www.beam.cloud/pricing#cpu-capacity). New accounts default to Performance, and workloads opt into Shared or Spot; omitting the tier keeps an existing account's default. When Performance capacity is full, Performance workloads may run on Shared hosts, still with no CPU sharing. GPU workloads and private pools keep their own pricing and placement.

Tiered VMs and VM-backed sandboxes require at least **1 vCPU / 1 GiB**. Ordinary containers support fractional resources.

Requires `beam-client >= 0.2.236` or `@beamcloud/beam-js >= 1.1.7`.

## Choosing Compute Capacity

| Option | Best for | Billing |
| - | - | - |
| **Performance / Shared** (on-demand CPU) | Everyday VMs, sandboxes, endpoints, functions, and containers | Per-millisecond active usage |
| **Spot** (preemptible CPU) | Fault-tolerant batch jobs, background queues, and cost-sensitive VMs or sandboxes | Lower per-millisecond rates; interruptible with 30s notice |
| **[Compute Pools](https://docs.beam.cloud/v2/scaling/pools.md)** (reserved & private) | Reserved GPU/CPU machines or attaching your own hardware | Hourly for reserved machines; management fee for your own hardware |

For GPU workloads, see [GPU Acceleration](https://docs.beam.cloud/v2/environment/gpu.md) for serverless availability and [Compute Pools](https://docs.beam.cloud/v2/scaling/pools.md) for reserved GPU hardware.

## Configuring a CPU Tier

### Functions, Endpoints, and Deployments

Pass `cpu_tier` in Python decorators, `cpuTier` in JavaScript, or `--cpu-tier` in CLI deployments:

```python theme={null}
from beam import function


@function(cpu=2, memory="2Gi", cpu_tier="shared")
def handler():
    return {"ok": True}
```

```bash theme={null}
beam deploy --name worker --dockerfile Dockerfile --cpu-tier spot
```

### Virtual Machines

```bash theme={null}
beam vm new devbox --cpu-tier shared --cpu 4 --memory 8192
```

* Python: `VM("devbox", cpu_tier="shared", cpu=4, memory=8192).create()`
* JavaScript: `VM.create({ name: "devbox", cpuTier: "shared", cpu: 4, memory: 8192 })`

Change a VM's tier only while stopped (`beam vm update devbox --cpu-tier performance`, `vm.update(cpu_tier="performance")`, or `vm.update({ cpuTier: "performance" })`). The new tier applies from the next start at its current rates, while past usage keeps its original prices. Forks inherit the tier and start at current rates. See [VM Configuration](https://docs.beam.cloud/v2/vm/configuration.md#cpu-capacity-tier).

### Sandboxes

* Python: `Sandbox(cpu_tier="shared", cpu=2, memory="2Gi")`
* JavaScript: `new Sandbox({ name: "dev", cpuTier: "shared", cpu: 2, memory: "2Gi" })`

VM-backed sandboxes require at least 1 vCPU / 1 GiB; omitted memory defaults to 1 GiB for a tiered VM-backed sandbox, and explicit requests below the minimum are rejected. See [Sandbox Configuration](https://docs.beam.cloud/v2/sandbox/configuration.md#cpu-capacity-tier).

## Spot Interruption Behavior

Spot work waits for spare capacity instead of adding machines and may be interrupted with 30 seconds' notice:

* **Functions and sandboxes**: Fail if no spare capacity frees up within 20 minutes. Spot functions retry interruptions within their configured retry limit. Spot sandboxes terminate when reclaimed; persistent mounts survive, while process state and temporary files do not.
* **Deployments and HTTP endpoints**: Keep trying while they have requests, queued tasks, or `min_containers`, and replace interrupted containers the same way. Interrupted HTTP requests fail; Beam does not transparently replay them, so set application timeouts and retries for your requests.
* **Virtual machines**: Receive a 30-second graceful shutdown window on preemption. The disk and URLs remain, while memory is lost. Start a preempted VM explicitly with `beam vm start <name>`; incoming traffic does not restart it. Check VM details for the preemption reason.

## Pricing and Rate Locking

A workload keeps its tier's prices from its first run, even if rates change later; a new deployment starts at current rates. GPU-attached CPU and RAM keep the GPU rates. See [Pricing and Billing](https://docs.beam.cloud/v2/resources/pricing-and-billing.md#cpu-capacity-tiers) and the [pricing page](https://www.beam.cloud/pricing#cpu-capacity) for current rates.


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