Persistent VMs are now available.Learn more

Give your AI agents a safe place to run code

Run agent-generated code in isolated sandboxes that boot in under a second, with filesystem access, exposed ports, and snapshots.

Compute primitives built for agents

Sandboxes include process management, file system operations, and access to stdout and stderr.


How to run agent-generated code in a sandbox

  1. Create a sandbox

    Define the image (Python version, packages, even non-Python runtimes) and call create(). It's up in seconds.

  2. Let the agent work

    Run generated code, execute processes, read logs, and move files through the SDK from your agent loop.

  3. Snapshot, expose, or terminate

    Fork state with filesystem snapshots, expose ports for previews, set a TTL for long sessions, or tear it down.

agent.py
# Process management
process = sandbox.process.exec("python3", "train.py")
for line in process.logs:
    print(line, end="")

# Filesystem in and out
sandbox.fs.upload_file("data.csv", "/workspace/data.csv")
sandbox.fs.download_file("/workspace/output.csv", "results.csv")

# Keep the session alive for an hour
sandbox.update_ttl(3600)

# Snapshot the filesystem to fork or resume later
image_id = sandbox.create_image_from_filesystem()

Frequently asked questions

How isolated are sandboxes?

Each sandbox runs in its own isolated, non-root container, separated from your other workloads. For stricter requirements, Beam also offers a self-hosted deployment that keeps everything inside your own VPC.

Can agents run things other than Python?

Yes. Sandboxes run arbitrary processes. Start from any base image (Node, for example) and exec whatever the agent needs.

How long can a sandbox stay alive?

As long as you want. Sandboxes shut down automatically by default, but update_ttl lets you extend sessions or keep them running indefinitely.

Can I resume or branch an agent's environment?

Yes. Snapshot the filesystem to an image, then boot any number of new sandboxes from that state to retry runs or explore branches.

Which agent frameworks does this work with?

Any of them. The Sandbox SDK is plain Python, so LangChain tools, custom loops, or anything that can call a function can drive it.

Pay as you go
billed by the second

Give your agents their own machines

Sign up, install the CLI, and launch a sandbox, VM, or GPU from your terminal or your coding agent.