Code Sandbox Cold Starts: Memory Snapshots vs. Pools

On November 9 and November 13, 2026, Amazon Web Services detailed Amazon Bedrock AgentCore Runtime V2, introducing snapshot-based microVM session restoration that pushes cold starts below two seconds for isolated sessions scaling up to 8 vCPUs and 32GB of memory. As autonomous coding agents, data notebooks, and browser tools spin up millions of untrusted per-user sandboxes weekly, memory snapshots are displacing expensive pre-warmed container fleets.
Whenever an AI assistant runs generated Python scripts, executes shell tests, or previews customer code, running untrusted commands inside shared application servers invites instant compromise. Platforms isolate each run inside strict microVMs (Firecracker) or locked sandboxes. Yet booting a fresh Linux kernel, mounting gigabyte Python/Node packages, and warming language servers from zero typically consumes 10 to 30 seconds, frustrating interactive users waiting on their first code run.
The economics of warm container pools
Platform engineers originally masked slow sandbox boots by keeping massive pools of pre-booted, idle virtual machines running warm around the clock. When a user hit "Run," an orchestrator popped a pre-initialized VM off the warm queue in 200 milliseconds.
Warm pools work nicely during steady afternoon traffic and fail miserably on spiky agent workloads. If an autonomous coding pipeline suddenly fires 400 parallel sandbox runs at 10:02 a.m., a 100-VM warm buffer empties in seconds, throwing the remaining 300 agents back onto slow cold starts. Keeping 500 idle VMs running 24 hours a day just to absorb sudden morning spikes doubles compute waste, driving up per-session unit bills across SaaS startups.
| Sandbox startup strategy | Cold-start user wait | Idle server bill | Multi-tenant security hygiene |
|---|---|---|---|
| Cold kernel and container boot | 10 to 30 seconds | Zero idle waste | Clean fresh isolation per run |
| Pre-warmed container standby pool | Under 300ms until pool drains | High; pays continuously for empty RAM | Must scrub or isolate pooled state carefully |
| Memory snapshot restore (Runtime V2 / CRIU) | Typically sub-second to ~2s | Near zero idle compute; pays small snapshot storage fee | Restores from immutable clean golden image |
How golden memory snapshots work
Memory snapshot restoration flips initialization economics by doing boot work exactly once offline. Platform engineers launch a template microVM containing Python, Node, TypeScript, popular data packages, and project test runners, pause the guest cleanly right after initialization finishes, and capture an immutable disk-and-memory snapshot image. Because standard language packages sit already unpacked inside a shared read-only root filesystem, each session only allocates a compact writable scratch overlay for temporary edits and build logs.
When a user or agent requests a fresh coding sandbox later, the hypervisor maps that frozen memory state straight into a new isolated VM on demand using copy-on-write paging. Only changed memory pages get written privately per session, bringing fully hydrated Linux toolchains online inside one to two seconds without keeping idle servers humming overnight. Parallel techniques carry directly into container cluster portability discussed in live-migrating stateful pods across volatile spot instances. Engineering leaders also pair snapshots with smart task routing: ultra-brief mathematical checks run straight inside disposable microVMs that terminate after five seconds, while interactive multi-file refactoring rooms hold warm memory leases for fifteen minutes between consecutive agent tool calls.
Hidden traps inside snapshot restoration
Cloning running memory snapshots introduces two subtle engineering bugs that break careless teams. First, deterministic randomness and secrets inside a frozen VM repeat verbatim across every child session if left unchecked: an RNG seeded before snapshotting generates identical temporary IDs across ten different customer sandboxes, and baked environment credentials leak globally. Teams must wipe secrets prior to capture and inject fresh entropy plus unique per-session tokens immediately upon restore.
Second, bloated base snapshots full of unused 20GB libraries strain cluster storage bandwidth whenever hundreds of nodes hydrate copies simultaneously, making layer deduplication critical just as in mounting OCI model volumes on Kubernetes. Combined with lighter execution edges explored in purpose-built agent browsers, fast snapshot sandboxes let software platforms deliver clean per-task security isolation without paying idle capacity bills all night.
Sources
- Architecture Patterns for Fast Session Startup on Amazon Bedrock AgentCore Runtime: AWS Machine Learning Blog, 13 November 2026
- AWS Weekly Roundup: AgentCore Runtime V2: Amazon Web Services, 9 November 2026
- Firecracker MicroVM Snapshots Documentation: Firecracker Project, 2026



