Ephemeral Execution Units and the Filesystem Persistence Gap in Lambda-Style Agent Runtimes
Persistent AI agents need stateful runtimes, not ephemeral functions designed for stateless work.

Lambda-style execution units are a poor fit for AI agents that need to keep a working filesystem across interactions. The filesystem persistence gap follows from stateless-by-design execution. Persistent AI agent infrastructure instead preserves disk and memory while releasing idle compute, avoiding the repeated reconstruction and distributed coordination that serverless functions require for stateful work.
How Lambda's execution model is designed and what that design assumes
Lambda treats each invocation as independent and self-contained. An execution environment wakes for a request, runs code, and emits output, while the platform manages the resources around that lifecycle. The environment may be reused, but reuse is not guaranteed. A later request therefore cannot depend on local changes made by an earlier one. Statelessness is the contract.
Within that environment, /tmp provides writable temporary storage. Its default capacity is 512 MB, expandable to 10 GB, and its contents disappear when the environment is torn down. More capacity does not change that lifetime. A function can use the space during execution, but it cannot treat those files as durable inputs for its next invocation. Execution also has a hard 15-minute maximum, which places a separate bound on work that must continue within one process.
These constraints suit workloads such as resizing an image, validating a webhook payload, or transforming a JSON object. Each request contains or retrieves what it needs and produces an output without depending on the previous request’s working directory. The platform can discard the environment without losing unfinished local work that the application needs to return to. That is a coherent model for its intended workload. Its mismatch with agents is consequently a structural problem.
What an AI agent actually needs from its runtime between invocations
A coding agent needs more than the next prompt. It may clone a repository, install dependencies, and start a development server before making its first useful change. After an LLM call, it needs to return to the modified codebase and prepared environment. Recreating an empty workspace does not resume that work. The files and running processes are part of the task.
The same distinction applies to a data-analysis agent. Once it has loaded and cleaned a multi-gigabyte dataset, a follow-up question depends on the cleaned data and feature pipeline remaining available. Reloading the original input does not preserve the work already done.
The agent relies on that saved work even more in a patch-and-test cycle that spans hundreds of LLM calls. The agent writes a patch, runs tests, examines failures, edits the patch, and runs tests again. Filesystem state connects those steps. Sessions, skill definitions, memory files, credentials, and unfinished artifacts also need a stable home. Hermes is built to work this way, with a long-lived process and a persistent directory that holds sessions, skills, cron jobs, and memory files. Its layout expects the filesystem to be there next time, while Lambda offers no such guarantee.
The three specific places where the filesystem persistence gap opens on Lambda
The first gap is storage lifetime. Anything Hermes writes to /tmp disappears when its execution environment is destroyed, so a new environment cannot inherit the previous working directory. Warm reuse may conceal the problem temporarily. It cannot establish continuity as an architectural guarantee. Whenever a step enters a fresh environment, the agent must retrieve and reconstruct its working context before continuing the task.
The second gap is concurrent access. Two Telegram messages or scheduled triggers can enter separate execution environments, each without access to the other’s local disk. If a workaround sends both invocations to the same session file, task file, or memory log, their writes still need coordination. Without external arbitration to keep updates in order, concurrent updates can corrupt the agent’s work.
The third gap is process lifetime. Hermes’s scheduled and background work assumes a persistent process that can host cron-style tasks, polling, or deferred execution. Lambda does not provide that resident daemon. Scheduling must move to a service such as EventBridge, which returns work to the agent through a fresh invocation. The Hermes-on-Lambda port thus exposes three separate requirements that local temporary storage cannot meet, namely durable files, coordinated mutation, and background execution. They share a root cause, but repairing one leaves the others unresolved.

