Skip to content

Tool Runtime Sandbox Runtime

Document ID: TRT-003
File Path: docs/07-tool-runtime/sandbox-runtime.md
Version: 1.0.0
Status: Draft
Owner: AI Platform Team
Last Updated: 2026-06-27


This document specifies how the Tool Runtime provisions and operates sandboxes — the isolated environments in which tools execute. It covers the supported isolation backends, their tradeoffs, the sandbox lifecycle, resource enforcement, and warm pooling.

The Tool Framework §31–36 defines sandbox types and policy schemas. This document defines how the Runtime implements them as a fleet operation.


The Sandbox Manager supports a spectrum of backends, trading startup cost for isolation strength:

BackendIsolationCold startUse
Native processOS process + namespaces~msTrusted first-party tools
WASI / WASMCapability-based, in-process VMsub-msPure, deterministic tools
Container (Docker/OCI)Namespaces + cgroups100s msGeneral third-party tools
gVisorUser-space kernel~100 msUntrusted tools needing syscalls
Firecracker microVMHardware-virtualized~125–200 msStrongly untrusted tools
Kubernetes PodPod + policiessecondsHeavy / clustered tools
Remote workerNetwork-isolated poolnetwork RTTThird-party / data-residency

The backend is selected per tool from its manifest, overridable by tenant policy (a tenant may force a stronger backend than the tool requests, never weaker).


1. Read tool manifest sandbox preference
2. Apply tenant policy floor (minimum isolation level)
3. Apply trust classification (first-party / verified / untrusted)
4. Choose strongest of (preference, policy floor, trust requirement)
5. Check worker capability (node supports the backend)

Untrusted or unverified tools are floored to gVisor or microVM regardless of their stated preference. See Security & Isolation.


Implements the framework’s lifecycle:

Allocate ─► Initialize ─► Inject Context ─► Execute ─► Collect ─► Destroy ─► Cleanup
StageRuntime action
AllocateAcquire a warm sandbox or provision a new one
InitializeApply cgroups/limits, mount allowed paths, set env
Inject ContextPass execution context + secrets (memory, not disk)
ExecuteRun the tool entrypoint with the timeout armed
CollectCapture stdout/stderr/structured output
DestroyTerminate process/VM; never reuse for another tenant
CleanupReclaim disk, scratch, network namespace; zero secrets

Ephemeral by default: a sandbox serves exactly one execution and is destroyed. Reuse across executions is only allowed within the same tenant+tool for trusted, pooled backends (see Warm Pooling).


Limits from the tool manifest / request (Tool Framework §33) are enforced by the backend’s primitives:

ResourceEnforced via
CPUcgroup cpu quota / vCPU cap
Memorycgroup memory.max / VM memory; OOM-kill on breach
Diskscratch quota / ephemeral volume size
PIDscgroup pids.max
Timeruntime timeout → SIGTERM → SIGKILL
File descriptorsrlimit
Egressnetwork policy (see Security & Isolation)

Breaching a hard limit terminates the sandbox and returns resource_exceeded (Execution API §10).


  • Each sandbox gets a fresh, isolated root with only explicitly allowed paths mounted (e.g. /workspace, /tmp), per Tool Framework §35.
  • /usr, /etc and similar are mounted read-only when present.
  • Each execution runs in a dedicated PID namespace with no visibility into host or sibling processes (Tool Framework §36).
  • Scratch space is wiped on destroy; nothing persists between executions.

Cold starts (especially microVMs) add latency. The Runtime maintains warm pools of pre-initialized sandboxes:

Pool per (backend, image, tenant-class)
├─ pre-warmed, idle sandboxes
On invoke: take warm sandbox ─► inject context ─► execute
└─ on destroy: discard (untrusted) OR return to pool (trusted, reset)

Rules:

  • Warm sandboxes are never shared across tenants; pools are tenant-class scoped.
  • Untrusted backends are discarded after one use, not returned to a pool.
  • Pool size adapts to demand (see Worker Pool §6).
  • A pooled sandbox is reset (scratch wiped, env reset) before reuse for the same tenant.

Snapshot/restore (e.g. Firecracker snapshots) is a planned optimization for near-instant cold starts (see Overview §15).


  • Tool images/artifacts are content-addressed and pulled from the artifact store, verified by digest before use.
  • Images are cached per node; first use on a node pays the pull cost.
  • Image provenance and signatures are checked for third-party tools (supply-chain protection) — see Security & Isolation §9.

FailureBehavior
Provision failureRetry on another worker, then sandbox_unavailable
Sandbox crashCapture diagnostics; return tool_error
OOM / limit breachKill; return resource_exceeded
Hung toolTimeout → SIGTERM → SIGKILL; timeout
Worker node lossSandbox lost; reschedule if idempotent

All teardown paths guarantee secret zeroing and resource reclamation, even on crash, via a reaper that sweeps orphaned sandboxes.


RequirementTarget
Warm sandbox start< 20 ms p95
Cold microVM start< 200 ms p95
WASM instantiation< 2 ms p95
Teardown + reclaim< 30 ms p95
Orphan sweep interval< 10 s



VersionDateDescription
1.0.02026-06-27Initial Tool Runtime Sandbox Runtime specification