Sandboxed Agent Runtimes¶
Den is a good candidate foundation for agent sandboxes because it can make the runtime boring: a locked conda package graph, a repeatable root filesystem, and artifact receipts that explain what was executed. Den is not, by itself, the sandbox boundary. The boundary must come from the runtime used to execute the Den image: a hardened container, gVisor, Kata Containers, or a microVM.
Use this framing when evaluating agent work:
Need |
Den contribution |
Sandbox contribution |
|---|---|---|
repeatable tools |
conda workspace lock, Den package channel, |
image digest and runtime config |
bounded filesystem |
rootfs layout, app env convention under |
read-only root, workspace mount policy, tmpfs |
bounded network |
default conda channel policy, no secrets in rootfs |
default-deny network or egress proxy |
bounded resources |
package/runtime selection |
cgroups, VM sizing, timeout and process limits |
auditability |
Den in-toto artifact receipts |
execution receipt binding inputs, policy, command, outputs |
What Existing Agent Sandboxes Suggest¶
Current agent sandbox systems converge on the same basic product shape:
an API or CLI that creates a sandbox,
a filesystem workspace the agent can mutate,
a command execution API with streamed output,
lifecycle operations such as start, stop, pause, resume, snapshot, and delete,
resource limits,
network policy,
and a stronger isolation backend for untrusted code.
E2B presents the sandbox as an isolated environment where agents can execute code, process data, and run tools. Its public API shape is intentionally small: create a sandbox, run commands, inspect results.
Daytona emphasizes fast, stateful sandboxes with programmatic process execution, file operations, runtime configuration, snapshots, and persistent agent state.
Kubernetes Agent Sandbox is useful precedent even if Den does not start on Kubernetes. It treats an agent runtime as a singleton, stateful sandbox with stable identity, persistent storage, and pluggable isolation. Its docs call out gVisor and Kata Containers as runtime choices, which is the right abstraction boundary: lifecycle API separate from isolation technology.
Docker Sandboxes is another signal that agent environments are moving toward microVM-backed local development. The useful product promise is that each agent gets its own daemon, filesystem, and network, so it can install packages and build containers without touching the host.
Codex and Claude Code point at a separate but important local-agent lesson: sandboxing and approval are different controls. OpenAI’s Codex docs describe the sandbox as the technical boundary around spawned commands, while approvals govern boundary crossings. Anthropic’s Claude Code sandboxing writeup is especially direct: effective sandboxing needs both filesystem isolation and network isolation. Without both, prompt injection can still modify sensitive files or exfiltrate secrets.
Isolation Options¶
Hardened Container¶
Support level: runnable today.
Den publishes registry.den-os.org/den-agent:2026.6 as the agent runtime image.
The Docker and Podman backends can use that image for local execution with:
a read-only root filesystem,
one read-only workspace mount,
one writable output mount,
--network noneby default,--cap-drop ALL,--security-opt no-new-privileges,memory, CPU, and PID limits,
no Docker socket,
no host home directory,
no ambient credentials.
This is the quickest prototype path. It is not a hard multi-tenant boundary against adversarial workloads because containers share the host kernel and the Docker daemon is a powerful root-equivalent control plane unless rootless mode is used. Docker’s own security docs warn that controlling the Docker daemon can allow arbitrary host filesystem mounts, and Docker documents rootless mode as a way to reduce daemon and runtime risk.
Use this for:
local experiments,
trusted or semi-trusted agents,
CI-style smoke tests,
first Den sandbox UX.
Do not present this as sufficient for arbitrary hostile code.
gVisor¶
Support level: prototype-ready on Linux.
gVisor provides an OCI runtime named runsc and puts a userspace application
kernel between the container and the host kernel. That makes it a strong next
step after Docker hardening while still using OCI images. Kubernetes Agent
Sandbox also treats gVisor as a one-field runtime choice through
runtimeClassName: gvisor.
For Den, gVisor is attractive because the packaging story stays OCI-shaped:
Den conda graph -> Den rootfs -> OCI image -> runsc runtime
The prototype should make gVisor optional rather than mandatory because local macOS/OrbStack development may not expose the same runtime controls as a Linux host.
Kata Containers¶
Support level: blueprint.
Kata Containers runs workloads with a dedicated guest kernel while retaining OCI and Kubernetes compatibility. It is a better fit once Den wants a Kubernetes story or a standardized OCI runtime that maps each sandbox to a VM.
For Den, Kata is less direct than gVisor for a first local prototype, but it is a credible target if the runtime needs stronger isolation while still fitting container orchestrator interfaces.
Firecracker Or QEMU MicroVM¶
Support level: implemented as the reference Den sandbox backend.
Firecracker is the clearest microVM precedent for high-density untrusted code: one VMM process per microVM, a REST API, rate limiters, metadata service, and a jailer that adds Linux userspace isolation around the VMM. Firecracker requires Linux with KVM access, so it is not the first local macOS path.
QEMU’s microvm machine type is inspired by Firecracker and is designed for
short-lived guests. It may be useful later for linux-64 work, but it has
hardware and boot limitations that do not match Den’s current UEFI path
directly.
Den now uses these building blocks for the QEMU sandbox backend:
Buildroot kernel and initramfs,
rootfs ext4 image,
OCI image unpacking into an ephemeral rootfs image,
read-only input ext4 disk,
writable output ext4 disk,
systemd inside the guest,
receipts for generated artifacts.
The Den-native microVM path launches a booted Den image, passes a job through a
read-only input disk, runs den-sandbox-runner.service inside the guest, writes
outputs to a separate output disk, captures serial logs, and powers off. This is
the baseline for hostile-code isolation because the command runs behind a
separate guest kernel.
Process Sandboxes¶
Support level: research.
Tools such as bubblewrap and nsjail use Linux namespaces, filesystem views, resource limits, and seccomp filters around a process. They are useful for per-command isolation and may be a good fit inside a Den container or Den VM.
They should not replace the outer sandbox boundary for hostile code. They are best treated as defense in depth or as a local low-overhead mode where the trust level is lower-risk.
Den Sandbox Shape¶
The user-facing command is den sandbox.
den sandbox run \
--backend qemu \
--image registry.den-os.org/den-agent:2026.6 \
--workspace . \
--output build/sandbox-output \
--network none \
--memory 4g \
--cpus 2 \
--timeout 1200 \
-- python -m pytest
Inputs:
a published and signed Den agent OCI image once the release is promoted,
workspace directory,
command argv,
output directory,
network policy,
resource policy,
timeout.
The container backends use the same command shape with --backend docker,
--backend podman, or --backend apple-container. They are for local
convenience, not the hostile-code security baseline.
The QEMU backend is the reference execution path:
Resolve and unpack the OCI image.
Create an ephemeral ext4 root disk from the OCI rootfs.
Hash the workspace input tree.
Create a read-only input ext4 disk containing the workspace and
job.json.Create a writable output ext4 disk.
Boot QEMU with
den.sandbox=run.Run
den-sandbox-runner.serviceinside the guest.Write
result.jsonandstdout.logto/output.Power off.
Extract the output disk.
Write and verify
sandbox.receipt.json.
Firecracker can come later on Linux hosts once Den has a smaller direct-kernel boot profile and a tested KVM host path.
Execution Receipt¶
Den reuses its in-toto Statement direction for sandbox execution receipts. The receipt is not a signature. It is a structured, offline-verifiable record of what was run.
Minimum predicate fields:
kind = "sandbox-execution",backend = "qemu" | "docker" | "podman" | "apple-container",imageand image digest when available,workspace input tree digest,
argv list,
environment allowlist,
network policy,
resource policy,
timeout seconds,
exit code,
output tree digest.
Verification should check:
no absolute host paths in recorded mounts,
no
..traversal,workspace input digest matches what was mounted,
output digests match,
Den image digest or artifact receipt digest matches,
backend policy is one of the supported policies.
Security Boundaries¶
In scope for the prototype:
prompt-injected commands trying to modify files outside the workspace,
accidental destructive commands,
network exfiltration attempts in default-deny mode,
runaway CPU, memory, process, or disk usage,
dependency drift inside the agent runtime image.
Out of scope for the first prototype:
strong multi-tenant isolation on Docker alone,
malicious kernel exploits,
GPU isolation,
browser or GUI computer-use sandboxes,
confidential computing,
side-channel resistance,
a hosted sandbox control plane,
secrets inside the sandbox.
Secrets should not be injected into the sandbox for the prototype. Git access should eventually use a broker outside the sandbox, following the pattern of scoped proxy-mediated credentials rather than placing long-lived tokens in the guest.
Prototype Exit Criteria¶
The prototype is credible when these pass:
registry.den-os.org/den:2026.6andregistry.den-os.org/den-agent:2026.6are published, signed multi-platform images.den sandbox run --backend docker --network none ...runs inside/workspaceand writes to/output.den sandbox run --backend qemu --network none ...boots a Den guest, runs one job through systemd, copies outputs back, and writes a receipt.Attempts to write outside
/workspace,/output,/tmp, and/runfail.Attempts to access the network fail by default.
CPU, memory, PID, and timeout limits are enforced.
No host credentials are mounted.
An execution receipt records the image, input tree, command, policy, and output digests.
On a Linux host with gVisor installed, the same image can run with
runsc.
Why Den Is Interesting Here¶
Den should not try to compete with sandbox orchestrators first. The useful prototype is a reproducible runtime image and provenance layer that can run under several sandbox backends.
That gives Den a sharp role:
conda-native agent tool stacks,
exact package and channel provenance,
one image path that can become OCI, QEMU, or UEFI,
receipts for image and execution artifacts,
future generation updates for long-lived sandboxes.
The prototype should stay small: one Python/code-agent runtime, one no-network execution path, one output directory, one receipt. Add snapshots, warm pools, Git brokers, browser sandboxes, and Kubernetes integration only after that base loop is boring.