Why the standard workarounds — EFS mounts, S3-backed tmp, external state stores — reintroduce the costs ephemerality was supposed to eliminate
The workarounds are legitimate and used in production. Elastic File System, or EFS, supplies durable shared storage that remains available across invocations and to other compute mounting the same NFS path. However, that durability introduces infrastructure that local disk does not require. AWS’s Knowledge Center specifies VPC connectivity to mount targets, an EFS access point, and mounting permissions for the function’s execution role. VPC attachment has cold-start implications, while network file operations add latency and concurrent writes still need explicit advisory locking.
S3-backed temporary storage moves persistence outside the execution environment through retrieval and upload. S3 Files replaces that ceremony with an NFS-compatible interface, but a filesystem-shaped API does not make the underlying operations local. Network round trips remain part of file access. Its close-to-open semantics are not true POSIX semantics, so shared state files still require coordination that the interface does not provide automatically.
The Hermes port illustrates the broader distributed-system trade. DynamoDB handles session state, S3 stores artifacts, EventBridge handles scheduling, and Bedrock AgentCore Memory supplies long-term memory. Each replaces a responsibility previously associated with the persistent process and its filesystem. Each also introduces an API, SDK, and failure mode. These services are operationally coherent, but the developer must now reason across separate latency budgets and consistency contracts. These services can make the agent work on Lambda without changing Lambda’s execution model. What they cannot preserve is the original simplicity of letting one persistent environment hold the agent’s working context.
The startup tax agents pay on every cold invocation when context must be rebuilt from scratch
A cold invocation imposes two distinct startup costs. First, the execution environment must initialize. Then the agent must reconstruct whatever working context did not survive locally. Repository cloning, dependency installation, dataset loading, and development-server startup belong to the second category. Optimizing platform initialization does not eliminate that reconstruction.
For large enterprise codebases, cloning can take minutes. That preparation can be reasonable when paid once for a continuing workspace. That delay comes back when later steps cannot count on the workspace still being there. Warm invocations may avoid some of this work, but their reuse is not guaranteed. An architecture built around continuity cannot make its responsiveness depend on that opportunity.
When each step arrives in a fresh environment, preparation recurs before each useful action, consuming execution time and delaying the next result. The penalty therefore affects both responsiveness and throughput. Teams compensate with caching layers, pre-warming pools, or external state stores, adding engineering work to recover continuity that the runtime does not supply. Those measures can shorten some delays, but the application still has to rebuild context. A runtime can instead keep that context when active execution stops, so the agent wakes with it restored and skips another setup sequence.
What a runtime designed for agent continuity looks like architecturally
A continuity-oriented runtime attaches compute to persistent state. The working directory survives across sessions with its repositories, installed packages, credentials, and memory files intact, without requiring an external storage attachment. Resumption returns the agent to that disk state. Persistent disk saves the runtime from rebuilding disk state, while memory-and-disk snapshots let it keep a prepared process with compute off during idle periods.
Firecracker’s snapshot-restore API enables sub-30 ms sandbox creation from a snapshot. That capability provides a primitive for restoring prior state. It is not, by itself, a guarantee of an entire product’s wake latency. The surrounding runtime must use snapshot-and-restore as its idle mechanism, preserving state when the agent goes quiet and restoring it when work returns.
Isolation answers a different part of the problem. A microVM per agent provides a separate kernel, filesystem, and network namespace, while Firecracker’s one-VMM-per-microVM design maps onto per-tenant deployment. That boundary separates tenants rather than asking them to coordinate access to a common workspace. Within the sandbox, kernel privileges let agents install packages, run compilers, start development servers, and execute user-generated code. Same-agent concurrent work still needs coordination, but separate agents need not share mutable files.
AWS Bedrock AgentCore Runtime illustrates this direction through dedicated session microVMs with isolated CPU, memory, and filesystem state preserved across interactions within a session. Network controls remain necessary as well. Notion Workers on Vercel Sandbox Firecracker microVMs use a firewall and proxy to constrain egress and inject credentials at the boundary, keeping real secrets out of the agent. VM isolation protects the execution boundary, while controlled egress governs what the agent can reach beyond it.
The economics of idle agents and why snapshot-restore changes the cost equation at scale
An always-on VM creates a real economic objection. A per-user agent that waits overnight still consumes billed compute even though it performs no useful work. Multiplying that arrangement across a fleet ties cost to provisioned agents regardless of active demand. Persistence alone does not resolve that problem. The runtime must separate the lifetime of state from the lifetime of compute.
Snapshot-restore makes that separation possible. When an agent becomes idle, the runtime snapshots its disk and memory, deallocates the VM, and retains the snapshot until another request arrives. Idle time incurs storage-only cost. Because most agents are idle most of the time, that scheduling choice changes the fleet’s economics without requiring the agent to discard its working context.
Lambda takes a different approach to idle cost. It charges nothing during idle periods, but a fresh execution environment must rebuild context before the agent resumes useful work. For large repositories or heavy dependency sets, repeated setup can erase the idle-cost advantage across a realistic invocation pattern. The comparison therefore depends on reconstruction work as well as inactive time. A low idle bill is not a complete measure of the cost of continuing a task.
Restore speed is the other economic and product constraint. Sub-second wake latency is the requirement for responsive interactions, rather than seconds spent recovering context at every turn. With storage-only idle pricing and fast restoration, a B2B SaaS developer can set up an isolated agent for each customer without paying active compute rates for every customer whose agent is idle. That makes a per-user agent practical for agent-native products, including for users who would not keep an always-on agent busy enough to pay for.

What should builders verify when comparing persistent AI agent infrastructure vs serverless functions?
Builders should evaluate continuity as an architectural property. Builders should first verify whether filesystem state survives between sessions natively, including after the active execution environment stops. If persistence requires EFS mounts, S3 synchronization, or external state stores, those dependencies belong in the assessment. They may be acceptable choices, but they are not equivalent to a runtime that preserves the workspace itself. The distinction identifies who owns reconstruction and coordination.
Wake behavior needs the same scrutiny. Builders should verify sub-second restoration from an idle snapshot rather than treating cold-boot speed as a substitute for resuming prepared context. Idle billing is a separate test. A runtime that preserves state but continues charging compute throughout inactivity retains the central cost problem of always-on per-user fleets. Storage-only idle pricing answers that objection without forcing the workspace to disappear.
Isolation and execution privileges complete the evaluation. Builders should distinguish per-agent VMs with separate kernels from shared-kernel or cluster-level boundaries, and verify how filesystem and memory separation protect tenants. Coding agents also need to be allowed to install packages, run compilers, and execute arbitrary code inside their sandbox. Network safety requires its own controls, as an isolated VM still needs governed egress and credential handling.
A Firecracker-based runtime with persistent disk and snapshot-restore scheduling can meet these requirements structurally, but the underlying technology name is not the full specification. The runtime in use must keep state, isolate agents, restore quickly, and stop charging for idle compute. For agents whose work spans interactions, those are the criteria that distinguish continuity from a stateless function surrounded by persistence services.


