Skip to main content
The beam CLI is a command-line utility that lets you work with Beam using beam commands, from uploading files to volumes to deploying your applications. Use --help for command syntax and beam deploy --help-all for advanced deployment options. For persistent Linux machines, see the Virtual machines CLI reference. beam vm open NAME PORT opens a published HTTP port with automatic browser authentication; beam vm ip NAME prints its persistent IPv6 address.

Most Common Commands

You’ll be using these a lot!
  • beam deploy – deploy an app to the cloud
  • beam shell – SSH into a container to debug it interactively
  • beam serve – create a temporary live preview of your app
  • beam logs – stream logs from a task, container, or deployment

Installation

This installs the CLI in an isolated environment. Install beam-client separately in your project environment to import beam from Python.
You can find instructions for installing the CLI on Windows here.

Setup Credentials

Sign in with the browser flow and verify the selected workspace:
On a remote machine, use beam login --browserless. Credentials are saved in ~/.beam/config.ini. See authentication for tokens and CI.

Config

Configures your Beam API keys and saves a profile to ~/.beam/config.ini
  • Context Name (required) — the name of the profile, such as prod or staging.
  • Gateway Host (optional) — leave blank to use the default (gateway.beam.cloud).
  • Gateway Port (optional) — leave blank to use the default (443).
  • Token (required) — your API token, found on this page of the dashboard.

Create

Create a new context.
If you are prompted to enter a value for Gateway Host or Gateway Port, you can leave both fields blank.

Delete

Delete a saved context.

List

Lists saved contexts.

Select

Set the default context.

Specifying Context

Most commands support the --context (or -c) flag, which allows you to specify which config profile to use for that command. This is useful when working with multiple environments (e.g., development, staging, production).
If no context is specified, the default context (set via beam config select) will be used.

Doctor

Checks that the selected context can reach its gateway and that its token is valid, without creating any resources. Run it first when a command fails unexpectedly.
The output shows the context, the gateway address, and the SDK version. If the check fails, beam doctor prints the error and exits with status 1, so it works as a preflight step in scripts. --format json prints the same details as an object with the keys sdk_version, context, gateway, authenticated, and error. Pass --context to check a context other than the default.

Deployment

Create

Deploys a Python handler, Dockerfile, or registry image. HTTP workloads return a URL; background workers without ports do not. See container hosting.

List

Lists all deployments.

Stop

Stops a deployment.

Start

Starts an inactive deployment.

Delete

Deletes a deployment.

Shell

SSH Into Containers

Allows you to interactively access a container on Beam. The container is built with the same image and resources as your handler.
You can also shell into a running container, by passing in a container_id:
Pass --sync-dir DIR to watch a local directory and sync its changes into the container while the shell is open. If you don’t have a handler yet, beam dev opens a shell in a default environment.

Serve

Create a Preview Environment

Creates a temporary deployment preview.
The preview shuts down after 10 minutes without activity. Pass --timeout SECONDS to change that, or --timeout -1 to keep it running until you stop it.

Run

Runs a single container and streams its logs. Point it at a Pod defined in Python, or skip the handler and describe the container with flags. See running a web service for a walkthrough.
The handler must be a Pod object; any other handler is rejected with an error. To preview an endpoint or task queue, use beam serve instead. beam run --help-all lists the remaining options, including --sync, --secrets, --disk, --pool, --keep-warm-seconds, and the checkpoint settings. Pressing Ctrl+C stops the log stream but leaves the container running. Both Ctrl+C and --detach print the commands for following up:
By default the container stops after 10 minutes without an active connection to its URL. Change that with --keep-warm-seconds, where -1 disables the timeout. See Pod timeouts. --sync syncs the current directory into the container and watches it for changes. It can’t be combined with --detach.

Dev

Spins up a remote development container, opens a shell in it, and keeps a local directory synced into it while you work. Give it a handler to reuse that handler’s image and resources, or leave it blank for a default environment.
--sync DIR sets the directory to sync, which defaults to the current directory. The image and resource options are the same as for beam run.

Container

Manage the containers running in your account.

List

Lists all containers.

Stop

Terminate a running container.

Task

Any code you run on Beam creates a task. Any time you run a function or invoke an API, a task is created.

List Tasks

Lists all tasks.

Stop a Task

Stops a task.

Volume

Beam allows you to create highly-available storage volumes that can be used across tasks. You might use volumes for things like storing model weights or large datasets.

Create a Volume

Creates a volume.

Delete a Volume

List Volumes

List all volumes mounted to your apps.

List Volume Contents

List all contents of a volume.

Copy Files to Volumes

Copies a file to a volume.

Move Files in Volumes

Move files around a volume.

Remove Files from Volumes

Remove a file from a volume.

Downloading Data

You can download directories and individual files.

Disk

Durable disks are persistent, node-local storage for stateful workloads such as databases. Disks are created automatically when an app that declares them is run or deployed, and can also be managed directly from the CLI.

Create a Disk

Creates a disk, or returns the existing disk if one with that name already exists.
--size defaults to 10Gi and --filesystem to ext4.

List Disks

List all disks in your workspace.

List Disk Snapshots

List the snapshots taken of a disk. Omit the disk name to list snapshots for every disk in the workspace.

Delete a Disk

