{"slug": "lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud", "title": "Lessons from running DeepSeek's DSec sandbox design on public cloud", "summary": "A sandbox platform called swarmbox, built by Vibrant Labs to follow DeepSeek's DSec paper on ordinary Azure VMs, ran 220 Harbor agent-eval tasks 32 at a time on two sandbox nodes with images pre-built and finished in under 4 minutes with 219 passes and 0 infrastructure errors — the single failure being a task whose reference solution is wrong. The same 220 tasks with nothing built yet produced 205 passes and 14 timeouts waiting on image builds, while a World on a 3.9 GB image was ready in 0.5 seconds when mounted versus 48.4 seconds when pulled. Vibrant Labs is opening the hosted test bed to invited users and releasing the Python SDK and Harbor provider as open source, with the platform's premise that a trial missing a database or sidecar must fail as an infrastructure error rather than silently produce a wrong score.", "body_md": "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.\n\nswarmbox 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.\n\nOn two sandbox nodes, 220 [Harbor](https://github.com/harbor-framework/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.\n\nThe 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.\n\n## What you get\n\n- 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.\n- 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.\n- Big images start fast, because nodes mount them instead of downloading them.\n- Harbor tasks and agents stay as they are. You change the environment flag.\n\n## Using it\n\nHere is a World with two Sandboxes. One serves HTTP and the other looks it up by name.\n\n`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.\n\n### A Harbor trial\n\nEach Harbor trial becomes one World, and each service in the task's compose file becomes one Sandbox in it.\n\nHere `tasks/` holds the eight tasks the [walkthrough](https://swarmbox.vibrantlabs.com) downloads from the public [validated-tasks](https://huggingface.co/datasets/FWeindel/validated-tasks) dataset.\n\nFor 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.\n\nOn those eight tasks, the first run takes about three minutes, almost all of it image builds. The second takes under 10 seconds.\n\nThe 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.\n\n## Numbers\n\nMeasured through the public endpoint with only a token, on two sandbox nodes, unless a row says otherwise.\n\n| What | Result | \n|---|---|\n| 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 | \n| The same 220 tasks, nothing built yet | 205 passed; 14 trials timed out waiting for their image build | \n| Harbor environment start, median | 0.25 s | \n| World ready on a 3.9 GB image | 0.5 s mounted, 48.4 s pulled | \n| 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 | \n\nEvery 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.\n\n## Architecture\n\n- **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.\n- **Node agents** , one per sandbox node, own their Worlds end to end: networking, containers, readiness, time limits and cleanup.\n- **The builder** runs on its own VM and turns your Dockerfile into an image.\n- **The image store** holds built images as layers every node can mount.\n\n### What we took from DSec, and what we swapped\n\nswarmbox is modeled on [DeepSeek Elastic Compute (DSec)](https://arxiv.org/abs/2609.22978), DeepSeek's system for running RL rollouts at large scale. We kept three of its ideas:\n\n1. 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.\n2. Images load lazily. A node mounts an image from shared storage and fetches only the blocks a task reads.\n3. The client is a small async library, so one rollout loop can hold hundreds of Sandboxes open.\n\nDSec'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.\n\n| DSec | swarmbox | \n|---|---|\n| 3FS on dedicated storage servers | [JuiceFS](https://juicefs.com) : data in Azure Blob Storage, metadata in Azure Managed Redis, a block cache on each node's local NVMe | \n| Patched dockerd | Stock containerd, driven directly by our node agent | \n| Sandbox as the unit | World as the unit: Sandboxes with one network and one lifecycle | \n| Function calls, containers, microVMs, full VMs | Containers, with gVisor as an option | \n\n### One request\n\nA World's ID looks like `<node>.<key>`. To route a later request, an API server reads the ID.\n\nWorld 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.\n\nWe 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.\n\n### Lazy images\n\nStarting 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.\n\nSo 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.\n\nTime until the World is ready, one World per image:\n\n| Image, unpacked | Pulled whole (node had never seen it) | Mounted lazily | \n|---|---|---|\n| 3.9 GB | 48.4 s | 0.5 s | \n| 2.7 GB | 31.4 s | 0.6 s | \n| 1.8 GB | 20.0 s | 0.1 s | \n\nLazy 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.\n\nWe 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.\n\n### Image builds\n\nYou 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.\n\n### Admission and placement\n\nRollout 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:\n\n- **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.\n- **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.\n\nA 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.\n\nA 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.\n\n### Isolation and limits\n\nSandboxes 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:\n\n- 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.\n- 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.\n- Each Sandbox's egress (outbound internet access) is `none` or`public` . Sandboxes in a World always reach each other, Worlds never do, and new outbound connections are capped at 100 a second.\n- 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.\n- A World belongs to the user who created it. Anyone else gets a `404` .\n\n## Known limitations\n\n- 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.\n- A Sandbox sees the node's CPU count and memory, not its own limits. The limits are enforced, but `nproc` is wrong, so tools that size themselves by CPU count start too many workers.\n- The code for per-user limits exists, but none are configured. Today only node admission bounds what one user can run.\n- Containers share the node's kernel unless a user is on gVisor. There are no microVMs, GPUs, pause and resume, or snapshots.\n- The platform itself is not open source today.\n\n## What's next\n\n1. Per-user limits on live Worlds, CPUs and create rate.\n2. A correct view of CPU and memory inside a Sandbox.\n3. More build capacity, so first runs stop queueing, and cleanup of images nobody uses.\n4. Load tests at 500 concurrent trials, then a burst past 5,000, with a written report of where it breaks.\n\n## Try it\n\nThe test bed is invite-only. To get a token, follow the first step of the [walkthrough](https://swarmbox.vibrantlabs.com): tell us who you are and what you plan to run, and we'll send one over a private channel.\n\nThe SDK, the Harbor provider and the docs are Apache-2.0 at [github.com/vibrantlabsai/swarmbox](https://github.com/vibrantlabsai/swarmbox).\n\n*swarmbox was called opendsec until this release. The package is now `swarmbox-sdk`.*", "url": "https://wpnews.pro/news/lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud", "canonical_source": "https://vibrantlabs.com/research/swarmbox", "published_at": "2026-11-25 20:01:20+00:00", "updated_at": "2026-11-25 20:12:19.824692+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-infrastructure", "mlops"], "entities": ["swarmbox", "Vibrant Labs", "DeepSeek", "DSec", "Harbor", "Azure", "Python SDK"], "also_reported_by": [], "takeaway": "Mount pre-built task images on sandbox nodes instead of pulling them: a World on a 3.9 GB image was ready in 0.5 seconds mounted versus 48.4 seconds pulled, and 220 pre-built Harbor tasks ran 32 at a time in under 4 minutes with 0 infrastructure errors.", "recommendation": {"advice": "Fail agent trials as infrastructure errors when any container in the task's World can't start, and pre-build and mount task images so eval runs aren't polluted by silent environment failures.", "playbook": "evals-testing", "playbook_url": "https://wpnews.pro/playbooks/evals-testing"}, "alternates": {"html": "https://wpnews.pro/news/lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud", "markdown": "https://wpnews.pro/news/lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud.md", "text": "https://wpnews.pro/news/lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud.txt", "jsonld": "https://wpnews.pro/news/lessons-from-running-deepseek-s-dsec-sandbox-design-on-public-cloud.jsonld"}}