Markdown Editor

Agent Code Execution Sandbox System Design Template

Code execution sandbox for agents: microVM vs gVisor vs containers, egress proxy, credential broker, quotas, snapshot restore, warm pools, abuse detection

System DesignFullFirecracker (NSDI 2020); OWASP Agentic Top 10 2026 (ASI05)designagentsandboxexecution

How to use: Use it when agents or assistants must run code that an attacker may have chosen through prompt injection. Fill the isolation choice (7.2) and the concurrency and warm pool estimates (3.2, 3.3) first. The main pitfall is cloning secrets or randomness through snapshots and pools: take base snapshots before any secret exists and reseed after restore.

Preview

System Design: [Code execution sandbox name]

Reference design for a multi-tenant sandbox service that runs code written or chosen by AI agents and users: the isolation choice (microVMs, gVisor or hardened containers), egress control, the sandbox filesystem, resource quotas, snapshot and restore, warm pools and cold start, secrets handling and abuse prevention. It is the execution backend for the Agent Orchestration Platform System Design Template (system-design/design-agent-orchestration-platform) and for chat assistants with a code tool. The isolation model draws on the published Firecracker design (Agache et al., NSDI 2020). It follows the 12-section structure of the System Design Document Template (system-design/system-design-document) and is pre-filled with a worked design to adapt. Replace every [bracketed] value and every row marked Example; all numbers are illustrative, not benchmarks.

Document control

FieldValue
Document ID[SDD-SBX-001]
System / feature[Agent code execution sandbox]
Version[0.1]
Status[Draft / In review / Approved / Implemented / Superseded]
Owner[@owner]
Approvers / reviewers[@reviewer-1], [@reviewer-2]
Last updatedYYYY-MM-DD
Classification[Internal / Confidential]
Isolation technology[microVM (VMM name and version) / gVisor / hardened containers]
Host kernel and hardware[Kernel version, CPU family, virtualisation support]
Related[Agentic threat model], [Agent tool permission design], [Zero trust plan], [Incident response plan]

Approvals