Deletes a disk from your workspace. Snapshots of the disk are kept.

Secret

Serverless apps receive secret values as environment variables. VM/sandbox runtime secrets receive placeholders and require approved credential hosts; see brokered secrets. Serverless code can access a bound value like this:

List Secrets

Lists names, allowed hosts, placeholders and timestamps, without values. Use --format json for structured output.

Create a Secret

Creates a secret
Repeat --host for credential hostnames or quoted *.wildcards. Host rules contain no ports or paths.

Show a Secret

Shows the value of a secret.

Update a Secret

Modifies the value of a secret.
modify remains an alias. Omitting --host preserves rules; supplying it replaces them. --clear-hosts removes all rules, making the secret unusable as a brokered runtime binding. Placeholders stay stable; brokered requests pick up rotated values after a 15-second cache, while serverless containers use them on their next start.

Delete a Secret

Permanently deletes a secret.

Logs

Logs return the last 100 lines. Use beam logs web --follow to stream, or select an ID below. See logs and metrics for filters.

Deployment

Streams logs for a deployment.
You can find the deployment ID by running beam deployment list.

Task

Streams logs for a task.
You can find the task ID by running beam task list.

Container

Streams logs for a container.
You can find the container ID by running beam container list.

Stub ID

Streams logs for a stub ID.

Machine

Manage the machines available on Beam.

List

List the available GPUs at any given moment.

Reserve

Reserves on-demand hardware into a compute pool. In a terminal, it lists the cheapest offers and asks you to pick one. With --yes, or when the output is piped, it reserves the cheapest offer without prompting.
The pool is named ondemand-<gpu> unless you pass --name. --ttl takes a duration such as 45m, 6h, or 2d, or indefinite, which starts with a 30-day lease. If you omit --max-spend, it’s calculated from the offer price and TTL.
Reserved nodes renew hourly past their TTL while your workspace has credit, and you’re billed until they’re released. See how reserved nodes are billed.

Release

Releases reserved hardware and stops billing for it.
Get machine IDs from beam pool machines.

Pool

Manage compute pools, groups of dedicated machines that your apps can run on. Route an app to a pool with the pool argument in your code, or with beam deploy --pool <name>.

List Pools

With --format json, each pool includes its reservations, with lease and billing details. See Checking a Reservation.

Create a Pool

Creates a private pool for machines you attach yourself. You don’t have to run this first: beam pool join, beam pool scale, and beam machine reserve create the pool if it doesn’t exist.

Browse Offers

Lists the on-demand offers that match a pool shape, without reserving anything. For an interactive picker, use beam machine reserve.

Reserve Nodes

Reserves nodes into a named pool without prompting, which makes it the scriptable counterpart to beam machine reserve. --ttl and --max-spend are required. When you add nodes to an existing pool, the GPU type must match the pool’s.
--offer-id reserves a specific offer returned by beam pool offers.

List Machines

Lists the machines in your private pools, or in a single pool if you pass its name. The table shows each machine’s ID, state, capacity, load, public IP, and when it last checked in.

Extend a Pool

Moves the lease end of every reserved node in a pool, or raises the pool’s spend cap. --ttl is measured from now, and only ever extends leases.

Delete a Pool

Deletes a pool, releasing all of its machines and reservations.

Join a Machine

Joins the machine you run it on to a private pool, creating the pool if it doesn’t exist.
--max-cpu, --max-memory, --max-gpus, and --gpu-ids limit what the machine offers to the pool. Use either --max-gpus or --gpu-ids, not both. Prints an install command that joins a machine to the pool. Use it to add a machine that doesn’t have the Beam CLI installed.
The command contains a join token, so treat it like a secret. The token is valid for 30 minutes unless you pass --ttl.

Image

Build and inspect container images without running anything.

Build an Image

Builds an image from an Image object defined in Python, or from a Dockerfile. Pass one or the other, not both.
The handler must point to an Image object rather than a function. --context-dir defaults to the Dockerfile’s directory. When the build finishes, the command prints the image ID. If the build fails, it exits with status 1. With --format json, the result is printed as JSON and the live build logs go to stderr, so you can pipe the output.

Get an Image

Checks whether an image ID is available to run.
The result is printed as JSON with the keys image_id, exists, and context. The command exits with status 1 if the image doesn’t exist.

Token

Manage the API tokens for your workspace. You can also manage them on the API keys page of the dashboard. See authentication for how tokens are used.

List Tokens

Lists each token’s ID and type, whether it is active, and when it was created.

Create a Token

Creates a token and prints it, including its key. The key is a credential, so avoid running this where output is logged.
The default workspace token has full access. A workspace_restricted token can invoke your deployed apps but can’t manage workspace resources such as deployments, volumes, secrets, or other tokens. Use it for clients that only call your endpoints.

Toggle a Token

Disables an active token, or re-enables a disabled one, without deleting it.

Delete a Token

Deletes a token.

Additional Workflows

Use --help on the command you need. Global options precede the subcommand, for example beam --context production --json deployment list.

Helpers and utils

Ignore Local Files

You can create a .beamignore file in your project’s root directory to tell Beam which local files and directories to ignore when syncing to Beam. This follows the conventions of .gitignore Ignoring Files
Ignoring Folders