Est.

The Hidden Billing Penalties of Stateless Cold Starts for Long-Running Agent Workloads

Cold starts on serverless stack up hidden costs for long-running AI agents.

· 8 min read
Cover illustration for “The Hidden Billing Penalties of Stateless Cold Starts for Long-Running Agent Workloads”
Agent Hosting Economics · October 29, 2026 · 8 min read · 1,861 words

For long-running AI agents, the biggest difference between persistent infrastructure and serverless functions is what has to be rebuilt between turns. Stateless cold starts can charge repeatedly for image loading, SDK initialization, and state reconstruction, including model tokens spent restoring context. Snapshot-restore infrastructure can avoid much of that repetition, but its advantage depends on utilization, restore costs, and session limits.

Why long-running agent workloads break the assumptions serverless billing was built on

Stateless serverless billing assumes short, uniform executions. Agents instead chain tool calls, maintain session state, and alternate between waiting and bursts of activity. Their work spans turns, but a stateless runtime starts from scratch with each fresh execution. That mismatch makes rebuilding the environment part of serving the task, even when the task itself has barely changed.

The runtime alone does not explain the difference. A conventional function and an agent function may run on the same infrastructure, but the agent has more to set up in its environment before business logic begins. A warm invocation may finish in hundreds of milliseconds, while a cold invocation can take tens of seconds. For AI agents with GPU inference, serverless cold-start latency runs 40–120 seconds. When a multi-step chain runs into cold starts over and over, teams pay each time for that setup, but most never see it broken out on the bill.

What container image size does to the first bill line item teams never watch

Image loading is the first layer of that expense. Before an agent can execute, its container image must be present, and image pull duration is billable wall-clock time on most serverless runtimes. The function is allocated while it is still being set up. No useful task work has happened yet.

A thin Python handler has no agent-container image to pull. An agent container, however, includes model clients, vector store connectors, and orchestration libraries that enlarge the image before business logic contributes much of its size. Tooling richness therefore affects more than what the agent can do. It also affects how long the runtime spends getting ready to do anything. A bill that groups preparation with execution can hide this relationship, leaving teams to interpret deployment overhead as the cost of the task itself.

SDK and dependency initialization as a silent tax on every cold invocation

Having the image present does not make the agent ready. Importing the Anthropic Python SDK, OpenAI client, boto3, and similar libraries adds 3–8 seconds to a cold start as dependency trees and connection pools are prepared. Those seconds precede the handler’s first instruction. For an agent that calls external APIs rather than loading a local model, SDK initialization and TLS handshakes can account for most cold-start latency.

Initialization placement determines how often some of that work repeats. Clients created inside the handler are re-created when that handler runs, including the work of establishing TLS and validating credentials. The practical correction is to initialize clients at module scope, making that preparation a one-time cost per container lifetime. It does not eliminate initialization for a fresh container. Even agents that run inference elsewhere must therefore pay for image loading and SDK startup.

The August 2025 Lambda INIT-phase billing change and what it did to the cost math

AWS began charging for the INIT phase on Lambda cold starts on August 1, 2025. Initialization time that had previously been latency overhead became directly metered compute usage. For functions with heavy AI SDK initialization, the change can increase Lambda costs by 10–50%. The financial effect follows the startup path.

The increase is not uniform across functions. Costs rise a little for thin functions that are quick to initialize, and more for agent functions with large dependency trees and slow SDK startup. This distinction makes an old execution budget a poor guide to the current bill when that budget excludes INIT. Teams that priced Lambda before August 2025 and did not reprice afterward are using a model that omits a now-billable phase. Startup complexity has become a purchasing variable as well as an engineering concern.

State re-hydration: the cost layer that appears on no cloud invoice

Once the runtime is ready, the agent may still need context before it can go on. A stateless cold start can require files, credentials, repository checkouts, and architectural constraints to be reconstructed. An agent that needs a cloned repository, loaded dataset, or running dev server may spend a substantial share of total task time restoring its working environment. That time consumes compute and delays the user.

Re-hydration also reaches beyond the compute bill. Each new invocation that must explain the same architectural context to the model spends tokens on information a session-persistent agent would already hold. The repeated portion scales with how often context must be rebuilt. Managing that context also consumes engineering effort. This layer is difficult to identify precisely because its token cost is distributed across routine model API usage, rather than isolated as architectural waste on the compute invoice.

How these layers compound at production scale and what real teams have paid

At prototype scale, each layer can look tolerable. In production, image loading, initialization, metered startup, and context reconstruction can recur together across cold invocations. The compounding comes from repetition across a fleet and through multi-step workflows. Budgets based mainly on model tokens omit orchestration compute, re-initialization, retry waste, and the labor of managing stateless context.