RoleNameDecisionDate
Tech lead, sandbox[@name][Approved / Changes requested]YYYY-MM-DD
Staff / principal engineer[@name][Decision]YYYY-MM-DD
Security architecture[@name][Decision]YYYY-MM-DD
SRE / operations[@name][Decision]YYYY-MM-DD
Trust and safety[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft for design review
0.2YYYY-MM-DD[@name]Example: Moved from containers to microVMs for untrusted code
0.3YYYY-MM-DD[@name]Example: Added snapshot restore with post-restore reseeding
1.0YYYY-MM-DD[@name]Example: Approved

Contents

1. Overview

1.1 Problem statement

[Example: Agents and the assistant's code tool run Python in Docker containers on shared Kubernetes nodes. The containers share the host kernel, can reach the internal network and the cloud metadata endpoint, and a recent red-team exercise read another tenant's files through a misconfigured volume. Starting a container with the data-science image takes 6 to 10 seconds, so teams keep long-lived containers per user, which leak state between tasks. Two cryptocurrency-mining incidents ran for hours before anyone noticed.]

1.2 Proposed solution

[Example: A sandbox service that gives each session its own microVM with a minimal device model, started from a pre-booted snapshot or taken from a warm pool. Each microVM runs an execution agent that accepts commands and file operations over a vsock channel. The guest has no route to internal networks or metadata endpoints; outbound traffic goes through an egress proxy that applies the tenant's allow-list. Secrets never enter the guest: calls that need credentials go through a broker outside the VM. Every session has CPU, memory, disk, process, time and egress quotas, and abuse detectors watch for mining, scanning and fork bombs. Sessions are destroyed after use; users can persist a workspace as an encrypted snapshot.]

1.3 Decisions requested from reviewers

IDQuestionRecommended optionSection
Q-01Example: Isolation boundary for untrusted code?microVM per session; gVisor as the fallback where nested virtualisation is unavailable7.2
Q-02Example: Start-time strategy?Warm pool per image, snapshot restore behind it, cold boot as last resort7.3
Q-03Example: Network default?No network; opt-in egress through an allow-list proxy7.4
Q-04Example: Secrets in the sandbox?Never; a credential broker outside the guest performs authenticated calls7.4
Q-05Example: Reuse a sandbox across users or tasks?Never across tenants or users; within one task only7.3
[Q-nn][Question][Option][Section]

1.4 45-minute interview path

MinutesTopicWhat to show
0 to 5ScopeThreat: hostile code chosen by an attacker through the agent
5 to 10RequirementsCore list (2.1), start time and isolation (2.2), below the line (2.3)
10 to 15EstimatesConcurrent sandboxes, hosts, warm pool size (3.2 to 3.4) with consequences
15 to 20APICreate session, execute, files, snapshot, destroy (4)
20 to 28High-level designDiagram (6), session lifecycle (7.1)
28 to 40One deep diveIsolation choice (7.2) for security interviews; warm pools and snapshots (7.3) for performance interviews; egress and secrets (7.4) for data-loss questions
40 to 45Wrap-upFailure modes (9.1), 10x row (10)

2. Requirements

2.1 Core functional requirements

IDRequirementPriority
FR-01Example: Create a session from an approved image (Python data science, Node.js, shell)Must
FR-02Example: Execute commands and code; stream stdout and stderr; return exit codesMust
FR-03Example: Upload and download files within a per-session workspaceMust
FR-04Example: Optional network egress restricted to an allow-list per tenant and per sessionMust
FR-05Example: Quotas on CPU, memory, disk, processes, wall-clock time and egress bytesMust
FR-06Example: Persist and restore a workspace snapshot on requestShould
FR-07Example: Authenticated calls to approved services without exposing credentials to the guestShould
FR-08Example: Kill a session immediately on abuse detection or tenant requestMust
FR-09Example: Audit record of every session: who, image, commands, egress destinations, resource useMust
[FR-nn][Requirement][Must / Should / Could]

2.2 Non-functional requirements

IDQualityTargetMeasured as
NFR-01Session startExample: p95 at or below 300 ms from request to readyService timing
NFR-02IsolationExample: No guest-to-host or cross-session access in red-team and fuzzing campaignsSecurity test results
NFR-03EgressExample: Zero connections to destinations outside the allow-listProxy logs and flow logs
NFR-04Abuse detectionExample: Mining or scanning sessions killed within 60 sDetector timing in drills
NFR-05AvailabilityExample: 99.9% monthly for session creationSLO
NFR-06DensityExample: At least 150 active sessions per host at the default sizeCapacity test
NFR-07CleanupExample: All session data destroyed within 5 min of session end unless snapshottedHost audit
[NFR-nn][Quality][Target][Measurement]

2.3 Below the line (out of scope)

  • [Example: Deciding which code to run; that is the agent's job (see Agent Orchestration Platform System Design Template (system-design/design-agent-orchestration-platform))]
  • [Example: GPU workloads and model training]
  • [Example: Long-running services with inbound traffic (sandboxes accept no inbound connections from the internet)]
  • [Example: Interactive desktop and browser automation sessions (separate design)]
  • [Item deferred, with the release that will take it]

3. Capacity estimation

3.1 Assumptions

All values are Example planning inputs.

InputValueSource
Sessions per day3 millionAgent and assistant forecasts
Peak-to-average ratio2.5Hourly pattern
Mean active session lifetime90 sPilot
Default sandbox size2 vCPU, 1 GiB memory, 5 GiB diskProduct decision
Per-sandbox memory overhead (VMM, agent)0.1 GiBHost measurement
Host96 vCPU, 768 GiB memory, 64 GiB reserved for the hostHardware
CPU oversubscription4 to 1 (bursty workloads)Pilot utilisation
Memory oversubscriptionNonePolicy
Pool replenish time (restore plus health check)5 sPilot
Sessions persisted as snapshots1%, 200 MB compressed eachPilot
Sessions using network egress30%, 5 MB eachPilot

3.2 Concurrency and hosts

QuantityCalculationResultConsequence
Average arrivals per second3,000,000 / 86,400about 34.7
Peak arrivals per second34.7 x 2.5about 87Scheduler places about 87 sessions per second at peak
Peak concurrent sessions87 x 90 sabout 7,830
Slots per host by CPU96 x 4 / 2192
Slots per host by memory(768 - 64) / 1.1640CPU, not memory, limits density, so memory can hold the warm pool (3.3)
Hosts at peak, full load7,830 / 19240.8, so 41
Hosts with 80% target and 3 zones41 / 0.8 = 51.25, rounded to 54 (18 per zone)54Losing a zone leaves 36 hosts (6,912 slots, 88% of peak): shed the free tier during a zone loss, or buy 63 hosts for full N+1

3.3 Warm pool

Pool size = arrival rate x replenish time = 87 x 5 s = about 435 ready sandboxes at peak, split across images by demand. Idle sandboxes use memory but almost no CPU: 435 x 1.1 GiB = about 479 GiB in total. Each host keeps 704 - 192 x 1.1 = about 493 GiB of memory unused by active slots, so the pool fits in spare memory spread over the fleet. Consequence: the pool needs no extra hosts if the scheduler counts idle pool members by memory, not by vCPU slots; it must be spread across hosts and zones so one host failure does not empty it.

3.4 Start time

PathExample p95Share of startsConsequence
Warm pool assignment30 ms95% targetMain path; meets NFR-01
Snapshot restore150 msPool missesFallback still meets NFR-01
Cold boot of image1.5 sRare (new images)Pre-build snapshots when an image is published

3.5 Storage, egress and logs

QuantityCalculationResultConsequence
Snapshots per day3 million x 1% x 200 MB6 TB
Snapshots, 7-day retention6 TB x 742 TBExpire by default; deduplicate against the base image
Egress per day3 million x 30% x 5 MB4.5 TB
Average egress rate4.5 TB / 86,400 sabout 52 MB/s (about 417 Mbit/s)
Peak egress rate52 MB/s x 2.5about 130 MB/s (about 1 Gbit/s)A small proxy fleet per region is enough; the hard part is policy, not bandwidth
Session output logs3 million x 50 KB150 GB per dayTruncate output per session; keep audit metadata longer than output

3.6 Summary

QuantityEstimateDesign consequence
Peak concurrent sessionsabout 7,83054 hosts across 3 zones
Density192 per host (CPU-bound)Oversubscribe CPU, never memory
Warm poolabout 435 sandboxesFits in spare memory; spread across hosts
Snapshots42 TB at 7-day retentionOpt-in, expiring, encrypted
Egressabout 1 Gbit/s at peakPer-tenant allow-lists in a proxy

4. API design

4.1 Endpoints

Method and pathPurpose
POST /v1/sessionsCreate a session: image, size, network policy, time limit, optional snapshot to restore
POST /v1/sessions/{id}/execRun a command or code; output streamed as server-sent events
PUT /v1/sessions/{id}/files/{path}Upload a file into the workspace
GET /v1/sessions/{id}/files/{path}Download a file
POST /v1/sessions/{id}/snapshotPersist the workspace (encrypted, expiring)
DELETE /v1/sessions/{id}Destroy the session now
GET /v1/sessions/{id}/usageCPU seconds, peak memory, egress bytes, destinations

4.2 Create request example

The caller passes the run and step as the idempotency key, so a retried step gets the same session instead of a second one.

POST /v1/sessions
Authorization: Bearer [platform credential]
Idempotency-Key: run-7f3a:step-12
Content-Type: application/json

{"tenant": "acme", "image": "python-ds@2026-10", "size": "small", "timeout_s": 600, "network": {"mode": "allow_list", "allow": ["pypi.org:443", "files.pythonhosted.org:443"]}, "broker_scopes": ["tickets.read"]}

4.3 Errors

StatusProblem typeMeaning
400image-not-approvedImage not on the tenant's approved list
403egress-not-allowedRequested destination outside the tenant's policy
429tenant-concurrency-exceededTenant at its concurrent session limit
503capacity-unavailableNo slot and no pool member; Retry-After set
410session-terminatedSession ended by timeout, quota or abuse detector; reason given

Errors use RFC 9457 problem details. Exit codes of user code are results, not API errors.

5. Data model

5.1 Entities

The control plane stores metadata only. Workspace content lives on the host for the session's lifetime, then in encrypted snapshots if requested.

5.2 Access patterns

IDQueryKey or index that serves itPartition key and rationale
AP-01 (Example)Find a free pool member for an image in a zonePool index (image_id, zone) in the scheduler's memoryScheduler-local; rebuilt from host heartbeats
AP-02 (Example)Route an exec call to the host of a sessionSESSION by session_id, cached at the API tierSession ID carries a host hint to avoid a lookup
AP-03 (Example)Count a tenant's active sessionsCounter per tenant_idAdmission check on every create
AP-04 (Example)Sessions past their deadlineIndex (host_id, expires_at)Each host reaper reads its own range
AP-05 (Example)Everything one session did, for an investigationEXEC_RECORD and EGRESS_RECORD by session_idAppend-only, partitioned by day for retention
AP-06 (Example)Tenants whose sessions contacted a destinationIndex on destination in the audit warehouseIncident response after a malicious domain is found

5.3 Storage choices

DataStoreNotes
Policies, images, tenantsRelational databaseChanges audited
Session stateReplicated key-value store plus host heartbeatsHosts are the source of truth for running sessions
Exec and egress recordsEvent stream to an audit warehouseCommand text hashed; output truncated
Base snapshotsObject storage, replicated to every host's local diskBuilt when an image is published
Workspace snapshotsObject storage, encrypted per tenant, expiringOpt-in only

6. High-level design

ComponentResponsibilityScales by
Sandbox APIAuth, policy checks, idempotency, routing exec callsRequests per second
Scheduler and pool managerPlacement, warm pools per image and zone, admissionSessions per second
Host agentStart, restore, snapshot and destroy microVMs; enforce cgroups and disk quotasOne per host
Execution agent (in guest)Run commands, stream output, file operations over vsockOne per sandbox
Egress proxyAllow-list, DNS control, byte quotas, loggingEgress bandwidth
Credential brokerPerform authenticated calls on behalf of the session with scoped tokensCalls per second
Abuse detectorsCPU pattern, connection pattern and process-count signalsHosts

7. Detailed design

7.1 Session lifecycle

A pooled sandbox is assigned to exactly one session and never returns to the pool. Destroying and replacing is cheaper than proving a used sandbox is clean.

7.2 Deep dive 1: isolation boundary

OptionHow it isolatesStrengthsWeaknesses
A. Hardened containers (namespaces, cgroups, seccomp, dropped capabilities, user namespaces)Shared host kernel with a filtered system call surfaceFast start, high density, simple toolingOne kernel bug can break isolation for every tenant on the host
B. gVisor (user-space application kernel)System calls served by the gVisor Sentry, which runs under a restricted seccomp profile; file access mediated by a separate Gofer processMuch smaller host kernel surface; OCI runtime (runsc) fits container toolingHigher per-system-call overhead; some system calls and /proc or /sys files not implemented
C. microVM per session (for example Firecracker, or Kata Containers with a VMM)Hardware virtualisation; guest kernel per sandbox; minimal device modelStrong boundary; per-session kernelNeeds virtualisation support on hosts; more memory per sandbox; snapshot and image tooling to build
D. WebAssembly runtimeLanguage-level sandboxVery fast startCannot run arbitrary native packages that agents install

Choice: C for all untrusted code. B where hosts lack virtualisation support (for example some nested environments), with a stricter egress policy. A only for first-party code that never runs model-chosen input.

Reason: the code is attacker-influenced by design (prompt injection can choose it), and tenants share hosts. A per-session guest kernel removes the shared-kernel failure mode of containers, and the microVM's small device model narrows what the guest can reach on the host.

Defence in depth around the VMM:

  • Run each VMM process in its own jail: separate user, chroot, cgroups, seccomp filters and no capabilities beyond what it needs.
  • Pin VMM and guest kernel versions; patch on a defined schedule with a fast path for virtualisation security advisories.
  • Expose only virtio network, block storage and vsock to the guest.

How real systems do it: Firecracker (paraphrased)

The Firecracker paper describes the virtual machine monitor that AWS built for Lambda and Fargate after concluding that containers alone did not give the isolation needed to run many customers' code on shared hardware, while traditional VMs were too heavy. Firecracker uses Linux KVM but replaces the usual emulator with a small monitor written in Rust that offers only a few emulated devices, keeps the per-VM memory overhead and start time low enough for function workloads, and runs each monitor inside a further sandbox (the "jailer") using standard Linux isolation features, so a guest that escapes the VM still lands in a restricted process. Source: Agache et al., "Firecracker: Lightweight Virtualization for Serverless Applications", 17th USENIX Symposium on Networked Systems Design and Implementation (NSDI 2020). This box summarises; read the paper for design detail and figures.

7.3 Deep dive 2: warm pools, cold start and snapshot restore

OptionStrengthsWeaknesses
A. Cold boot per sessionClean state; simpleToo slow for interactive use (3.4)
B. Reuse a sandbox across sessions after cleanupFastCleanup must be perfect; cross-session leakage risk
C. Warm pool of pre-booted sandboxes, one use eachFast; cleanMemory held by idle members; pool sizing
D. Restore from a pre-booted base snapshotFast enough for misses; cheap to keepRestored clones share state captured at snapshot time

Choice: C backed by D: pool members are themselves created by restoring the image's base snapshot; on a pool miss the scheduler restores directly. B is not allowed.

Reason: NFR-01 needs sub-second starts, and B trades isolation for speed, which defeats the purpose of the service. Pool size follows 3.3 and is adjusted per image from demand.

Snapshot uniqueness rules: the Firecracker snapshot documentation warns that resuming the same snapshot more than once is a security concern, because random seeds, identifiers and tokens captured in memory are duplicated across clones. Therefore:

RulePurpose
Base snapshots are taken before any secret, token or tenant data exists in the guestNothing sensitive is cloned
Use guest kernels that reseed their random generator after restore (VM generation ID support), and reseed user-space generators in the execution agent on resumeDistinct randomness per clone
Reset the guest wall clock after restoreCorrect timestamps and certificate checks
Regenerate guest identifiers (hostname, machine ID) on resumeNo duplicate identities
Encrypt and authenticate snapshot files; the VMM treats them as trusted inputPrevent tampered snapshots

Workspace snapshots (FR-06) store only the workspace disk, not memory, unless the tenant explicitly needs process state; this keeps them smaller and avoids the cloning risks above.

7.4 Deep dive 3: egress control and secrets

OptionStrengthsWeaknesses
A. Open internet, block internal rangesMost packages installExfiltration, scanning, abuse from your IP ranges
B. No network at allStrongestMany agent tasks need package installs or APIs
C. No network by default; opt-in allow-list through a proxy that controls DNS and enforces byte quotasFits most tasks; every destination loggedAllow-lists need curation; some tools break behind proxies

Choice: C. The guest's only route is to the egress proxy; the host firewall drops everything else, including private ranges and cloud metadata addresses.

Reason: egress is the exfiltration path for data the agent was given and the attack path for abuse. A proxy gives one place to enforce policy and one log to investigate.

RuleExample value
DefaultNo network
Package mirrorsInternal mirror of approved package indexes as the default allow-list entry
DNSResolved by the proxy only; guest resolver points to it and direct DNS is dropped, which also closes DNS tunnelling as an exfiltration channel
Byte quota100 MB per session egress (Example)
Blocked alwaysPrivate address ranges, metadata endpoints, mail ports, known mining pools

Secrets: the guest never receives long-lived credentials. When code must call an approved service, the execution agent asks the credential broker (outside the VM) over vsock; the broker checks the session's broker_scopes, performs the call with a short-lived token and returns only the response. Environment variables, files and images are scanned so no secret is baked into a base snapshot. Permission scoping follows the Agent Tool and Permission Design Template (ai-data/agent-tool-permission-design).

7.5 Deep dive 4: resource quotas and abuse prevention

ResourceEnforcementExample default
CPUvCPU count and cgroup CPU quota on the VMM2 vCPU, throttled above quota
MemoryFixed guest memory; no balloon growth beyond the size1 GiB
DiskPer-session block device of fixed size5 GiB
ProcessesGuest limit on process count512
Wall-clock timeSession timeout and per-exec timeout10 min session, 2 min per exec
EgressProxy byte quota and connection rate100 MB, 20 new connections per second
Tenant concurrencyAdmission counterSet per contract
Abuse patternSignalResponse
Cryptocurrency miningSustained full CPU, mining pool destinations, known binariesKill session, flag tenant, review
Network scanningMany destinations or ports, denied connectionsKill session, block destination pattern
Fork bomb or resource exhaustionProcess count at limit, memory pressureContained by limits; kill on repeat
Hosting malicious contentUnexpected inbound attempts (none allowed), egress to file-sharing sitesKill, report

Detection must reach a decision within 60 s (NFR-04); responses are automatic and reviewed afterwards.

8. Scalability and performance

ConcernApproachLimit before redesign
Placement rateScheduler sharded by zone; pool assignment in memoryScheduler throughput per zone
DensityCPU oversubscription, fixed memoryNoisy neighbours on CPU: lower ratio for paid tiers
Pool sizingPer image and zone from arrival rate and replenish timeMany images: pool only the top images, restore the rest
Base snapshot distributionPre-staged to every host's local diskNumber of images times snapshot size per host
EgressRegional proxy fleetPolicy evaluation cost, not bandwidth

Start-time budget (NFR-01, p95 300 ms) on the restore path: admission and policy 20 ms, placement 20 ms, snapshot restore 150 ms, network and vsock setup 40 ms, health check 30 ms, headroom 40 ms.

9. Reliability, security and operations

9.1 Failure modes

IDComponentFailureDetectionBlast radiusMitigationRTO
FM-01HostCrash or kernel panicHeartbeat lossUp to 192 sessionsSessions fail with session-terminated; callers retry on a new session; pools refill elsewhere1 min
FM-02Warm poolExhausted at a spikePool depth metricStart time rises to restore pathRestore path; scale pool from arrival rateUnder 5 s
FM-03Egress proxyDownHealth checksSessions with networkProxies per zone; sessions without network unaffected; fail closed5 min
FM-04Credential brokerDownError rateSessions needing authenticated callsFail closed; retry from the caller10 min
FM-05VMM or guest kernelEscape vulnerability disclosedSecurity advisoriesPotentially the whole fleetEmergency patch path; drain and rebuild hosts; temporarily disable networkPer advisory, target 24 h
FM-06Base snapshotCorrupt or tamperedChecksum and signature check on loadOne imageRebuild from image; keep the previous version30 min
[FM-nn][Component][Failure][Signal][Scope][Mitigation][Time]

9.2 Security

Mapping to the OWASP Top 10 for Agentic Applications 2026 (OWASP GenAI Security Project); confirm entry names against the current list.

IDThreat (OWASP entry where applicable)Control
SEC-01Unexpected Code Execution (ASI05): agent runs attacker-chosen codemicroVM per session; no secrets in guest; egress allow-list
SEC-02Tool Misuse and Exploitation (ASI02): sandbox used to attack othersEgress policy, abuse detectors, byte quotas
SEC-03Identity and Privilege Abuse (ASI03): credentials stolen from the sandboxCredential broker; short-lived scoped tokens outside the guest
SEC-04Agentic Supply Chain Vulnerabilities (ASI04): malicious packages installedInternal package mirror with scanning; approved images
SEC-05Cross-session data leakageOne-use sandboxes; wipe on destroy; per-tenant snapshot keys
SEC-06Host compromise via VMM bugJailed VMM, minimal devices, patch cadence, host isolation by tier
SEC-07Agent Goal Hijack (ASI01): command output or downloaded content carries instructions back to the calling agentOutput size-limited and returned as untrusted data; the caller marks it as data, never as instructions, in the model context
[SEC-nn][Threat][Control]

Run the full analysis with the Agentic AI Threat Model Template (ai-data/agentic-threat-model), and align network rules with the Zero Trust Architecture Plan Template (security/zero-trust-architecture).

9.3 Observability

SignalMetricAlert threshold
Start timep95 by path (pool, restore, cold)Above 300 ms for 10 min
Pool depthReady members per image and zoneBelow 20% of target
Host densityActive sessions per hostAbove 192 or CPU steal above threshold
Egress denialsDenied connections per tenantSpike per tenant
Abuse killsCount by patternAny mining or scanning kill pages security
CleanupSessions ended but not wiped after 5 minAny

9.4 Cost estimate

ItemUnit costQuantityMonthly cost
Sandbox hosts[USD per host-month]54 (or 63 for full N+1)[USD]
Snapshot storage[USD per TB-month]about 42 TB[USD]
Egress proxy fleet and bandwidth[USD per TB]about 135 TB per month[USD]
Audit warehouse[USD per TB-month][TB][USD]
Total[USD]

10. Trade-offs and alternatives

DecisionOptionsChosenWhyWhat we give up
IsolationContainers; gVisor; microVM; WebAssemblymicroVM, gVisor fallbackHostile code on shared hostsDensity and tooling effort
Start timeCold boot; reuse; warm pool; restoreWarm pool backed by restoreFast and cleanMemory for idle members; snapshot hygiene
NetworkOpen; none; allow-list proxyNone by default, allow-list opt-inExfiltration and abuse controlSome tasks need allow-list work
SecretsIn guest; brokerBrokerGuest compromise yields no credentialsBroker must support each service
Build or buyManaged sandbox vendor; self-hosted[Decision][Data location, cost at volume, control][Operations or vendor dependency]
What changes at 10x (30 million sessions per day, about 78,000 concurrent)Bare-metal fleet per region; scheduler per zone with cell-based isolation; snapshot distribution by peer-to-peer or regional cache; dedicated security response rotaAbout 540 hosts make placement, snapshot distribution and patching the limitsMore operational surface and a larger blast radius per advisory
What changes at 0.1x (300,000 sessions per day, under 1,000 concurrent)A managed sandbox provider or gVisor on a small node pool; egress and secrets rules unchangedAbout 6 hosts do not justify an own microVM image and snapshot pipelineWeaker isolation boundary or vendor dependency
[Decision][Options][Chosen][Why][Cost]

11. Delivery plan and risks

11.1 Milestones

MilestoneScopeExit criterionTarget date
M1microVM hosts, host agent, cold boot, no networkRed-team and fuzzing campaign meets NFR-02YYYY-MM-DD
M2Base snapshots, warm poolsNFR-01 met at forecast peakYYYY-MM-DD
M3Egress proxy, allow-lists, credential brokerNFR-03 audit passes; no secrets in imagesYYYY-MM-DD
M4Quotas and abuse detectorsMining and scanning drills meet NFR-04YYYY-MM-DD
M5Workspace snapshots, migration of all callersOld container path switched offYYYY-MM-DD

11.2 Rollout and rollback

[Example: Callers switch per tool behind a flag; the container path stays available for first-party code only. Image and kernel updates roll out to one zone first; rollback is a pool rebuild from the previous base snapshot.]

11.3 Risks

IDRiskLikelihoodImpactMitigationOwner
R-01Example: Hosts without virtualisation support in some regionsMediumMediumgVisor fallback with stricter policy[@name]
R-02Example: Snapshot cloning duplicates secrets or randomnessMediumHighRules in 7.3; tests that compare clones[@name]
R-03Example: Allow-lists too strict, agents fail tasksHighMediumCurated mirrors; per-tenant requests with review[@name]
R-04Example: Escape vulnerability in VMM or kernelLowHighPatch path, jail, host tiering[@name]
[R-nn][Risk][L / M / H][L / M / H][Mitigation][@name]

12. Appendices

12.1 Traceability

RequirementDesign elementVerification
NFR-017.3 pools and restore, 8 start budgetLoad test at peak arrival rate
NFR-02, SEC-017.2 microVM and jailRed-team and fuzzing campaign
FR-04, NFR-037.4 egress proxyProxy and flow log audit
FR-07, SEC-037.4 credential brokerImage and memory scans for secrets
FR-05, NFR-047.5 quotas and detectorsAbuse drills
[ID][Element][Test]

12.2 Open questions

IDQuestionOwnerDue
OQ-01Example: Do paid tenants get dedicated hosts?[@name]YYYY-MM-DD
OQ-02Example: Do we support GPU sandboxes, and with which isolation?[@name]YYYY-MM-DD
[OQ-nn][Question][@name]YYYY-MM-DD

12.3 Glossary

TermMeaning
microVMLightweight virtual machine with a minimal device model and its own guest kernel
VMMVirtual machine monitor, the host process that runs a microVM
JailerWrapper that confines the VMM process with Linux isolation features
Warm poolPre-started sandboxes waiting to be assigned, each used once
Base snapshotSaved memory and device state of a freshly booted image, used to start clones quickly
vsockVirtual socket between host and guest that needs no network
Egress proxyGateway that enforces outbound network policy for sandboxes

12.4 References

ReferenceUse
Agache et al., "Firecracker: Lightweight Virtualization for Serverless Applications", NSDI 2020, https://www.usenix.org/conference/nsdi20/presentation/agacheBox in 7.2 (paraphrased)
Firecracker documentation, snapshot support, https://github.com/firecracker-microvm/firecracker/blob/main/docs/snapshotting/snapshot-support.mdUniqueness rules in 7.3
gVisor documentation, https://gvisor.dev/docs/Option B in 7.2
OWASP Top 10 for Agentic Applications 2026, https://genai.owasp.org/ (CC BY-SA 4.0)Threats in 9.2
RFC 9457, Problem Details for HTTP APIs (2023)Errors in 4.3
Agent Orchestration Platform System Design Template (system-design/design-agent-orchestration-platform)Main caller
Agent Tool and Permission Design Template (ai-data/agent-tool-permission-design)Broker scopes
Multi-Agent System Design Template (ai-data/multi-agent-system-design)Agent-level controls

Standard and licence note

Based on the published Firecracker design (Agache et al., NSDI 2020) and the Firecracker and gVisor project documentation, RFC 9457, and the OWASP Top 10 for Agentic Applications 2026 by the OWASP GenAI Security Project (CC BY-SA 4.0; entry names are attributed to OWASP, and any adapted OWASP material you redistribute must carry the same licence under its ShareAlike term). The paper is paraphrased and cited as inspiration only; no figures are reproduced. The text is original; isolation technologies and their security advisories change often, so check the current official documentation before approval. Template licence: MIT.

Related templates