beam-logo

Secure Sandboxes

for any workload

Spin up isolated, Python-native compute environments in seconds — with GPUs, networking, and persistent storage. Run untrusted or LLM-generated code safely, at any scale.

sandbox.py

A cloud environment for anything you can run

Sandboxes give you a secure, fully configurable machine in the cloud — booted in seconds and controlled entirely from Python.

1–3 second boot times

Sandboxes cold boot in one to three seconds — even with dependencies baked in. Image caching keeps every subsequent launch fast.

Run untrusted code safely

Every sandbox is fully isolated. Block all outbound traffic or define CIDR allow lists to lock down exactly what your code can reach.

Filesystem & memory snapshots

Capture the filesystem or live memory of a running sandbox, then fork it or restart from that exact state for reproducible, instant cold starts.

Dynamic preview URLs

Expose any port at creation time or on the fly. Each one gets an SSL-terminated, authenticated URL — perfect for v0-style code-gen apps.

GPUs, CPU & persistent storage

Configure CPU, memory, and GPUs in a single constructor, and mount distributed volumes or your own cloud buckets to persist work across sessions.

Full process control

Run Python, execute shell commands, and manage long-running processes with real-time log streaming through a clean Python interface.

From zero to a live environment in seconds

Create a sandbox

Define CPU, memory, GPU, and your image in a single Sandbox() constructor, then call create() to launch it into the cloud in seconds.

Run code and commands

Execute Python with run_code, run any shell command with exec, upload and download files, and stream logs back in real time.

Expose, snapshot, or terminate

Expose ports behind secure preview URLs, snapshot the filesystem or memory to fork later, and auto-terminate when you're done.

sandbox.py

Frequently asked questions

What can I run inside a sandbox?

Anything — sandboxes aren't limited to Python. Run shell commands, start a Node.js server, launch a headless browser, or execute arbitrary code. You get a full isolated environment with networking, storage, and optional GPUs.

How fast do sandboxes boot?

Sandboxes cold boot in 1–3 seconds, even with dependencies included. Beam caches dependencies in your base image, so subsequent sandboxes launch even faster.

Is it safe to run untrusted or LLM-generated code?

Yes. Every sandbox is fully isolated. You can block all outbound network traffic with block_network, or define CIDR allow lists to permit only specific destinations — and update those permissions at runtime without restarting.

Can I use GPUs?

Yes. Assign a GPU like an A10G alongside CPU and memory directly in the Sandbox constructor, so you can run rendering, machine learning, or other accelerated workloads.

How does persistent storage work?

Mount fast distributed Volumes to persist files between sessions and share data across sandboxes, or connect your own S3-compatible cloud buckets for large datasets and long-term storage in your own infrastructure.

How does pricing work?

You're billed per-second only while your sandbox is running. Set a timeout to auto-terminate, or terminate manually when you're done. Every account gets $30 of free credit each month.

Ship your app in minutes

Get started with $30 of free credit, refreshed every month.