Skip to main content
A sandbox is a computer for your agent: a machine in the cloud it drives from code. In about five minutes you’ll create one, run code in it, serve a URL, fork it from a memory snapshot, and attach a GPU.
Using Cursor, Claude Code, or Codex? Run beam setup agent to connect your coding agent to your workspace. See agent setup.

Install and Sign In

Finish signing in through your browser, then run beam whoami to check your workspace.

Run Code, Serve a URL, and Fork

Save this as sandbox.py and run python sandbox.py:
sandbox.py
Preview URLs are public. Add authentication in your app before serving anything sensitive.

Add a GPU

Attach a GPU with one argument:
Requesting a GPU doesn’t install CUDA libraries. Add packages such as torch to the sandbox image.

Control Outbound Traffic

Each sandbox is isolated from your app and other workloads. To control what an agent’s computer can reach, block outbound traffic or allow only specific CIDR ranges:

Next Steps

Run Your First App

Run a function and deploy a web endpoint.

Snapshots

Save filesystem or memory state and fork it.

Networking

Preview URLs and outbound rules.

TypeScript SDK

Create and operate sandboxes from Node.js.