Zhidaily AI · Intelligence · Daily
Zhidaily
Issue 15 · November 14, 2026 · Sat
Today's stories
22 stories · 9 companies
Home / November 14, 2026 / AWS explains four patterns for faster session startup on AgentCore runtime V2
← Back
Release Official Agents · Amazon·AWS Score68

AWS explains four patterns for faster session startup on AgentCore runtime V2

In brief
An AWS author breaks down the snapshot-restore mechanism in AgentCore runtime V2 and gives four patterns for moving initialization out of the first request, using build hooks and pre-warming. Teams already on AgentCore can use this to decide which layer to change.
AWS Machine Learning Blog aws.amazon.com
Nov 14 · 06:02 Read the original ↗
01Summary

Interactive agents suffer most when users wait for the first token, and each AgentCore runtime session runs in its own microVM. In V1, every session pulled the image, started the container and ran initialization, so cold start slowed as images grew. The author says V2 moves this work to deployment time, but many agents still need code changes to get the full benefit.

02Background

Interactive agents suffer most when users wait for the first token, and each AgentCore runtime session runs in its own microVM. In V1, every session pulled the image, started the container and ran initialization, so cold start slowed as images grew. The author says V2 moves this work to deployment time, but many agents still need code changes to get the full benefit.

03Approach

V2 works like this: when a runtime is created or updated, a container starts once; after /ping reports healthy, the file cache is cleared, the microVM is frozen, and memory and disk are saved as a snapshot. Each new session then restores the snapshot directly, and the process continues from where it was frozen, with imported libraries, objects and clients all present. Three consequences follow: memory comes back as it was; the file cache is not kept, so reading files in init does not make restored sessions faster; and image files are pulled from snapshot storage only on first read. Based on this, the author gives a layered approach. When about 2 seconds is acceptable, put all static work before app.run(): create objects and boto3 clients in init, read prompts and small indexes into memory, keep tools such as language servers running rather than starting them per request, copy standalone programs like tsc to /dev/shm, and precompile bytecode with UV_COMPILE_BYTECODE=1. The cost is a larger snapshot and paying for resident memory per session, so measure end-to-end startup time to confirm you have not merely moved the time from the handler to restore. For things that do not fit in the process (model weights, CLIs, browsers), use a build hook: the container exposes an HTTP endpoint that is POSTed twice at build time, distinguished by request headers. The first call is before the snapshot, and anything loaded into memory goes into the snapshot; the second is after a test restore and is used to pre-read files and affect the first pull of later sessions. The two calls share 120 seconds; a non-2xx response or timeout makes the create/update fail with no retry, and logs go to the build-logs- stream. For sub-second startup, start a session in the background when the user opens the app or chat window, send a prime request with the same session ID, and reuse it when the real question comes; the cost is holding a session for users who never send a message, controlled with a short idle timeout. The author also reminds readers to measure first: CloudWatch's Latency is time to first byte and OverheadLatency is platform overhead, and the difference is the time taken by your own code.

04Implications

The author's core conclusion is that V2 moves most of the cost of session startup to deployment time; by putting static work in init, keeping data needed for the first request in memory, and leaving dynamic values in the handler, startup can be brought down to about 2 seconds. For faster startup, open a session before the user acts. Teams already on AgentCore should switch to V2 and measure OverheadLatency first, then decide whether to add hooks or pre-warming.