← manishpande.in Contents
Reference architecture · 2026 The Agentic Platform by Manish Pande
© 2026 Manish Pande Mumbai, India Set in Space Grotesk · Source Serif 4 · JetBrains Mono
ACT · Action Plane Chapter 9

Sandboxed Execution

The most powerful tool you can give an agent is the ability to write and run code. It is also the most dangerous. Model-generated code is untrusted by construction — it may be wrong, it may be adversarially injected, and it will sometimes try to do exactly what you fear. Running it anywhere near your infrastructure is unacceptable. This chapter is about the isolation layer that lets agents execute arbitrary code without putting the platform at risk.

9.1 Why a sandbox is non-negotiable

Reason from the threat model. Code an agent emits can read secrets from the environment, exfiltrate data over the network, consume unbounded CPU or memory, escape into the host, or pivot to other tenants. A coding agent will routinely pip install packages, write files, and spawn processes. The only safe assumption is that execution is hostile, so it must occur in an environment that is isolated (no access to host or other tenants), ephemeral (destroyed after use, no persistence of compromise), resource-bounded (hard CPU/memory/time limits), and network-controlled (egress denied or allow-listed).

First principle · Treat all agent-generated code as hostile

Never execute model output in a context that shares a trust boundary with your platform, your secrets, or another tenant. Isolation is not a feature you add for untrusted users — it is the default posture for every line of code an agent runs.

9.2 The isolation spectrum

Isolation techniques trade security strength against startup latency and overhead. Heavier boundaries are harder to escape but slower to spin up — and an agent may create many short-lived sandboxes, so cold-start time is a first-class concern.

weaker isolation · faster start stronger isolation · slower start Containershared kernel gVisoruser-space kernel microVM (Firecracker)own kernel · ~125ms Full VMhardware virt
Fig 9.1 · The isolation spectrum. Containers share the host kernel (a single escape compromises the host). gVisor interposes a user-space kernel to shrink that surface. microVMs like Firecracker give each sandbox its own kernel with VM-grade isolation yet boot in ~125 ms — the sweet spot for agent code execution, and what most managed sandboxes use underneath.

9.3 Build on a managed sandbox or run your own

You can assemble isolation yourself from Firecracker or gVisor, or adopt a managed sandbox that exposes a simple "run this code, get the result" API while handling microVM provisioning, snapshotting, and teardown. For most teams the managed route is right; reserve self-hosting for when data-residency or cost at very high volume demands it.

Table 9.1 — Code-execution sandboxes for agents (representative)
OptionIsolationModelNotable for
E2BFirecracker microVMManaged/self-hostable sandbox SDKPurpose-built for AI code interpreters; fast start, persistent sessions
ModalgVisor / containerServerless compute platformCode + GPU workloads, scale-to-zero, Python-native
DaytonaContainer / VMManaged dev/agent sandboxesFast ephemeral environments for agent workspaces
FirecrackermicroVM (build-your-own)Open-source VMMThe primitive under many managed offerings; max control
gVisorUser-space kernelOpen-source runtime (runsc)Container-like UX with a much smaller kernel attack surface
Hazard · Egress is the exfiltration path

Strong process isolation is undone if the sandbox can reach the open internet: that is how injected code ships your data out. Default to no network; allow-list only the specific hosts a task needs. Combine with a per-sandbox secret scope — never mount platform-wide credentials into an environment running model-written code.

· · ·