Why Container Isolation?
When an AI agent executes shell commands on your machine, it has the same file access as your user account — it can read~/.ssh, delete files in ~/Documents, or modify system configs. This is unacceptable for a production tool.
Zeus solves this with container isolation: when you select a working directory on Desktop, all commands execute inside an isolated Linux container. The container can only see that one directory, mounted at /workspace. Everything else on your machine is invisible and unreachable.
Architecture Overview
Zeus has two distinct execution environments depending on where you use it:sandbox_mode field in the API request controls which path is taken:
| Mode | Environment | When Used |
|---|---|---|
cloud | Remote cloud sandbox (E2B / OpenSandbox / Daytona) | Web users; default for all requests |
local | Local container on your machine | Desktop users with a working directory selected |
none | No code execution at all | Pure chat mode; no sandbox tools are injected into the agent |
sandbox_mode is "local", the cloud sandbox is completely bypassed — no remote VM is provisioned, no sandbox tools (write/read/edit/bash) are injected. Instead, the agent uses desktop_exec routed through a local container.
How local Mode Works End-to-End
Here is the complete data flow when a Desktop user sends a message with a working directory:
System Prompt Injection
Whensandbox_mode == "local", the backend injects this into the agent’s system prompt:
/etc/passwd, the container filesystem doesn’t have it.
Container Runtimes
Zeus Desktop detects runtimes at startup in priority order. The result is cached for the session.1. Apple Containerization (Preferred)
Available on macOS 26+ (Tahoe) with Apple Silicon. How it works: Unlike Docker, which shares the host’s Linux kernel via namespaces, Apple Containerization runs each container in its own micro-VM — a lightweight virtual machine with a dedicated Linux kernel, managed by Apple’s Virtualization.framework.- Isolation: VM-level. Even a kernel exploit inside the container cannot reach the host.
- Directory sharing via virtiofs: Apple’s implementation of the virtio-fs protocol. The host exposes a directory to the guest VM over a virtio transport. Inside the VM, it appears as a regular mount at
/workspace. Reads and writes are passed through in real-time, but the guest cannot navigate outside the shared directory. - Performance: Near-native. virtiofs uses shared memory regions (DAX) and avoids the 9p protocol overhead that plagued early Docker for Mac file sharing.
- Startup: Sub-second. The micro-VM boots a minimal Linux kernel optimized for fast start.
- OCI compatible: Uses standard OCI container images — the same Dockerfile works for both Docker and Apple Containerization.
container --version with a 3-second timeout.
2. Docker (Fallback)
Available on macOS, Windows, and Linux. Requires Docker Desktop (or Docker Engine on Linux). How it works: Docker uses Linux namespaces and cgroups to isolate processes. On macOS, Docker Desktop runs a hidden Linux VM (using Apple Virtualization.framework under the hood), and containers run inside that shared VM.- Isolation: Container-level (namespace isolation). All containers share the same Linux kernel inside Docker’s VM. A kernel exploit could compromise other containers.
- Directory sharing via bind mount: The
-v host:containerflag maps a host directory into the container’s filesystem. Docker Desktop uses virtiofs (on macOS 12.5+) or gRPC-FUSE to bridge between the macOS host and the Linux VM. - Performance: Good. Bind mounts with virtiofs backend (Docker Desktop 4.15+) approach native speed. Older gRPC-FUSE backend was significantly slower for
node_modules-heavy workloads. - Startup: ~1-2 seconds for the container (the VM is already running).
- OCI compatible: Standard Docker images.
docker info with a 5-second timeout.
3. No Runtime Available
If neither runtime is detected, Zeus refuses to execute any commands whenworking_directory is set. The error message returned to the agent is:
“No container runtime detected. Please install Docker Desktop or upgrade to macOS 26 for Apple Containerization.”This is a deliberate design choice — there is no soft-isolation fallback. We do not attempt to restrict paths via
cwd or shell tricks, because those can be trivially bypassed (cd /, symlinks, $HOME expansion, etc.).
Comparison: Apple Containerization vs Docker
| Aspect | Apple Containerization | Docker |
|---|---|---|
| Isolation boundary | VM (dedicated kernel) | Namespace (shared kernel) |
| Kernel exploit risk | Contained to micro-VM | Could affect all containers |
| Directory sharing protocol | virtiofs (native) | virtiofs via Docker Desktop |
| macOS version required | 26+ (Tahoe) | 12+ |
| Cross-platform | Apple Silicon only | macOS, Windows, Linux |
| Startup time | under 1s | ~1-2s |
| Image format | OCI | OCI |
| Runtime detection | container --version | docker info |
Container Lifecycle
Zeus manages one container per session:- Start: When the first
desktop_execcommand arrives withworking_directory, Zeus detects the runtime, creates a container (docker run -dorcontainer run -d), and bind-mounts the directory. - Exec: Subsequent commands are sent to the running container via
docker exec/container exec. - Reuse: If a container for the session already exists and is running, it is reused.
- Stop: When the session ends (or the Desktop app closes), the container is removed (
docker rm -f/container rm -f).
sleep infinity as its entrypoint — it stays alive until explicitly stopped.
The Sandbox Image
Both runtimes use the same OCI image:zeus-desktop-sandbox:latest.
Contents (defined in apps/desktop/docker/Dockerfile):
- Base: Ubuntu 22.04
- Languages: Python 3 + pip + venv, Node.js 22 LTS + npm + pnpm
- Tools: git, curl, wget, jq, build-essential (gcc, make, etc.)
- Working directory:
/workspace
IMAGE_NAME constant in the sandbox implementation.
Security Model Summary
Zeus applies defense in depth with three layers:| Layer | Mechanism | Enforced By |
|---|---|---|
| 1. LLM instruction | System prompt says “only access /workspace” | AI model compliance |
| 2. Container filesystem | Only /workspace is mounted; host paths don’t exist | Container runtime (kernel) |
| 3. No fallback | If no container runtime exists, execution is refused entirely | Application logic |
Installation Guide
Docker Desktop
- Download from docker.com/products/docker-desktop
- Install and start Docker Desktop
- Verify: run
docker infoin terminal — should show server version and storage driver - Build the image:
docker build -t zeus-desktop-sandbox:latest apps/desktop/docker/
Apple Containerization (macOS 26+)
- Upgrade to macOS 26 (Tahoe) or later
- The
containerCLI is included with the OS (part of the Containerization framework) - Verify: run
container --versionin terminal - Build the image:
container build -t zeus-desktop-sandbox:latest apps/desktop/docker/