Skip to content

Sandbox

A sandbox is an isolated Linux environment in which a client runs commands. One sandbox is one container. An agent can damage a sandbox without risk to your data.

sandboxcode from the modelopen, read, write, connectgVisora kernel as a programfew callsLinux kernel of your machineYour dataother sandboxes, the daemon,the metadata servicewall
Code in a sandbox talks to gVisor, not to the kernel of your machine. A bug or an attack in the code meets gVisor first.
  • Create it from an image, for example python:3.12, or from a snapshot.
  • Run commands in it, and read the output and the exit code.
  • Read and write its files.
  • Snapshot it and fork it.
  • Pause it and resume it.
  • Kill it.
from boxfork import Sandbox
with Sandbox.create("python:3.12", timeout=600) as sbx:
print(sbx.run("python3 -c 'print(6 * 7)'").stdout) # 42
Item Default How to change it
Image ubuntu:24.04 --image, or --snapshot
Life 5 minutes, then the daemon kills it --timeout 30m. --timeout 0 never ends.
GPUs none --gpu 1 gives one whole GPU. See GPUs.
Network the internet, but not the other sandboxes on Docker --no-network
Isolation gVisor, if it is installed Install gVisor with the installer.

The daemon gives these defaults. A person who runs the daemon can change them, see the configuration reference.

  • It cannot reach the metadata service of a cloud machine. A rule in the firewall blocks it.
  • On Docker, it cannot reach the other sandboxes.
  • It cannot run Docker.

A sandbox can reach the services that listen on the machine itself, on more than 127.0.0.1. The security model gives each boundary, and what is not protected.