Uber gave roughly 5,000 engineers access to AI coding agents in December 2025. By April 2026, its CTO reported that the full-year budget for those tools was exhausted, prompting a cap per employee per tool per month. Microsoft rolled out Claude Code licenses to developers and later revoked them, citing unsustainable token bills at scale. These outcomes establish the stakes of fleet-wide agent spending. They show why repeated overhead matters once adoption expands.

Four coordinating LangChain agents running a market research pipeline entered a mutual feedback loop in November 2025 and ran for nearly two weeks before anyone noticed, producing a bill in the tens of thousands of dollars. Stateless operation without checkpointing exposes teams to this class of uncontrolled billing event. Provisioned concurrency cuts Lambda cold starts, tackling a different part of the problem, but it adds a lot to the monthly bill for a mid-volume deployment. It also requires accurate traffic prediction, which bursty agent workloads make difficult.

What snapshot-restore architecture changes about the idle-cost equation

Snapshot-restore replaces repeated bootstrapping with a different operation. A microVM boots fully once and is snapshotted after initialization, so later starts restore the environment that is already set up. MicroVM isolation paired with elastic memory management adapts the same technology lineage behind Lambda’s cold-start improvements to stateful, long-running agents.

AWS AgentCore Runtime v2, which shipped on September 18, 2026, illustrates that change. Restoring pre-warmed snapshots brings cold-start latency well within a few seconds for images from 200 MB up to 2 GB. Its consumption billing charges for actual CPU and memory consumption, with CPU scaling to zero during I/O wait and idle memory reclaimed after 120 seconds. The old version kept peak memory allocation for the whole session.

Managed persistence still has a session boundary. The runtime terminates sessions after a period of inactivity or a maximum session lifetime. Agents that must wait longer between turns therefore need to save state and resume in a new session.

The per-user microVM model and what it costs to run a fleet of dormant agents

Combining snapshot-restore with microVM isolation makes a different fleet model possible. Each user’s agent occupies an isolated environment, with storage costs during dormancy and compute costs during active work. For a microVM with a short active window and a long suspended period, savings can exceed ninety percent compared with keeping the same VM always on. Heavier tenants with longer active periods can also save substantially.

Storage management contributes to that difference. Copy-on-write disk management accounts for the base image plus each agent’s small delta of changes, rather than requiring a fully allocated disk per session. This increases the number of isolated agents one host can run from a handful to dozens. The relevant units become stored state during dormancy and compute during active work. The number of users no longer sets the number of instances that must run all the time.

Firecracker microVMs provide the isolation primitive for this model. Each agent has its own kernel instead of sharing the container isolation boundary with other tenants. This gives agent-native products a practical way to keep state and tenants apart through per-user environments. At low activity, infrastructure costs can approach the storage floor.

The objection worth taking seriously: snapshot-restore is not universally sub-second

Snapshot-restore can take more than a second to return to work. The managed-runtime example above starts within a few seconds, and there are also limits to when it saves money. At sustained utilization above a breakeven threshold of 15–25%, keeping a warm instance running continuously can be cheaper than repeated restore cycles. Below that range, snapshot-restore tends to favor the intermittent activity typical of agent fleets.

Calculate utilization before choosing. How often agents wake, their working-set size, and restore charges all affect where a deployment crosses that threshold. A fleet with many dormant users has a different cost profile from an agent environment doing sustained work. Persistent infrastructure is therefore not synonymous with suspension, and always-warm capacity remains a valid option when activity justifies it.

Managed runtimes advertising “active CPU only” billing can charge separately for web search queries, data egress, browser profile storage, and other capabilities. Those charges can make the effective bill substantially higher than the vCPU-hour and GB-hour rates suggest. A sound comparison includes them rather than treating idle compute savings as the whole result.

The diagnostic checklist for developers auditing their own cold-start billing exposure

The audit should begin with the layers actually present. Not every agent pays equally for image loading, SDK startup, INIT, and state reconstruction, so mitigation priorities depend on which dominates. Developers should first establish the container image size and the shares attributable to AI SDK dependencies and business logic. They should then identify whether SDK clients are initialized at module scope or inside the handler. Those two checks show which setup work a fresh environment needs and which initialization repeats because of where the code sits.

The billing model needs its own examination. For Lambda deployments, the audit should establish whether estimates include the August 2025 INIT-phase change. It should also identify which files, environments, and architectural context are rebuilt on each cold invocation. The model API bill then needs to be separated conceptually into tokens used for new work and tokens used to re-explain existing context. Otherwise, lowering compute startup time may leave a substantial re-hydration expense untouched.

Developers should establish what fraction of agents is dormant and whether that dormancy consumes compute or storage. Where idle compute dominates, a snapshot-restore, microVM-isolated, per-user architecture deserves evaluation against the fleet’s actual wake pattern and restore costs. This audit is not a one-time exercise. Agent workloads change, utilization shifts, and billing policies change, as August 2025 demonstrated. Understanding each layer makes a new charge recognizable when it appears, rather than only after it produces a monthly invoice spike.

More in Agent Hosting Economics