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.
What you can do with a sandbox
Section titled “What you can do with a sandbox”- 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) # 42What a sandbox gets
Section titled “What a sandbox gets”| 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.
What a sandbox cannot do
Section titled “What a sandbox cannot do”- 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.