If a task's database never came up, or a sidecar died halfway through, an agent trial still produces a score. That score is wrong, and nothing tells you. Run a few thousand trials a day and those failures end up in your eval numbers and your training data.
swarmbox is the sandbox platform we built to catch those failures. Every trial gets a fresh World: a container for the agent's workspace and one for each service the task needs, on a private network, started and torn down together. If the platform can't deliver the whole World, the trial fails as an infrastructure error and gets no score.
On two sandbox nodes, 220 Harbor tasks (Harbor is an agent eval framework), run 32 at a time with images already built, finish in under 4 minutes with no infrastructure errors. A World on a 3.9 GB image is ready in half a second. Pulling that image the usual way takes 48 seconds.
The design follows DeepSeek's DSec paper, rebuilt to run on ordinary Azure VMs. Today we're also opening the hosted test bed to invited users and releasing the Python SDK and Harbor provider as open source.
What you get
- A task with an agent box, a mock API and a database is one request. The containers find each other by name. Most sandbox services hand you one sandbox at a time, and the World is what we add.
- All you need is a token. No Docker on your machine and no registry to push to: swarmbox builds the image from your task's Dockerfile and runs it. With Harbor, that is the Dockerfile already in the task's environment folder.
- Big images start fast, because nodes mount them instead of downloading them.
- Harbor tasks and agents stay as they are. You change the environment flag.
Using it
Here is a World with two Sandboxes. One serves HTTP and the other looks it up by name.
import asyncio
import swarmbox_sdk
async def main():
# Reads SWARMBOX_URL and SWARMBOX_TOKEN.
async with swarmbox_sdk.Client() as client:
world = await client.create_world(
[
swarmbox_sdk.Sandbox(
name="env",
image="docker.io/library/python:3.12-slim",
command=["python", "-m", "http.server", "8080"],
aliases=["svc.internal"],
),
swarmbox_sdk.Sandbox(
name="main",
image="docker.io/library/python:3.12-slim",
command=["sleep", "infinity"],
),
],
ttl="5m",
)
result = await world.exec("main", "getent hosts svc.internal")
print(result.exit_code, result.stdout)
await world.stop()
asyncio.run(main())create_world returns once every Sandbox is ready, or raises WorldFailed if the platform couldn't deliver it. After that you have exec, upload and download on any Sandbox by name. Every World has a time limit, so a crashed client can't leave one running.
A Harbor trial
Each Harbor trial becomes one World, and each service in the task's compose file becomes one Sandbox in it.
pip install 'swarmbox-sdk[harbor]'
export SWARMBOX_URL=https://api.swarmbox.vibrantlabs.com
export SWARMBOX_TOKEN=... # your token
harbor run -p tasks/ -a oracle -n 8 \
-e swarmbox_sdk.harbor:SwarmboxEnvironmentHere tasks/ holds the eight tasks the walkthrough downloads from the public validated-tasks dataset.
For each trial, the provider hashes the task's environment files and asks swarmbox for that image. If it exists, the trial starts at once. If it doesn't, the provider uploads the files and swarmbox builds it, and other trials of the same task wait on that one build.
On those eight tasks, the first run takes about three minutes, almost all of it image builds. The second takes under 10 seconds.
The provider accepts these compose keys: image, build, command, environment, volumes, expose, networks, healthcheck and depends_on. A task that uses anything else fails before it starts, with an error naming the key.
Numbers
Measured through the public endpoint with only a token, on two sandbox nodes, unless a row says otherwise.
| What | Result |
|---|---|
| 220 Harbor tasks, 32 at a time, images already built | 219 passed, 0 errors, under 4 minutes. The one failure is a task whose reference solution is wrong |
| The same 220 tasks, nothing built yet | 205 passed; 14 trials timed out waiting for their image build |
| Harbor environment start, median | 0.25 s |
| World ready on a 3.9 GB image | 0.5 s mounted, 48.4 s pulled |
| Create, exec, stop on a single node (an earlier build) | 20 to 23 cycles a second with 32, 128 and 256 running at once, no failures in 2,750 cycles |
Every task in these runs has one container. Worlds with several Sandboxes are what the API is built around and what our tests cover, but we haven't measured them at this scale yet.
Architecture
- API servers check your token, pick a node and forward the request. They hold no state. We run two behind a load balancer and can lose one.
- Node agents, one per sandbox node, own their Worlds end to end: networking, containers, readiness, time limits and cleanup.
- The builder runs on its own VM and turns your Dockerfile into an image.
- The image store holds built images as layers every node can mount.
What we took from DSec, and what we swapped
swarmbox is modeled on DeepSeek Elastic Compute (DSec), DeepSeek's system for running RL rollouts at large scale. We kept three of its ideas:
- Placement is stateless and the node is the source of truth. There is no central database of sandboxes to fall behind when thousands start and stop.
- Images load lazily. A node mounts an image from shared storage and fetches only the blocks a task reads.
- The client is a small async library, so one rollout loop can hold hundreds of Sandboxes open.
DSec's design leans on infrastructure you can't rent: 3FS (DeepSeek's own filesystem, on dedicated storage servers) and a patched Docker daemon. We run on ordinary cloud VMs, so those parts differ, and we made a few choices of our own.
| DSec | swarmbox |
|---|---|
| 3FS on dedicated storage servers | JuiceFS: data in Azure Blob Storage, metadata in Azure Managed Redis, a block cache on each node's local NVMe |
| Patched dockerd | Stock containerd, driven directly by our node agent |
| Sandbox as the unit | World as the unit: Sandboxes with one network and one lifecycle |
| Function calls, containers, microVMs, full VMs | Containers, with gVisor as an option |
One request
A World's ID looks like <node>.<key>. To route a later request, an API server reads the ID.
World state lives on the node. Each node agent writes a small record per World to its own disk. When we deploy a new agent it restarts, reads its records and picks its running Worlds back up, and the containers keep running throughout.
We don't use Kubernetes. Thousands of short-lived container groups an hour is the kind of churn that saturates its control plane. The cost of leaving it out is that per-World networking, DNS names, health checks and placement are ours to maintain.
Lazy images
Starting a container normally means downloading the whole image, unpacking it, then running. For a 4 GB task image that is most of a minute, paid again on every node that hasn't seen it. The paper reports that tasks read only 4% to 13% of their images, and that pulling images whole made a burst of 8,192 containers take 1.71 times as long as with lazy loading.
So we convert each image layer once into an EROFS file (a read-only format the Linux kernel mounts directly) and keep it in the image store. A node mounts those files in milliseconds, puts a private writable layer on top and starts the container. A read fetches only the blocks it touches, and those blocks stay in a cache on the node's NVMe.
Time until the World is ready, one World per image:
| Image, unpacked | Pulled whole (node had never seen it) | Mounted lazily |
|---|---|---|
| 3.9 GB | 48.4 s | 0.5 s |
| 2.7 GB | 31.4 s | 0.6 s |
| 1.8 GB | 20.0 s | 0.1 s |
Lazy loading moves the cost to the first read. Our worst-case first command (start Python, import five modules, list all of /usr) took about 10 seconds with an empty cache. So nodes warm their cache with the store's layers shortly after they start, and that command drops to under a second. The paper rejects warming because it only moves the cost earlier. At DeepSeek's size that is right. At ours every node can still hold every layer, so we pay once in the background. When the store outgrows a node's disk, we'll need to warm selectively.
We also added a fallback the paper doesn't describe. If the image store is unhealthy, or an image hasn't been converted yet, the node pulls the image whole and the World still starts.
Image builds
You upload a build context, and the builder builds the image, pushes it and converts it for lazy loading. Each user's builds run in their own instance of BuildKit (Docker's build engine), on a network that reaches the internet and nothing private. Each user has their own repository, so one user can't replace another's image.
Admission and placement
Rollout workloads are mostly idle. The paper reports that about 90% of DSec's sandboxes use no more than 5% of the CPU they ask for, and in our load test a running trial used about an eighth of a CPU. So a node accepts more Worlds than its core count suggests, within two limits. It checks both before it accepts a World:
- What has been promised. Declared CPUs may add up to 8 times the node's real CPUs, and declared memory to 2 times its real memory. This is a backstop for a burst that arrives before any load shows.
- What is happening now. The kernel reports the share of the last 10 seconds in which a process was waiting for a CPU. Above 13%, the node refuses. It also refuses if the new World would leave less than 10% of memory free.
A node only refuses new Worlds. It never throttles or evicts a running one. An overloaded node skews timing-sensitive evals, and one that runs out of memory kills Sandboxes in Worlds that were otherwise fine.
A new World goes to the less loaded of two healthy nodes picked at random. When a node refuses, the API server tries another. If none has room you get 503 no capacity, which the Harbor provider retries for up to 5 minutes.
Isolation and limits
Sandboxes run model-written commands and whatever packages a task pulls in. We treat that code as unvetted. The DSec paper is frank about what goes wrong: an agent's system call shut down a filesystem, reading one file under /proc crashed the kernel, and yes filled tens of gigabytes with output. Its stronger boundaries are microVMs and full VMs. Our nodes are already cloud VMs, so a microVM would be nested and slow. We hardened containers instead:
- The default runtime is runc with seccomp (a syscall filter), user namespaces (root in a Sandbox is not root on the node), a process limit and no new privileges.
- gVisor, a userspace kernel that sits between the container and the host, can be switched on per user with no change on their side. It needs no nested virtualization. On our 220-task sample it took about 40% longer end to end, and one task failed only under it.
- Each Sandbox's egress (outbound internet access) is
noneorpublic. Sandboxes in a World always reach each other, Worlds never do, and new outbound connections are capped at 100 a second. - Each Sandbox's writable layer has a 20 GiB quota, enforced by the filesystem on the node's local NVMe. Each output stream of a command is capped at 16 MiB.
- A World belongs to the user who created it. Anyone else gets a
404.
Known limitations
- The first run of a large task set is slow. Every new image has to be built, and builds queue. On the cold 220-task run above, 14 trials hit Harbor's 10-minute start timeout.
- A Sandbox sees the node's CPU count and memory, not its own limits. The limits are enforced, but
nprocis wrong, so tools that size themselves by CPU count start too many workers. - The code for per-user limits exists, but none are configured. Today only node admission bounds what one user can run.
- Containers share the node's kernel unless a user is on gVisor. There are no microVMs, GPUs, pause and resume, or snapshots.
- The platform itself is not open source today.
What's next
- Per-user limits on live Worlds, CPUs and create rate.
- A correct view of CPU and memory inside a Sandbox.
- More build capacity, so first runs stop queueing, and cleanup of images nobody uses.
- Load tests at 500 concurrent trials, then a burst past 5,000, with a written report of where it breaks.
Try it
The test bed is invite-only. To get a token, follow the first step of the walkthrough: tell us who you are and what you plan to run, and we'll send one over a private channel.
The SDK, the Harbor provider and the docs are Apache-2.0 at github.com/vibrantlabsai/swarmbox.
swarmbox was called opendsec until this release. The package is now swarmbox-sdk.