AgentCore Runtime V2 Snapshot Mechanism: Recommendations to Reverse Cold-Start Optimization
Amazon Web Services explains how AgentCore runtime V2 changes session startup behavior by initializing once and restoring snapshots, indicating that traditional cold-start recommendations must be reversed.
Traditional cold-start advice is to delay imports and minimize initialization so the first request triggers actual work as quickly as possible. In an engineering blog post published on November 13, 2026, Amazon Web Services states that this advice needs to be reversed for AgentCore runtime V2: initialization runs only once and is frozen into the snapshot, while deferred static work in the handler incurs a cost with every new session.
The V2 mechanism works as follows: when creating or updating a runtime, the platform starts the container, waits for the health check to pass (within 120 seconds), clears the operating system file cache, freezes the microVM, and saves memory and disk state as a snapshot. Subsequently, each new session no longer pulls the image or runs initialization code; instead, it restores the snapshot into a new microVM, allowing the process to resume from the frozen point, with imported libraries, created objects, and clients already present in memory.
This brings three direct implications. First, complete memory restoration: any data held during the initialization phase, including content on RAM-backed file systems, becomes available at memory speed from the first access. Second, file reads do not carry over: because the file cache is cleared before freezing, files read during initialization must still be fetched from the image in restored sessions. Third, image files are loaded on demand: the first time a specific data block is read, it is pulled from snapshot storage and then cached closer to the host.
Therefore, the correct refactoring direction is to move static work into initialization. Create objects rather than merely importing modules, because object creation loads their dependencies and keeps them in active memory. Create boto3 clients during initialization; endpoint resolution and credential resolution are restored with the snapshot, and sockets automatically reconnect on the first call. Read static data such as prompts, configurations, and small indexes into memory-held objects rather than reading from the image with every request. For files that cannot be held within the process—such as independently running CLI toolchains or browser binaries—they can be copied to RAM disks like /dev/shm, or pre-warmed using build hooks during snapshot construction.