Skip to content

Design: agent sandboxes on spore.host (spawn sandbox, MCP sandbox tools, Managed Agents worker, hypha) #1171

Open

Description

@scttfrdmn

Design proposal: how spore.host could offer agent sandboxes (the category Docker Sandboxes, E2B, Daytona, Modal, Lambda MicroVMs and others sell), and do better for its own audience: GPUs, large memory, data in the user's own AWS account, and hard TTL and cost guarantees.

The full research brief is in the first comment. It covers a landscape of about 20 products with sources, a capability map against spawn, design options A–D, phases and experiments. Each claim is tagged [P] primary docs, [3P] third party, [code], EST (estimate) or UNVERIFIED.

TL;DR

  1. What the market sells. Nearly every "agent sandbox" is the same thing: a Firecracker microVM, a gVisor container, or a full VM, behind a create/exec/files/snapshot/destroy API.

    • They start in well under a second to a few seconds, because they restore from snapshots or use warm pools.
    • They bill per second.
    • They cap lifetime: 45 min to 24 h on most, 8 h on AWS's two offerings.
    • They run on the vendor's cloud.
    • Almost none offer GPUs. Modal and Daytona do. Northflank also claims GPU support [3P].
  2. The ground shifted in 2026, in two ways.

    • AWS Lambda MicroVMs went GA on 2026-06-22 [P]. They are Firecracker sandboxes that run in the customer's own AWS account, with suspend/resume. Limits: 8 h hard cap, ARM64 only, 16 vCPU / 32 GB at most, and no GPU mentioned.
    • EC2 nested virtualization on C8i/M8i/R8i and some 7th-gen Intel types (announced 2026-02) [P]. Firecracker now runs on ordinary, cheap EC2 instances instead of .metal.
    • Together these remove "your own AWS account" as a unique differentiator for small CPU sandboxes. AWS now sells exactly that.
  3. Claude Managed Agents has a self-hosted sandbox mode (beta) [P]. A worker inside your infrastructure polls a work queue over outbound HTTPS and runs the agent's tool calls locally. It is already listed with 11 platform guides: Lambda MicroVMs, E2B, Daytona, Modal, Cloudflare, Fly, GKE, Vercel, and others.

    • The model is almost exactly spawn pool: workers in your account pull work from a queue.
    • This is the cheapest high-leverage integration available to spore.host.
  4. spore.host already has most of a "heavy sandbox" [code]:

    • ephemeral EC2 with TTL, cost limit and idle stop, enforced in-instance by a signed spored, plus an out-of-band reaper;
    • truffle sizing, including GPUs, Spot and capacity blocks;
    • keyless SSM connect;
    • TaskSpec container runs with --gpus all;
    • SQS worker pools;
    • S3, EFS and FSx data in the user's account;
    • an MCP server that can already launch billable tasks behind a mandatory TTL.

    What it lacks is a programmatic interactive surface: exec, file put/get, snapshot/fork, an egress policy, and fast start. Today a sandbox is either a batch task or an SSH session.

  5. Recommendation. Don't start by building a Firecracker fleet. Build spawn sandbox, an agent-facing create/exec/cp/snapshot/destroy surface over EC2 spores (Option A), and expose it through spore-host-mcp (Option C). Ship a Claude Managed Agents self-hosted worker recipe on top (Option D1).

    • Position it as the sandbox tier incumbents don't serve: GPUs, big memory, long lifetimes, data in your account, and hard cost/TTL guarantees.
    • Treat the sub-second tier as a pluggable backend:
      • evaluate Lambda MicroVMs first (buy);
      • build a nested-virt Firecracker broker (Option B, working name hypha) only if measurements show it pays off.
    • Run the de-risking experiments in Part 4 before committing to B.

4.2 Phases

