How it works
boxfork has four parts: the daemon, the gVisor wall, the sandbox and the helper. This page tells you what each part does, and why.
- Ask. Your agent asks the daemon for a sandbox.
- Isolate. The daemon starts it behind gVisor.
- Run. The code runs, and the output comes back.
- Fork. A snapshot makes copies with the same files.
The daemon
Section titled “The daemon”The daemon is one program, boxfork serve. It is the only process that runs all the time.
- It serves the HTTP API. Each client sends the API key with each request.
- It owns all sandboxes on one machine.
- It controls the container engine through the Docker Engine API. The engine is Docker, or Podman.
- It keeps its records in one JSON file. There is no database.
The CLI, the Python SDK, the TypeScript SDK, the MCP server and your own code are all clients of the same API. The daemon never calls a model.
The gVisor wall
Section titled “The gVisor wall”Each sandbox runs under gVisor. gVisor gives each sandbox a kernel of its own that runs as a program. The system calls of the code in a sandbox go to that kernel, not to the kernel of your machine.
At its start, the daemon makes sure that gVisor works. If gVisor is not installed, the sandboxes are plain containers, and the daemon tells you this. The security model tells you what the wall protects and what it does not protect.
The sandbox
Section titled “The sandbox”One sandbox is one container. A sandbox has:
- an image, for example
python:3.12, or a snapshot to start from - CPUs, memory, and zero or more whole GPUs
- a timeout. When the timeout ends, the daemon kills the sandbox.
- a network, or no network with
--no-network
On Docker, a sandbox cannot reach the other sandboxes. A rule in the firewall keeps it away from the metadata service of the cloud.
The helper
Section titled “The helper”The daemon puts a small program, the helper, in each sandbox. The helper runs the commands and moves the files.
The daemon does not open a network connection into a sandbox. It starts the helper through the engine, and talks to it on standard input and standard output. Thus a sandbox with no network works fully, and the daemon publishes no port of a sandbox.
For the first command, the engine starts the helper. The daemon keeps that connection open: the kept connection. The next commands go through it. On the test machine, a command after the first took a median of 4 ms, and 13 ms without the kept connection.
The life of one command
Section titled “The life of one command”- Your agent sends
POST /v1/sandboxeswith an image. The daemon creates a container under gVisor and returns the ID. - Your agent sends a command. The daemon gives it to the helper in the sandbox.
- The helper runs the command and sends back the output and the exit code.
- When your agent is done, it kills the sandbox. If it forgets, the timeout kills it.
Read more
Section titled “Read more”- Concepts: one short page for each idea, from a sandbox to a cluster.
- Architecture: each process, each request and each lock, with diagrams.
- Design decisions: the reason and the cost of each choice.