Skip to content

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.

Your agentSDK, CLI or MCPone Linux machineboxfork daemonone binary, one state filegVisor: its own kernelsandbox$ python3 hello.pyhellofork 1/work/hello.pysame filesfork 2/work/hello.pysame files
  1. Ask. Your agent asks the daemon for a sandbox.
  2. Isolate. The daemon starts it behind gVisor.
  3. Run. The code runs, and the output comes back.
  4. Fork. A snapshot makes copies with the same files.

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.

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.

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.

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 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.

  1. Your agent sends POST /v1/sandboxes with an image. The daemon creates a container under gVisor and returns the ID.
  2. Your agent sends a command. The daemon gives it to the helper in the sandbox.
  3. The helper runs the command and sends back the output and the exit code.
  4. When your agent is done, it kills the sandbox. If it forgets, the timeout kills it.
  • 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.