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

# Compute Pools

> Reserved capacity and your own hardware

Use a compute pool to reserve machines or run Beam on your own hardware. Workloads routed to a pool run on its machines instead of on-demand capacity.

## Inspect Capacity

```bash theme={null}
beam machine list
beam pool list
beam pool offers --gpu H100 --nodes 1 --ttl 1h --max-spend 10
```

Offers show the available provider, region, resources, and cost.

## Reserve a Pool

```bash theme={null}
beam pool create training
beam pool scale training --gpu H100 --nodes 1 --ttl 1h --max-spend 10
beam pool machines training
```

`beam pool scale` requires both `--ttl` and `--max-spend`. `--ttl` sets the initial lease, and `--max-spend` caps what Beam can commit, in USD, when it picks offers for this reservation. Filter offers with `--provider`, `--region`, or `--min-reliability`, or pick one with `--offer-id`. Wait for the machines to become available before deploying.

To choose from the cheapest offers interactively, use `beam machine reserve`. Pass `--yes` to take the cheapest offer without prompting:

```bash theme={null}
beam machine reserve --gpu H100 --ttl 6h --name training --yes
```

> [!NOTE]
>
> Reserved machines are billed by the hour until they're released, even when
> apps are idle, and their leases renew past `--ttl`. See [How Reserved Nodes
> Are Billed](#how-reserved-nodes-are-billed).

## Route Workloads

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


@function(gpu="H100", pool="training")
def handler():
    return {"ok": True}
```

The `pool` argument works the same way on `endpoint`, `task_queue`, `asgi`, `realtime`, and `Pod`. It also accepts a [`Pool`](https://docs.beam.cloud/v2/reference/py-sdk#pool) object, but if that object sets reservation fields such as `nodes` and `ttl`, every deploy, serve, or run reserves more nodes. Reserve nodes from the CLI and pass the pool name instead.

For a container deployment:

```bash theme={null}
beam deploy --name trainer --dockerfile Dockerfile --pool training --gpu H100 --no-ports
```

The pool must have a machine with enough CPU, memory, and GPUs for the workload.

## How Reserved Nodes Are Billed

When you reserve nodes, you set a lease length (`--ttl`) and a spend cap (`--max-spend`). Reserved nodes are billed by the hour from the moment they're reserved, whether or not anything is running on them.

Shortly before a node's lease runs out, Beam renews it for another hour, as long as your workspace has enough credit to cover the usage so far plus one more hour. A reserved node therefore keeps running, and billing, past its original TTL until you [release it](#release-capacity) or Beam [releases it for you](#when-beam-releases-nodes-for-you). With `beam machine reserve`, `--ttl indefinite` starts with a 30-day lease.

`--max-spend` limits what Beam can commit when it picks an offer for a new reservation. It isn't a running budget: it doesn't stop nodes that are already reserved, and it doesn't stop their hourly renewals.

### Checking a Reservation

`beam pool list --format json` shows each pool's reservations, including when the current lease ends and why a reservation was terminated:

```json theme={null}
{
  "private_pools": [
    {
      "name": "training",
      "status": "active",
      "reservations": [
        {
          "status": "active",
          "gpu_count": 1,
          "hourly_cost_micros": "2090000",
          "created_at": "2026-10-10T16:38:06Z",
          "expires_at": "2026-10-10T18:38:06Z",
          "billing_renewal_at": "2026-10-10T17:38:06Z",
          "terminating_reason": ""
        }
      ]
    }
  ]
}
```

* `status`: `pending`, `active`, `terminating`, `deleted`, or `failed`.
* `expires_at`: when the current lease ends, unless it's renewed first.
* `billing_renewal_at`: the next hourly billing boundary.
* `hourly_cost_micros`: the hourly price in millionths of a dollar, so `2090000` is \$2.09 an hour.
* `terminating_reason`: why a reservation ended. A reservation you released yourself shows `machine_released`.

### Extending a Reservation

`beam pool extend --ttl` moves the lease end of every reserved node in a pool to that long from now. It only extends leases and never shortens them. `--max-spend` raises the pool's spend cap:

```bash theme={null}
# Keep the pool's nodes for another 12 hours from now
beam pool extend training --ttl 12h

# Raise the spend cap on a long-lived pool
beam pool extend training --max-spend 50
```

## When Beam Releases Nodes for You

Beam terminates reserved nodes on its own in these cases. The reason appears in `terminating_reason`:

* `credit_exhausted`: your workspace ran out of credit. Beam acts before the balance reaches zero, as soon as your available credit can't cover the usage accrued so far plus about one more minute of usage.
* `billing_unreachable`: Beam couldn't check your balance for 10 minutes. To avoid unpaid usage, it releases the nodes even if you have credit left.
* `expired`: the lease ended without being renewed, for example because there wasn't enough credit for another hour or the provider rejected the renewal.

To keep reserved nodes running, keep enough credit in your workspace to cover them. Add credit in **Settings → Credits**.

## Bring Your Own Hardware

Run `beam pool join` on the machine you want to add. It creates the pool if it doesn't exist yet:

```bash theme={null}
beam pool join my-hardware
```

To add a machine that doesn't have the Beam CLI, generate an install command and run it on that machine:

```bash theme={null}
beam pool join-command my-hardware --ttl 30m
```

The command includes a join token, so treat it like a secret. The token expires after 30 minutes unless you pass a different `--ttl`; this doesn't limit how long the machine stays in the pool. You can also add hardware under **Compute** in the dashboard.

Machines you attach yourself aren't leased, so they don't renew or expire. They stay in the pool until you remove them with `beam machine delete <machine-id>`. If a machine stops checking in, Beam stops scheduling work on it.

## Release Capacity

Use `beam pool delete <name>` to delete a pool and release its reserved machines. To release reservations and keep the pool, run `beam machine release` with a machine ID, or with `--pool <name>` to release everything reserved under that pool. Stopping an app does not release its machines.


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