Phase Deliverable Size
P0: de-risk and decide (1–2 wks) Run experiments E1–E3 below. Decide the open questions in 4.4. S
P1: MVP, spawn sandbox (Option A1) 1. create / exec / cp / status / extend / destroy, with exec via SSM and cp via an S3 relay.
2. Egress `none
s3
P1.5: Managed Agents recipe (D1) Poller spore plus a per-session sandbox script. Documented and validated on a GPU sandbox reading S3 data. Offer it to Anthropic's platform-guide list. S
P2: v1, fast-enough and forkable 1. Pre-baked sandbox AMI (Docker + NVIDIA toolkit + exec agent).
2. Warm/stopped pool claim.
3. snapshot / fork via AMI.
4. allow: egress through the per-account proxy spore.
5. Credential placeholder injection.
6. --backend lambda-microvm (Option B′) with reaper coverage for MicroVMs, images and snapshots.
M–L
P3: optional, hypha (Option B) Only if E2 and E3 show:
• Lambda MicroVMs is inadequate (x86, >8 h, FSx mounts, egress, fork, cost at density); and
• nested-virt Firecracker hits target latency and density.
L

4.3 First concrete milestone

spawn sandbox A1 + MCP:

  1. An agent in Claude Code calls sandbox_create {gpu:1, ttl:"2h", cost_limit:5, egress:"s3", data:["s3://…:ro"]}.
  2. It runs nvidia-smi and a Python script over the mounted dataset via sandbox_exec.
  3. It pulls a result file with sandbox_read_file, then calls sandbox_destroy.

Pass criteria:

  • the agent never held AWS keys beyond the local MCP chain;
  • the sandbox had no inbound ports and no internet egress;
  • the reaper was armed;
  • an independent post-run sweep finds zero leaked instances, volumes, SGs, ENIs or instance profiles, and no S3 objects outside the results prefix.

4.4 Open questions for the owner

  1. Tenancy. Sandboxes stay strictly single-account and BYO? Recommendation: yes. A hosted multi-tenant sandbox service would break "data never leaves your account". Any hosted helper must respect the existing cross-account trust constraints: no trusts toward management or internal accounts.
  2. Reaper as a precondition. Should sandbox create hard-require an armed reaper in the target account, or warn plus --accept-no-backstop?
  3. MCP spending policy. The boundary already moved with spawn_task_run. Is autonomous sandbox creation acceptable with a mandatory TTL and cost limit plus per-day caps in config? Should GPU sandboxes require an explicit config opt-in?
  4. Egress default. none, s3, or open? Recommendation: s3 for data science, with open requiring a flag.
  5. Lambda MicroVMs as a backend. Acceptable to depend on it (ARM64-only, 5 regions, 8 h)? It needs reaper extensions for non-EC2 artifacts.
  6. Managed Agents beta. Is it acceptable to build a recipe on a beta API (managed-agents-2026-04-01)? It is low-cost, because it's a doc plus a script, not core code.
  7. Naming. Is hypha OK for the microVM tier, with sclerotium for snapshots and conidia for forks? Or should everything live under spawn sandbox?
  8. Scope of "fork". Is a disk-only fork (AMI) enough for v1, or is memory-state fork a requirement? Memory-state fork effectively forces Option B.

Status

  • E1 (EC2 time-to-first-exec) is being run now. Its results will be posted here.
  • E2–E4 are specified in the brief, not yet run.

Activity

  1. added this to the Later milestone on Oct 19, 2026
  2. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Sandboxes for AI agents: landscape, spore.host's position, design options

    Research + design brief. Written 2026-10-18. Nothing here was built or run: no code, no PRs, no issues, no AWS calls.

    How to read the evidence. Sources are tagged:

    • [P]: primary, meaning the vendor's own docs or blog.
    • [3P]: third-party, meaning a blog, comparison site, or competitor's marketing. Treat these as leads, not facts.
    • [code]: read from the local spore.host clones. Paths are relative to ~/src/spore-host/.
    • EST: my own estimate. Each one says how it was derived.
    • UNVERIFIED: I could not confirm it.

    Prices are USD, as published or quoted on the date given. They change often, so re-check them before deciding anything.


    TL;DR

    1. What the market sells. Nearly every "agent sandbox" is the same thing: a Firecracker microVM, a gVisor container, or a full VM, behind a create/exec/files/snapshot/destroy API.

      • They start in well under a second to a few seconds, because they restore from snapshots or use warm pools.
      • They bill per second.
      • They cap lifetime: 45 min to 24 h on most, 8 h on AWS's two offerings.
      • They run on the vendor's cloud.
      • Almost none offer GPUs. Modal and Daytona do. Northflank also claims GPU support [3P].
    2. The ground shifted in 2026, in two ways.

      • AWS Lambda MicroVMs went GA on 2026-06-22 [P]. They are Firecracker sandboxes that run in the customer's own AWS account, with suspend/resume. Limits: 8 h hard cap, ARM64 only, 16 vCPU / 32 GB at most, and no GPU mentioned.
      • EC2 nested virtualization on C8i/M8i/R8i and some 7th-gen Intel types (announced 2026-02) [P]. Firecracker now runs on ordinary, cheap EC2 instances instead of .metal.
      • Together these remove "your own AWS account" as a unique differentiator for small CPU sandboxes. AWS now sells exactly that.
    3. Claude Managed Agents has a self-hosted sandbox mode (beta) [P]. A worker inside your infrastructure polls a work queue over outbound HTTPS and runs the agent's tool calls locally. It is already listed with 11 platform guides: Lambda MicroVMs, E2B, Daytona, Modal, Cloudflare, Fly, GKE, Vercel, and others.

      • The model is almost exactly spawn pool: workers in your account pull work from a queue.
      • This is the cheapest high-leverage integration available to spore.host.
    4. spore.host already has most of a "heavy sandbox" [code]:

      • ephemeral EC2 with TTL, cost limit and idle stop, enforced in-instance by a signed spored, plus an out-of-band reaper;
      • truffle sizing, including GPUs, Spot and capacity blocks;
      • keyless SSM connect;
      • TaskSpec container runs with --gpus all;
      • SQS worker pools;
      • S3, EFS and FSx data in the user's account;
      • an MCP server that can already launch billable tasks behind a mandatory TTL.

      What it lacks is a programmatic interactive surface: exec, file put/get, snapshot/fork, an egress policy, and fast start. Today a sandbox is either a batch task or an SSH session.

    5. Recommendation. Don't start by building a Firecracker fleet. Build spawn sandbox, an agent-facing create/exec/cp/snapshot/destroy surface over EC2 spores (Option A), and expose it through spore-host-mcp (Option C). Ship a Claude Managed Agents self-hosted worker recipe on top (Option D1).

      • Position it as the sandbox tier incumbents don't serve: GPUs, big memory, long lifetimes, data in your account, and hard cost/TTL guarantees.
      • Treat the sub-second tier as a pluggable backend:
        • evaluate Lambda MicroVMs first (buy);
        • build a nested-virt Firecracker broker (Option B, working name hypha) only if measurements show it pays off.
      • Run the de-risking experiments in Part 4 before committing to B.

    Part 1: The landscape

    1.1 Comparison table (core facts)

    Product Isolation Start latency Max lifetime Persistence / snapshot / fork Egress control GPU Where it runs Price signal
    Docker Sandboxes (sbx) microVM per sandbox, each with its own kernel and private Docker engine [P]. Hypervisor not named in the launch post. "seconds" after the image is cached [P] not stated Local, disposable. sbx move carries the filesystem between local and cloud [P]. Allow/deny lists, global policy via sbx policy allow/deny [P] not mentioned Laptop (macOS/Windows; Linux via docker-sbx package + kvm group) or Docker-managed cloud [P] Local is free; cloud is pay-as-you-go [P]
    E2B Firecracker microVM [P] ~150 ms [3P] 1 h Hobby, 24 h Pro [3P, citing E2B docs] Pause/resume keeps memory and filesystem. Pause takes ~4 s/GiB RAM, resume ~1 s. Paused sandboxes are deleted after 30 days [3P, citing e2b docs 2026-06-16]. UNVERIFIED in detail No (Firecracker has no GPU passthrough) [3P] E2B cloud, or "your AWS, GCP, or Azure account" [P]. OSS infra (Terraform + Nomad) needs bare metal or nested virt [P, e2b-dev/infra]. $0.0504/vCPU-h, $0.0162/GiB-h, Pro $150/mo [3P]
    Daytona Container by default; Linux VM and Windows options [P] "<90 ms" [P]. 71 ms create in one benchmark [3P]. No max. Auto-stop after idle, 15 min default [P/3P]. Snapshots, archive. VM sandboxes support fork, pause/resume and memory snapshots [P]. UNVERIFIED Yes (H100 ~$3.95/h, plus a spot tier) [3P] Daytona cloud. OSS self-host exists [3P]. Same CPU/memory rates as E2B [3P]
    Modal Sandboxes gVisor by default; "VM runtime" (KVM) option [P] sub-second (not quantified on the pages read) 5 min default, up to 24 h [P] Filesystem snapshots stored as diffs from the base image; they are Images [P] block_network, outbound_cidr_allowlist, outbound_domain_allowlist (SNI-based, beta, domain-fronting gap acknowledged), updatable at runtime [P] Yes, gVisor-only and preemptible [P] Modal cloud only Bills max(request, actual) per second [P]
    Cloudflare Sandbox SDK / Containers Container on Cloudflare's fleet (isolation tech not stated on the pages read) UNVERIFIED Sleeps after sleepAfter UNVERIFIED enableInternet: false [P] No [3P] Cloudflare only. GA 2026-04-13 on Workers Paid [P]. $0.072 per active vCPU-hour [3P]
    Vercel Sandbox Firecracker [P] fast (not quantified) 45 min Hobby, 5 h Pro [3P] Persistent by default: automatic filesystem snapshot on stop [P] Own network namespace, "controlled outbound access" [P] No Vercel (iad1 only per [3P]) $0.128 per active vCPU-h, $0.0212/GB-h [3P]
    Fly.io Sprites (launched 2026-01) Firecracker [3P] 100–500 ms warm, 1–2 s cold [3P] none; sleeps after ~30 s idle [3P] 100 GB persistent NVMe. Checkpoint ~300 ms (copy-on-write filesystem), automatic checkpoints [P/3P]. Per-Sprite domain allow/deny [3P] No Fly.io $0.07/CPU-h, $0.04375/GB-h [3P]
    Northflank Kata, Firecracker, gVisor, Cloud Hypervisor (chosen per workload) [3P, vendor] UNVERIFIED "no forced limit" [3P, vendor] yes yes Yes (L4–H200) [3P, vendor] Their cloud or BYOC (EKS/GKE/AKS/…) $0.01667/vCPU-h, $0.00833/GB-h [3P, vendor]
    Morph Cloud VMs ("Infinibranch") sub-second TTL per instance (--ttl-seconds) [P] Snapshot, branch or restore a running VM (memory + processes) in <250 ms. Layered snapshot build cache. [P] UNVERIFIED UNVERIFIED Morph cloud; self-host mentioned [3P] usage-based
    Runloop devboxes microVM on a custom bare-metal hypervisor [3P] UNVERIFIED ephemeral; suspend on idle [P] Disk snapshots and suspend/resume. Memory is lost on suspend [P]. Snapshot → N parallel devboxes [P]. Network Policies API [3P] UNVERIFIED Runloop cloud; VPC deployment [3P] UNVERIFIED
    CodeSandbox SDK Firecracker [P blog] resume from snapshot within ~1 s; clone within 2 s [P] hibernates after inactivity Live-clone a running VM using copy-on-write disk and memory. Memory snapshot takes ~1 s/GB. [P] UNVERIFIED No CodeSandbox per-minute VM credits [P]
    GitHub Copilot cloud agent Ephemeral GitHub Actions runner [P] Actions job startup UNVERIFIED none (fresh each task). Setup via copilot-setup-steps.yml [P]. Integrated firewall with allowlist. Must be disabled for self-hosted (ARC) runners [P]. via larger runners (UNVERIFIED) GitHub, or self-hosted ARC runners [P] Copilot plan
    OpenAI Codex cloud Container (codex-universal image) [P] cached container reuse Container state cached up to 12 h [P] (users report the cache not being reused [P, GitHub issue #25086]) Setup-script caching only Internet access configurable (default not re-verified) No OpenAI ChatGPT plan
    Claude Code sandboxing / sandbox-runtime (srt) OS-level, no VM: bubblewrap (Linux) or Seatbelt (macOS). Network only through a host proxy over a Unix socket [P]. ~instant process lifetime none Domain allowlist in the proxy [P] host's Your machine free (OSS, research preview) [P]
    Claude Code on the web Anthropic-managed VM [P] n/a session n/a Proxy with a default allowlist. A separate git proxy holds the GitHub token and issues scoped credentials [P]. No Anthropic plan
    Claude Managed Agents: cloud env "isolated Linux container for each session" [P/3P] n/a sessions are long-running and resumable [P] Session state is stored server-side [P] limited (allowed_hosts + package managers + MCP) or unrestricted. Egress goes through a TLS-inspecting proxy [P, 3P pentest]. No Anthropic per-session pricing (UNVERIFIED)
    Claude Managed Agents: self-hosted env (beta, managed-agents-2026-04-01) Yours Yours Yours Yours; supports memory_store only, no file/github resources [P] Yours, and Anthropic is explicit: "there is no default" [P] Yours Any Linux host with /bin/bash and outbound HTTPS [P] infra cost only
    GKE / k8s Agent Sandbox (SIG Apps) Orchestrator over gVisor or Kata via RuntimeClass [P] Warm pool: <1 s, 90% of allocations within 200 ms, 300/s per cluster [P] stateful singleton with scheduled deletion Pod snapshots, suspend/resume; v1beta1 since v0.5.0 (2026-06) [3P] Default-deny NetworkPolicy; FQDN egress needs a CNI such as Cilium [3P] via node pools Any Kubernetes cluster (EKS included) [P] cluster cost
    AWS Bedrock AgentCore Code Interpreter / Runtime microVM per session, memory sanitized after [P] "fast session initialization" 8 h on microVMs, 14 days on EC2-backed "Instances". Idle timeout 15 min [P/3P]. ephemeral by default [P] VPC-configurable (not detailed here) No AWS-managed, in your account's billing $0.0895/vCPU-h (active CPU only) + $0.00945/GB-h [3P, rechecked by them 2026-10-13]
    AWS Lambda MicroVMs (GA 2026-06-22) Firecracker, no shared kernel [P] Starts from a pre-initialized snapshot. "~2 s cold start" [3P]. 8 h total, running plus suspended, not adjustable [P/3P] Suspend/resume keeps memory and disk. Idle policy auto-suspends and auto-resumes [P]. Public internet by default. VPC access through a Lambda Network Connector [P]. Not mentioned [P]; "skip it if you need GPUs" [3P] Your account. Regions: IAD, CMH, PDX, DUB, NRT [P]. ARM64 only [P]. Per-second baseline compute. $0.08/GB-mo snapshot and image storage (image storage has a 1-week minimum retention). Snapshot read/write fees. [P/3P]
    Firecracker (raw) KVM microVM; needs /dev/kvm <125 ms boot to init for a minimal guest; restore can take ~4 ms [P paper/spec]. ≤5 MiB VMM overhead [P spec]. yours full and diff memory snapshots [P] yours (tap + host firewall) No PCI passthrough bare metal or a nested-virt EC2 instance infra cost

    1.2 Docker Sandboxes, verified

    • What it is. The sbx CLI runs a coding agent (Claude Code, Codex, Copilot CLI, Gemini CLI, Kiro, Cursor, …) inside a microVM with its own kernel and a private Docker engine. The agent can therefore run docker build and docker run without access to the host daemon [P: docker.com/products/docker-sandboxes; docs.docker.com/ai/sandboxes].
    • Timeline.
      • The microVM version launched for macOS and Windows on 2026-01-30, described as "the next evolution". An earlier, weaker version existed before it [P: docker.com blog 2026-01-30].
      • Linux is now available through the docker-sbx apt package, which needs membership in the kvm group [P: github.com/docker/sbx-releases].
      • Cloud Sandboxes need sbx ≥ 0.45.1 and a pay-as-you-go plan. Their launch date is UNVERIFIED; the blog exists [P].
    • Features.
      • "Kits": YAML defining tools, credentials, network rules and config.
      • A per-sandbox MCP catalog (sbx mcp), with credentials held in the sbx secret store.
      • Org-wide policy through "Docker AI Governance" [P].
    • Not stated: the hypervisor, the lifetime cap, and cloud-side BYO-account support. There is no sign of a BYO-AWS backend (UNVERIFIED).

    1.3 What sandboxes solve for agent builders

    Job Needs Best-served today by
    Run untrusted, LLM-written code per tool call Strong isolation, fast create, short life E2B, Daytona, Lambda MicroVMs, AgentCore Code Interpreter
    Long-running autonomous coding agent ("YOLO mode") Persistent filesystem, Docker-in-sandbox, egress policy, credential proxy Docker Sandboxes, Sprites, Codex/Copilot/Claude Code web
    Parallel attempts, best-of-N, RL rollouts and evals Fork/branch from a prepared state, high creation rate, cheap per-rollout Morph (live branch), CodeSandbox (live clone), Sprites (checkpoint pools), GKE warm pools
    Reproducible environments Image or template build cache, snapshots Morph layered snapshots, Runloop blueprints, Modal images
    Browser and computer use Desktop/VNC, persistent profile E2B desktop, AgentCore Browser
    Data science on real data Large RAM, GPUs, data locality, long runs Poorly served. Modal and Daytona have GPUs but data must leave your account.

    1.4 Common pain points

    These recur across vendor docs and third-party comparisons:

    • Lifetime caps.

      • E2B: 1 h on Hobby, 24 h on Pro.
      • Modal: 24 h.
      • Vercel: 5 h.
      • AgentCore and Lambda MicroVMs: 8 h.

      Long agent runs have to checkpoint and hop between sandboxes [3P bex.co 2026-09-11].

    • No GPUs. This is structural on Firecracker, which has no device passthrough. The exceptions are Modal (gVisor nvproxy), Daytona and Northflank.

    • Data gravity and egress fees. Getting a 2 TB dataset into a vendor cloud is the real cost. Lambda MicroVMs charge VPC data transfer [P].

    • Vendor lock-in. Each SDK is bespoke. Claude Managed Agents' worker protocol is becoming a de facto common seam: 11 providers publish guides [P].

    • Can't use your own IAM, VPC or account. Only Lambda MicroVMs, AgentCore, E2B BYOC, Northflank BYOC and k8s Agent Sandbox fix this.

    • Cost at scale and structural minimums.

      • E2B's $150/mo floor [3P].
      • Snapshot storage metered on Lambda MicroVMs, about $962/mo for a 1,000-VM hibernating fleet [3P murraycole].
      • Paying for warm pools.
    • Cold starts if you go without snapshots or warm pools.

    • Egress allowlists are leaky.

      • Modal admits a domain-fronting gap [P].
      • Anthropic warns that an allowed host is an exfiltration channel [P].
      • A pentest found Managed Agents' allowlist silently includes infrastructure hosts [3P pluto.security].
    • Cleanup. Paused and snapshotted state accrues cost; E2B deletes paused sandboxes after 30 days. Nobody advertises an "everything dies eventually" guarantee as a first-class contract.


    Part 2: What spore.host already has

    2.1 Capability map against the sandbox checklist

    Sandbox feature spore.host today Evidence
    Create an ephemeral environment spawn launch / spawn task run. An EC2 instance in the user's account, using the user's credential chain. spore-host/docs/architecture.md
    Isolation A whole EC2 instance: Nitro hypervisor boundary, single tenant per sandbox. Stronger than any shared-host microVM, but coarse. (by construction)
    Lifetime guarantee TTL is an absolute deadline that never resets and only spawn extend moves forward. Also a cost limit and idle stop/hibernate. "TTL always wins." spore-host/docs/safety.md; spawn/pkg/taskproto/taskspec.go (Lifecycle{TTL, OnComplete, CostLimit})
    In-instance enforcer spored daemon, KMS-signed, verified at install spawn/pkg/sporedinstall (SigningKeyPEM), spawn/pkg/agent
    Out-of-band backstop ttl-reaper Lambda. Reaps on deadline tag, launch-time+ttl, or a hard REAPER_MAX_AGE ceiling. Scans stopped instances too. Optional graceful pre-stop flush via SSM. spawn/lambda/ttl-reaper/main.go header; spawn reaper deploy/arm/status/teardown (spawn/cmd/reaper.go)
    ⚠ Backstop is opt-in "The reaper is not enabled by default." CLI-only mode has spored as the single enforcer. spore-host/docs/safety.md ("What the guarantee is by deployment mode")
    Batch exec with a durable result spawn task run --spec. Stage inputs from S3, run on the host or in a container, stage outputs, write completion.json to s3://spawn-results-<acct>-<region>/tasks/<id>/. Self-terminates. A terminal-flush hook preserves logs on TTL kill. spore-host/docs/gen/spawn/task.md; spawn/cmd/task.go (~L540–575)
    Container runtime Docker is installed on demand (dnf install -y docker; the stock AL2023 AMI has none). GPU instances get --gpus all plus the NVIDIA toolkit. spawn/pkg/taskproto/wrapper.go L398–476
    Per-sandbox IAM The task gets a scoped instance profile: exactly the input/output/results buckets, plus ecr:ReadOnly for private images. spawn/cmd/task.go (comment "Scoped instance profile")
    Reusable warm workers spawn pool create/submit/status/drain. N workers pull TaskSpecs from a run-scoped SQS queue; idle-timeout drain (default 5 m); per-worker TTL (default 4 h); Spot; min-viable degradation. Built on cohort (concurrent launches). spore-host/docs/gen/spawn/pool.md; spawn/docs/pooled-task-execution-design.md; spawn/pkg/taskpool
    Interactive access spawn connect over SSH or SSM Session Manager (keyless, with SSM key injection), plus RDP-over-SSM for Windows spawn/cmd/connect.go
    Expose a service / preview URL spawn service uses a readiness contract (one JSON {"event":"ready","addr":...} line) to tunnel a local port. spawn app covers DCV desktop/app/web kinds. Custom DNS (#891). spawn/docs/service-readiness-contract.md, spawn/cmd/app.go, spawn/docs/custom-dns.md
    Data access S3 staging; EFS and FSx for Lustre mounts (FSx lease and cost gates); attach EBS reference-data volumes built from raw images with spawn snapshot create spawn/cmd/fsx.go, spawn/docs/durable-storage-fsx.md, spawn/docs/reference-data-volumes.md, spawn/cmd/snapshot.go
    GPUs / capacity truffle finds instance types, GPUs, Spot prices and quotas. Capacity blocks. lagotto watches for and holds capacity. truffle/, spawn/cmd/capacity_block.go, lagotto/
    Nested virtualization spawn launch --nested-virtualization, with a pre-launch check of ProcessorInfo.SupportedFeatures spawn/cmd/launch_flags.go L269; spawn/pkg/aws/placement.go L157
    Hibernation --hibernate, --on-idle hibernate, --on-complete hibernate (memory saved to encrypted EBS) spawn/cmd/launch_flags.go L308–321
    Results retention Recompute-class tagging; lifecycle tiering; opt-in regenerable deletion spawn/docs/recompute-tag-design.md, taskspec.go Regenerable
    Account guard --account persistent flag: an "expected AWS account ID (optional guard)" spawn/cmd/root.go L159
    Agent access (MCP) spore-host-mcp tools:
    • truffle: truffle_find, truffle_spot_prices, truffle_quota_check
    • spawn: spawn_list/status/stop/terminate; terminate is two-phase and refuses ambiguous names
    • spawn_extend
    • lagotto: lagotto_list/status/watch
    • Billable: spawn_task_run (TTL mandatory, dry_run), spawn_app_launch (plan only)
    spore-host-mcp/README.md, launch.go L27–42, L121–139
    SDKs Python SDK (truffle find/spot, spawn list/status/extend/wait); spawn-ts (browser-native, no backend); Go pkg/launcher python-sdk/README.md, spawn-ts/README.md
    Modal migration path calque, a spike that runs Modal-shaped scripts on AWS unchanged calque/README.md

    Correction (2026-10-19): the research draft reported doc drift in spore-host/docs/tools/mcp-server.md. That was read from a stale local clone; main already documents spawn_task_run as a billable launch tool (docs sweep part 1, #589).

    2.2 Honest gaps against a sandbox product

    Gap Detail Severity for a sandbox
    Cold-start latency Docs: "takes 30–90 seconds to boot and start sshd" (spore-host/docs/reference/faq.md L99). Container tasks then add an on-demand Docker install and an image pull. EST: 60–180 s to first command for task run with a container, versus 0.1–2 s for microVM incumbents. Pools remove the boot tax per job, but the pool itself still boots cold. High for per-tool-call use; low for hour-long sessions
    No interactive programmatic exec/file API connect is a human SSH/SSM session. task run is fire-and-forget batch. Nothing like exec(cmd) → {stdout, stderr, exit} or write_file / read_file for an agent loop, and no MCP equivalent. High; this is the sandbox API
    No snapshot/fork of a running environment spawn snapshot only builds data volumes from raw images. Hibernation preserves memory for the same instance and cannot fork. Creating an AMI or EBS snapshot is a minutes-scale operation and the new volume hydrates lazily (EST). Medium–high (best-of-N, RL)
    No egress policy spawn security groups use EC2's default allow-all egress. The only explicit egress rule is the EFA self-reference (spawn/pkg/aws/securitygroup.go). No domain allowlist, no proxy. High for untrusted code
    No credential proxy The task role is scoped, which is good. But any secret given to the agent lands inside the box. There is no Managed-Agents-style vault or placeholder injection. Medium
    Reaper not default See above. For agent-created sandboxes, which are prone to sprawl, spored alone may not be enough. High given "cost control is existential"
    Minimum billing and stopped cost EC2 bills a 60 s minimum (from memory; verify). Stopped or hibernated instances keep billing for EBS (flag help text says so). Low–medium
    "Who reaps the reapers" The reaper covers EC2 instances and Spot requests. Any new sandbox artifact type must be added explicitly: microVM images, snapshots, S3 checkpoint prefixes, Lambda MicroVM images. Design constraint

    2.3 Latency estimates (EST, not measured)

    Path Estimate Basis
    spawn launch → SSH ready 30–90 s faq.md
    spawn task run (container) → first user command 60–180 s boot + dnf install docker (EST 15–45 s) + image pull (size-dependent)
    spawn task run (host command, pinned type) → command 35–100 s boot + userdata; sizing is skipped for a pinned type (design doc, sizer.go:48)
    spawn pool submit → job starts on a warm worker ~1–20 s SQS receive (long-poll ≤20 s) + stage-in; the design doc measured per-job cost as "stage+run only"
    Start a stopped pre-built instance EST 15–45 s EC2 start + OS boot (from memory)
    Resume a hibernated instance EST 20–60 s RAM restored from EBS; scales with RAM (from memory)
    Firecracker restore on a nested-virt host EST 50–500 ms <125 ms boot spec, ms-scale restore [P]. AWS warns nested virt may be slower [P]. Must be measured (Experiment E2).

    Part 3: Design options

    The design principle across all options: the sandbox is a spore. It carries spawn:* tags with a TTL deadline, a cost limit and idle rules. It is enforced by spored, or by a host daemon that is itself a spore. It is backstopped by the reaper, and it lives in the user's account.

    Option A: spawn sandbox, an agent-friendly API over EC2 spores (single tenant per sandbox)

    Shape

    spawn sandbox create  --ttl 4h --cost-limit 5 [--gpu 1 | --type g6.xlarge | --cpu 4 --mem 16]
                          [--image ghcr.io/…] [--egress none|s3|allow:<file>|open]
                          [--data s3://bucket/prefix:ro --efs fs-… --fsx fs-…]
                          [--from <snapshot-id>] [--warm-pool <name>]   → sandbox id (JSON)
    spawn sandbox exec    <id> [--timeout 10m] [--cwd …] [--env K=V] -- cmd …   → {stdout,stderr,exit_code}
    spawn sandbox cp      <id>:/path ./local   |   ./local <id>:/path      (S3-relayed, so no inbound ports)
    spawn sandbox snapshot <id> [--name …]     → AMI + EBS snapshot (disk only; RAM state not captured)
    spawn sandbox fork    <snapshot-id> --count N            (N sandboxes from the snapshot)
    spawn sandbox expose  <id> --port 8080                   (readiness contract + SSM tunnel / custom DNS)
    spawn sandbox ls | status | extend | destroy
    

    The same operations go into a Go package (pkg/sandbox), the Python SDK and the MCP server (Option C).

    Architecture: reuse almost everything

    Need Reuse
    Launch, size, GPU, Spot, capacity pkg/launcher, taskproto.Size() / truffle, capacity blocks, lagotto "wait for capacity"
    Lifecycle spored TTL, cost-limit and idle; on-complete terminate; reaper (REAPER_MAX_AGE ceiling)
    exec SSM SendCommand/RunCommand (keyless, no inbound SG) for batch exec. SSM Session for streaming PTY. The reaper's graceful tier already uses SSM RunCommand. Output over 24 KB goes to S3 (EST of the SSM inline-output limit; verify).
    cp Presigned S3 relay through the results bucket. The scoped instance profile already exists.
    Container TaskSpec container path. Pre-bake Docker and the NVIDIA toolkit into a sandbox AMI to remove the on-demand install. This also helps the open GPU-in-container issue spawn#606 (from memory).
    Expose a port spawn service readiness contract, SSM port-forward, custom DNS
    Warm pool spawn pool with a twist. Instead of pulling TaskSpecs, the pool holds pre-booted idle instances that are claimed by sandbox create. They are retagged with the new owner/TTL and receive a fresh role session. Alternatively, keep stopped instances as a cold pool, which pays EBS only.
    Snapshot / fork CreateImage (no-reboot) → AMI; fork = launch N from the AMI. EBS Fast Snapshot Restore is optional and costs extra (from memory).

    Isolation and security

    • One sandbox is one EC2 instance, with the Nitro boundary between sandboxes. Within the user's account, the agent's blast radius is its instance role.
      • Default to no inbound ports (SSM only).
      • Use a role scoped to the declared data plus the results prefix.
      • No user credentials are copied in.
    • Egress profiles, enforced outside the guest. The agent has root in the guest, so in-guest proxies are bypassable.
      • none: a security group with no egress except VPC endpoints for SSM, S3 (gateway endpoint, free), STS and ECR. A per-sandbox SG via CreateSecurityGroup.
      • s3: as above, plus S3. This is the data-science default.
      • allow:<domains>: egress only to a spore.host egress proxy: a small per-account spore running a filtering forward proxy (SNI/CONNECT allowlist), with the sandbox SG permitting egress only to the proxy's SG. Optionally add Route 53 Resolver DNS Firewall for domain filtering at the VPC level.
        • AWS Network Firewall gives stronger domain filtering, but costs about $0.395/h per endpoint plus about $0.065/GB (from memory, verify). That is too high as a default.
      • open: today's behavior, with a loud warning.
    • Credential proxying (later). A spored-side, or proxy-side, header injector modeled on Managed Agents vaults: the sandbox sees a placeholder and the proxy swaps in the real token for allowed hosts only.

    Latency and cost (EST, 2026-10-18, us-east-1 on-demand)

    Sandbox $/h Source
    t3.medium (2 vCPU / 4 GiB) 0.0416 libs/pricing static table (static; collection date not checked)
    c7i.large (2 / 4) 0.0893 libs/pricing static table
    g5.xlarge (1× A10G) 1.006 libs/pricing static table
    • Comparison: E2B at 2 vCPU / 4 GiB costs about 2×0.0504 + 4×0.0162 = $0.166/h [3P rates]. An Option A sandbox is cheaper per hour for CPU, and GPUs are available at all.
    • It loses badly on start latency (30–180 s) and on per-call churn (60 s minimum billing). It wins clearly for sessions of tens of minutes or more.
    • Warm-pool math: two idle c7i.large held for an 8 h workday ≈ $1.43/day (EST). Stopped-instance pools cost EBS only. At about $0.08/GB-mo for gp3 (from memory), a 30 GB root costs about $2.40/month, or roughly 8 cents a day per stopped instance.

    Lifecycle guarantee. Identical to today's spores. The one new rule: sandbox create should refuse to run, or loudly warn and require --accept-no-backstop, when the account's reaper is not deployed and armed. Agent-created sandboxes are exactly the sprawl case.

    Effort: M. Phases:

    1. A1 (create/exec/cp/destroy, egress none|s3|open)
    2. A2 (sandbox AMI + warm pool)
    3. A3 (snapshot/fork via AMI, allow: proxy)

    Risks

    • SSM RunCommand throughput and output limits for chatty agents. Mitigation: a small exec agent inside spored, over an SSM session or the S3 queue.
    • Start latency kills per-tool-call use. Accept it: position A as a session sandbox, not a per-call one.
    • The egress proxy is new security-critical code.

    Why it beats incumbents for this audience

    • GPUs, any instance size (TB-RAM boxes), Spot.
    • Data never leaves the account; S3, FSx and EFS are mounted locally.
    • No lifetime cap, only the user's TTL.
    • Absolute TTL with a dual-enforced backstop.
    • Per-sandbox scoped IAM.
    • Fits existing workflow adapters.

    Option B: hypha, a microVM broker on nested-virt spores (new top-level tool)

    Name. hypha, with daemon hyphad.

    • A hypha is the thread a fungus extends to explore its surroundings and then retracts. That is a good metaphor for an agent's short-lived probe.
    • Related terms are free for subcommands: sclerotium is a dormant, hardened mass (a snapshot); conidia are asexual clone spores (a fork).
    • Avoid mycelium, the project's former name.

    Architecture

     user / agent / MCP ──► hypha CLI/SDK ──► (in user's account)
                                              ┌───────────────────────────────────────────┐
                                              │ host pool = spores launched by spawn with │
                                              │ --nested-virtualization (c8i/m8i/r8i),    │
                                              │ TTL + idle + cost limit + reaper-covered  │
                                              │  ┌───────────── hyphad ────────────────┐  │
                                              │  │ Firecracker+jailer per sandbox      │  │
                                              │  │ tap/nftables egress + host proxy    │  │
                                              │  │ per-sandbox TTL (≤ host TTL)        │  │
                                              │  │ snapshot/restore/CoW fork (local    │  │
                                              │  │ NVMe/EBS; cold store → S3)          │  │
                                              │  │ exec/files API (vsock agent)        │  │
                                              │  └─────────────────────────────────────┘  │
                                              └───────────────────────────────────────────┘
     control plane: none central. Host discovery by EC2 tags; sandbox registry in a
     DynamoDB table or on-host only (tag the host with counts); S3 for snapshots.
    

    What it reuses

    • spawn launches the hosts: --nested-virtualization and its validation already exist.
    • truffle picks host types and Spot.
    • spored and the reaper bound host lifetime.
    • spawn pool / cohort scales the host fleet.
    • Results and retention tagging covers snapshot objects in S3.

    Isolation and security

    • KVM guest inside an EC2 guest (an L2 VM), with the Firecracker jailer and seccomp.
    • The trust model is single-tenant per account. All sandboxes on a host belong to the same AWS account owner, so a VM escape reaches the owner's own host, not another customer's.
      • Optionally, one host per agent run or project for higher assurance.
    • AWS states customers own "security in the cloud … hypervisor, nested virtual machines" [P]. Patching hyphad, Firecracker and guest kernels becomes spore.host's responsibility.
    • Egress is enforced on the host, outside the guest: nftables on the tap device plus a host-side SNI/CONNECT proxy. This is stronger than Option A's in-VPC proxy because each sandbox gets its own policy cheaply.

    Latency and cost (EST)

    • Warm-host create from snapshot: EST 50–500 ms; nested-virt overhead is unknown (E2).
    • Host cold start: 30–90 s, hidden by keeping ≥1 warm host.
    • Density: a c8i.2xlarge (8 vCPU / 16 GiB, $0.375/h [3P holori]) could host about 6 × (1 vCPU / 2 GiB) sandboxes without CPU overcommit, leaving headroom for the host. That is ≈ $0.06 per sandbox-hour. With 2× CPU overcommit for idle-heavy agents, about 12 sandboxes at ≈ $0.03 each.
      • Compare E2B at 1 vCPU / 2 GiB ≈ $0.083/h [3P rates] and Lambda MicroVMs at its own rates (not verified; see aws.amazon.com/lambda/pricing).
      • Spot hosts could cut this by roughly another 50–70% (EST; Spot interruption kills every sandbox on the host, so pair Spot with snapshot-to-S3).
    • An idle warm host is pure overhead, about $9/day for a c8i.2xlarge. That is the hard economics question for a single researcher.

    Lifecycle guarantee: "everything dies eventually"

    • A sandbox's deadline must be ≤ its host's TTL. hyphad enforces this.
    • The host is a spore, so spored and the reaper kill it at TTL, and every sandbox on it dies too. Nothing can outlive the host.
    • Snapshots in S3 get recompute-class tags and lifecycle rules.
    • The reaper must also learn to sweep orphan S3 snapshot prefixes and any hypha EBS volumes (the "who reaps the reapers" subject).

    GPU story. Firecracker cannot pass through GPUs. Two paths:

    • (i) route GPU requests to Option A, a whole GPU EC2 instance; or
    • (ii) run gVisor (runsc) with nvproxy on GPU instances for container-level isolation of multiple GPU sandboxes. This is Modal's approach for GPU sandboxes [P]. Nested virt isn't available on G/P families per the supported-types list [P].

    Effort: L, ongoing. Image pipeline (OCI → ext4 rootfs + kernel), vsock exec agent, networking, snapshot store, scheduler, upgrades, CVE response.

    Risks

    • Nested-virt performance; AWS itself says to evaluate bare metal for latency-sensitive work [P].
    • Intel-only host families.
    • Becoming a VMM operator.
    • Competing head-on with Lambda MicroVMs, which already does Firecracker-in-your-account with zero ops.
    • It is only clearly better than Lambda MicroVMs if it provides:
      • x86;
      • no 8 h cap;
      • larger guests than 16 vCPU / 32 GB;
      • local FSx/EFS mounts;
      • per-sandbox egress policy;
      • lower cost at density;
      • CoW fork of running state, which Lambda MicroVMs doesn't advertise.

    Option B′: backend abstraction, with Lambda MicroVMs as the "small and fast" backend (buy, don't build)

    • spawn sandbox create --backend auto|ec2|lambda-microvm|hypha. The default auto routes as follows:
      • GPU, more than 16 vCPU or 32 GB, or longer than 8 h → ec2;
      • otherwise lambda-microvm where available (5 regions, ARM64).
    • Image build is aws lambda-microvms create-microvm-image from a Dockerfile plus an S3 artifact [P].
    • spore.host adds:
      • TTL and cost limit (enforced by a sweep, because spored can't run as a privileged daemon in a MicroVM; or a minimal in-guest agent);
      • tags and audit;
      • a unified exec/cp API;
      • MCP tools;
      • a reaper extension that sweeps MicroVMs, MicroVM images (note the 1-week minimum retention fee) and suspended snapshots.
    • Effort: S–M. Risk: the API is new; ARM64 only; and the per-second rates must be verified.

    Option C: MCP-first sandbox tools in spore-host-mcp

    Tools

    Tool Billable? Notes
    sandbox_create Yes ttl required; cost_limit required, with a configurable cap from MCP config; dry_run; returns id, cost/h and deadline
    sandbox_exec No (compute is already running) timeout required
    sandbox_write_file / sandbox_read_file No Size caps; large files go via S3 URIs
    sandbox_snapshot / sandbox_fork Fork is billable Fork count capped
    sandbox_expose_port No Returns a tunnel or DNS URL
    sandbox_list / sandbox_status / sandbox_extend No extend subject to a max-TTL cap
    sandbox_destroy No Two-phase is unnecessary when the caller created it in this session; keep it two-phase for others

    Server-side caps

    • The MCP server is a local process holding the user's credentials, so caps in MCP config (max concurrent sandboxes, max $/day, max TTL, allowed instance families or GPU yes/no) are convenience limits.
    • Hard enforcement must stay out-of-process:
      • per-instance cost-limit and TTL tags (spored plus the reaper);
      • optionally an AWS Budgets action;
      • an SCP the owner sets.
    • Document this split honestly.

    Also: Effort: S once Option A's package exists. Value: Claude Code, Cursor and others gain GPU and data-local sandboxes with one claude mcp add.

    Option D: Ecosystem compatibility

    Target Fit Effort Notes
    D1. Claude Managed Agents self-hosted environment Excellent. The worker is a queue poller with outbound HTTPS only [P], which is spawn pool's exact model. S Recipe: spawn sandbox create --image <ant-worker image> per session via ant beta:worker poll --on-work ./spawn-sandbox.sh [P], running on a tiny poller spore (TTL'd, idle-drained). Session metadata carries s3:// inputs, staged by spawn [P]. Bonus: on Claude Platform on AWS, workers authenticate with IAM SigV4 (AnthropicSelfHostedEnvironmentAccess managed policy) instead of an environment key [P], which maps onto spawn's instance profiles with no secret on disk. Anthropic says egress control "has no default" for self-hosted [P], so spore.host's egress profiles directly fill that gap. Becomes the 12th platform guide: the GPU, data-local, TTL-guaranteed one.
    D2. Claude Code sandbox-runtime inside a spore Good (defense in depth) S Run the agent under srt (bubblewrap plus a proxy) inside an EC2 or microVM sandbox. srt doesn't replace VM isolation, but it adds file and network policy at the process level.
    D3. devcontainer.json as the image spec Good S–M Accept .devcontainer/devcontainer.json, build it into an image, then a sandbox AMI. Familiar to Codespaces and Copilot users.
    D4. E2B-compatible API Plausible, but heavy L The E2B SDK talks to an API plus the in-sandbox envd daemon. Compatibility means implementing both and tracking their changes. UNVERIFIED how stable that surface is. Defer until there is demand.
    D5. Docker Sandboxes Weak ? sbx cloud is Docker-managed. No BYO-cloud backend hook was found (UNVERIFIED). Kits YAML could be imported as a spec format.
    D6. k8s Agent Sandbox SDK Poor fit L It needs a standing cluster, which contradicts scale-to-zero. Only relevant if users already run EKS.
    D7. GitHub Copilot / Codex self-hosted runners Niche M Copilot supports ARC self-hosted runners, but requires disabling its firewall [P]. A spawn-provisioned ephemeral runner pool is possible, but outside the core audience.

    Part 4: Recommendation

    4.1 Positioning

    "The sandbox for real research workloads, in your own AWS account, that can't outlive its deadline."

    Don't compete on 100 ms create. Compete on the things incumbents structurally can't or won't do:

    • GPUs and big memory;
    • data already in the user's S3, FSx and EFS, with no egress bill and no data leaving the account;
    • no vendor lifetime cap (lifetime is the user's TTL);
    • dual-enforced TTL and cost limit;
    • per-sandbox scoped IAM;
    • Spot and capacity blocks;
    • workflow-engine integration.

    Get the fast tier by routing to Lambda MicroVMs before building one.

    4.2 Phases

    Phase Deliverable Size
    P0: de-risk and decide (1–2 wks) Run experiments E1–E3 below. Decide the open questions in 4.4. S
    P1: MVP, spawn sandbox (Option A1) 1. create / exec / cp / status / extend / destroy, with exec via SSM and cp via an S3 relay.
    2. Egress `none
    s3
    P1.5: Managed Agents recipe (D1) Poller spore plus a per-session sandbox script. Documented and validated on a GPU sandbox reading S3 data. Offer it to Anthropic's platform-guide list. S
    P2: v1, fast-enough and forkable 1. Pre-baked sandbox AMI (Docker + NVIDIA toolkit + exec agent).
    2. Warm/stopped pool claim.
    3. snapshot / fork via AMI.
    4. allow: egress through the per-account proxy spore.
    5. Credential placeholder injection.
    6. --backend lambda-microvm (Option B′) with reaper coverage for MicroVMs, images and snapshots.
    M–L
    P3: optional, hypha (Option B) Only if E2 and E3 show:
    • Lambda MicroVMs is inadequate (x86, >8 h, FSx mounts, egress, fork, cost at density); and
    • nested-virt Firecracker hits target latency and density.
    L

    4.3 First concrete milestone

    spawn sandbox A1 + MCP:

    1. An agent in Claude Code calls sandbox_create {gpu:1, ttl:"2h", cost_limit:5, egress:"s3", data:["s3://…:ro"]}.
    2. It runs nvidia-smi and a Python script over the mounted dataset via sandbox_exec.
    3. It pulls a result file with sandbox_read_file, then calls sandbox_destroy.

    Pass criteria:

    • the agent never held AWS keys beyond the local MCP chain;
    • the sandbox had no inbound ports and no internet egress;
    • the reaper was armed;
    • an independent post-run sweep finds zero leaked instances, volumes, SGs, ENIs or instance profiles, and no S3 objects outside the results prefix.

    4.4 Open questions for the owner

    1. Tenancy. Sandboxes stay strictly single-account and BYO? Recommendation: yes. A hosted multi-tenant sandbox service would break "data never leaves your account". Any hosted helper must respect the existing cross-account trust constraints: no trusts toward management or internal accounts.
    2. Reaper as a precondition. Should sandbox create hard-require an armed reaper in the target account, or warn plus --accept-no-backstop?
    3. MCP spending policy. The boundary already moved with spawn_task_run. Is autonomous sandbox creation acceptable with a mandatory TTL and cost limit plus per-day caps in config? Should GPU sandboxes require an explicit config opt-in?
    4. Egress default. none, s3, or open? Recommendation: s3 for data science, with open requiring a flag.
    5. Lambda MicroVMs as a backend. Acceptable to depend on it (ARM64-only, 5 regions, 8 h)? It needs reaper extensions for non-EC2 artifacts.
    6. Managed Agents beta. Is it acceptable to build a recipe on a beta API (managed-agents-2026-04-01)? It is low-cost, because it's a doc plus a script, not core code.
    7. Naming. Is hypha OK for the microVM tier, with sclerotium for snapshots and conidia for forks? Or should everything live under spawn sandbox?
    8. Scope of "fork". Is a disk-only fork (AMI) enough for v1, or is memory-state fork a requirement? Memory-state fork effectively forces Option B.

    4.5 Experiments to run first (specified only; NOT run)

    All experiments follow these rules:

    • Account: the spore.host dev account, region us-east-1.
    • Tags: every resource is tagged spawn:managed=true, spawn:run-id=sbx-exp-<date>-<n>, spawn:ttl-deadline.
    • Launch: via spawn, so spored enforces TTL.
    • Reaper: confirmed armed beforehand with spawn reaper status.
    • Cost: a per-experiment --cost-limit. An AWS Budgets alert is recommended.
    • Teardown: explicit, followed by an independent leak check (below). Record results with timestamps; label anything not measured.

    Leak check (each experiment)

    1. aws ec2 describe-instances --filters Name=tag:spawn:run-id,Values=<id> returns 0 non-terminated.
    2. describe-volumes (tag filter, plus status=available for orphans) returns 0.
    3. describe-snapshots and describe-images --owners self (tag filter) return 0 unless intentionally retained.
    4. describe-security-groups and describe-network-interfaces (tag/name filter) return 0.
    5. aws iam list-instance-profiles (spawn task profile prefix) is unchanged from the pre-run snapshot.
    6. aws s3 ls s3://spawn-results-<acct>-us-east-1/ holds only the expected prefix.
    7. For E3: aws lambda-microvms list-… (exact verbs UNVERIFIED) returns 0 MicroVMs and images.

    E1: EC2 sandbox time-to-first-exec (validates Option A positioning)

    • Matrix: {t3.medium, c7i.large, g5.xlarge} × {cold stock AL2023, cold pre-baked AMI, start-from-stopped, resume-from-hibernate, warm-pool claim}. n=10 each for CPU types; n=3 for g5.
    • Metric: wall time from the API call to the first SSM RunCommand returning echo ok. Also time to the first container command, with and without pre-baked Docker.
    • Bounds: TTL 30 m per instance; --cost-limit 1 (CPU), 3 (GPU).
    • Budget (EST): CPU ≈ 100 runs × ~5 min × ≤$0.09/h ≈ <$1. GPU ≈ 15 runs × ~10 min × $1.006/h ≈ $2.5. EBS and AMI storage are negligible if AMIs are deregistered the same day. Total ≲ $5.

    E2: Firecracker on nested virtualization (de-risks Option B)

    • Host: spawn launch --nested-virtualization --type c8i.2xlarge --ttl 2h --cost-limit 3. Optional comparison: one m8i.2xlarge (EST similar price).
    • Bare-metal comparison is optional and gated: a c8i.metal-48xl costs several $/h (UNVERIFIED price), so cap it at --ttl 1h --cost-limit 12.
    • Measure:
      • (a) Cold boot of a minimal guest to init.
      • (b) Snapshot restore at 1 GiB and 4 GiB guest RAM.
      • (c) Full memory snapshot write time per GiB. The CodeSandbox figure is ~1 s/GB on bare metal [P].
      • (d) CoW fork of a running VM (diff snapshot + reflink rootfs).
      • (e) Max density at 1 vCPU / 2 GiB before p95 exec latency doubles.
      • (f) CPU benchmark overhead, L2 versus L1.
      • (g) Egress enforcement: a guest-root attempt to bypass nftables and the host proxy must fail.
    • Budget (EST): c8i.2xlarge 2 h × $0.375 ≈ $0.75, plus gp3 100 GB for 2 h ≈ $0.02. ≲ $1 without metal; ≲ $13 with the metal comparison.
    • Teardown: the host TTL kills everything. Then run the leak check. No artifacts are intended to persist.

    E3: Lambda MicroVMs as a backend (validates Option B′)

    • Build one image (AL2023 base + the same exec harness). Measure:
      • create→first-exec;
      • suspend and resume times;
      • exec round-trip;
      • VPC access to an S3 gateway endpoint;
      • egress controls.
    • n=20 launches at 2 GB / 1 vCPU baseline.
    • Bounds: each MicroVM gets an explicit terminate plus an idle policy (maxIdleDurationSeconds: 300). Image deregistered at the end; note the 1-week minimum image-storage charge.
    • Budget (EST): under $2 compute (rates UNVERIFIED), plus about $0.08/GB-mo × image size × ≥1 week.
    • Leak check: list MicroVMs and images, and check the CloudWatch log group /aws/lambda/microvms/<image> (delete it).

    E4 (optional): gVisor on a GPU instance

    • runsc --nvproxy running a CUDA container on g5.xlarge; measure overhead against plain Docker.
    • Bounds: TTL 1 h, cost limit $2.

    Decision rule after P0

    • Build B (hypha) only if all of these hold:
      • E2 shows restore ≤500 ms p95 and acceptable density on nested virt;
      • E3 shows a concrete Lambda MicroVMs blocker for target users;
      • there is real demand for sub-second x86 or FSx-mounted sandboxes.
    • Otherwise ship A + B′ + C + D1.

    Sources

    Primary

    Third-party (leads, not facts)

    Local code (read 2026-10-18; spawn at aed2c2c, latest tag v0.135.0 locally)

    • spawn/cmd/{task.go,connect.go,launch_flags.go,reaper.go,snapshot.go,root.go}
    • spawn/pkg/{taskproto,taskpool,agent,aws/securitygroup.go,aws/placement.go,sporedinstall}
    • spawn/lambda/ttl-reaper/main.go
    • spawn/docs/{pooled-task-execution-design.md,service-readiness-contract.md}
    • spore-host/docs/{safety.md,architecture.md,reference/faq.md,reference/lifecycle-events.md,tools/mcp-server.md,gen/spawn/{task,pool}.md}
    • spore-host-mcp/{README.md,launch.go}
    • python-sdk/README.md, spawn-ts/README.md, calque/README.md, cohort/README.md, libs/pricing/ec2.go
  3. added
    enhancement
    on Oct 19, 2026
  4. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Owner decisions (2026-10-19) on the open questions in 4.4:

    1. sandbox create requires an armed reaper in the account: yes.
    2. An agent may create billable sandboxes: yes, as an option. It must be enabled explicitly, not on by default.
    3. Egress default: S3, with EFS as a likely second option.
    4. Lambda MicroVMs: acceptable, but the owner's preferred direction is our own microVMs on EC2 hosts. EC2 is slow to start, but warm hosts make the microVMs fast. That is Option B (hypha). So B is no longer gated only on E2/E3 results: it's the intended direction, and the experiments size it.
    5. A disk-only fork is fine for v1.

    Related prior work: scttfrdmn/ember. Ember is intent-driven minimal compute: Go code is statically analysed (Giri) into an intent manifest of memory and compute bounds and capabilities, compiled to minimal WASM, and run by a "hearth" that builds only the execution surface the manifest asks for. Ember would sit above hypha as the lightest isolation tier, see below.

  5. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Isolation tiers. Each tier runs on the one below it, and the reaper and spored bound all of them. The cold-start figures are estimates until E1 and E2 measure them.

    Tier Unit Isolation Cold start (est.) For
    EC2 spore (today) an instance a full VM minutes GPUs, big memory, long runs, FSx/EFS data
    hypha a Firecracker microVM on a warm nested-virt spore a microVM, its own kernel ~100 ms–1 s from a snapshot agent sandboxes: shell, packages, a full Linux
    ember (scttfrdmn/ember) a verified WASM module from Go source WASM linear memory plus capabilities proved by static analysis microseconds–milliseconds small pure functions agents write: tool calls, transforms, validation

    The tiers are layered rather than competing:

    • An ember hearth can run inside a hypha microVM, or directly on a spore or a pool worker.
    • A hypha host is itself a spore, so nothing outlives the host's TTL.

    The agent-facing API (spawn sandbox / MCP) could choose the tier from the request: code-only goes to ember, needs a shell goes to hypha, needs a GPU or big data goes to a spore.

  6. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    E1 results: EC2 time to first exec

    Run on spawn v0.135.1 in us-east-1 on 2026-10-19, with at most 4 instances running at once. The total cost was about $0.11. An independent leak check afterwards came back clean. GPU (quota 0) and the pre-baked AMI mode were not run.

    Mode First exec (median, range)
    Cold launch, stock AL2023 (t3.medium / c7i.large) ~21–24 s (20–25 s)
    Start from stopped ~22–24 s (20–29 s), no faster than cold
    Resume from hibernate 3–4 min (54 s–5.3 min). EC2 reports running in about 15 s, but SSM commands don't run for minutes
    task run, host, auto-sized 211 s, mostly instance-type sizing (2.5–7 min)
    task run, host, type pinned ~53 s
    task run, container, type pinned ~95 s (installing Docker takes ~66 s)
    task run, container, auto-sized failed 3 of 3: t4g.nano is OOM-killed during the Docker install
    Warm pool claim, submit to completed ~4.5 s

    What this means for the design:

    • A cold EC2 launch already reaches first exec in about 20–25 s, which is far better than the brief's 60–180 s estimate.
    • Stop/start buys nothing over cold, and hibernate is slower if exec goes over SSM.
    • Most of the time in task run is sizing, not EC2. Pinning the type or caching the sizing would close most of that gap.
    • A warm pool already gives seconds-level claims. That supports the hypha direction: warm hosts, fast units.
    • The next steps are a pre-baked AMI with Docker installed, then E2 (Firecracker on a nested-virt host).

    Issues filed from this run are linked below.

  7. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Filed from E1:

  8. modified the milestones: Later, Post-1.0 on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions