Volume Reattachment Economics and Why Stateless Agent Storage Costs You More Than Persistence
Persistent storage can cost less than rebuilding every session.
Sponsored by Archil

A persistent filesystem workspace lets AI agents keep files across sessions and share a disk across parallel runs without rebuilding the environment each time. The right design separates storage from execution and supports mounting the same workspace on multiple machines. In volume reattachment economics, stateless storage avoids idle storage charges, but persistence billed on changed or active data avoids repeatedly paying to reconstruct useful work.
Why stateless agent storage feels cheap but isn't
Stateless is cheaper because nothing sits idle. That is sound reasoning for short, one-shot jobs with little setup and nothing worth keeping afterward. Ephemeral container volumes work well for these jobs because they give them temporary working space that can disappear when execution ends. The logic breaks when the next session needs what the previous session discarded. Throwing away the workshop is not a saving if the next job starts by rebuilding it.
Package reinstalls, data fetches, and environment warming appear as compute time. Repeated model calls can land on another invoice entirely.
What reconstruction actually costs per session
Before a stateless agent can do useful work, its base image boots, its runtime initializes, its packages install, and its data arrives. Package-heavy environments can spend several seconds adding standard agent SDK dependencies alone. The user waits through all of it. That delay can arrive before the model generates its first token, so a slow response need not mean a slow model.
Failures make the cost harder to contain. A four-step sequence that loses its environment on step three can orphan the work from steps one and two, forcing the agent to repeat completed work. Compute pays for rebuilding files and dependencies, while the token bill absorbs calls needed to recover context. Neither charge helpfully introduces itself as “work already paid for.”
A sandbox with a durable disk lets installed packages and runtime state survive stops and restarts. The distinction is between recovering an environment and manufacturing another one.
How copy-on-write billing changes what you actually pay
Copy-on-write changes the unit of cost from a whole environment to its divergence from a shared base. A conventional allocation model charges for the most resources requested for as long as the sandbox exists. A divergence model charges for changed disk chunks and private memory pages.
Content-addressable storage makes this concrete. A disk becomes a manifest of immutable chunks, with identical chunks stored once and zeroed chunks skipped. When an agent writes, its changed chunks become its incremental storage burden. Disks billed on active data that branch in about 90 ms regardless of size fit the principle that a fork should not require another full disk copy.
Memory can follow the same pattern. Clean pages mapped with MAP_PRIVATE share page-cache backing, while writes get private pages through the kernel’s copy-on-write mechanism, and userfaultfd fills sparse memory as needed. Sharing the base lets a host support more parallel agents than allocating every guest’s full requested resources independently.
The economic advantage grows with repeated setup and modest divergence. Stateless execution may share an immutable starting image, but discarding session changes still loses the packages, files, and progress created afterward. Persistence preserves that incremental investment.
What the billing models actually measure — and what they miss
Teams often pay for wall-clock CPU plus memory, active-CPU-only plus memory, a flat charge for each execution, or prepaid compute balances billed by the minute. These models measure different things. With active-CPU billing, agents pay no charge for processor time while they wait for model responses. It does not necessarily stop the memory meter.
Provisioned memory billed by wall clock can absorb much of the apparent saving. Minimum billing periods add another distortion, because a five-minute minimum pads a short execution to the minimum charge. At high volumes, that padding becomes a substantial expense. A cheap rate is not always a cheap run.
The cost of rebuilding stays hidden in these units as extra compute or tokens used. Some usage-based options bill storage on active data, so the charge does not depend on how much data the disk could hold. A meaningful comparison therefore includes setup frequency, retained memory, billing minimums, and repeated model work. The invoice describes what was metered.
Why isolation strength and cold-start cost are no longer in tension
“Containers are fast enough and microVMs are slow” no longer settles the architecture decision. Firecracker microVMs cold-start in the low hundreds of milliseconds while providing hardware-enforced isolation and a separate kernel. For most agent workloads, that startup gap is too small to justify choosing a weaker boundary on speed alone. Booting is also not the same as rebuilding.
gVisor offers a middle tier through a user-space kernel that intercepts syscalls. Google uses it for multi-tenant isolation in Cloud Run first-generation and App Engine. The practical recommendation is gVisor for routine execution and microVMs for builds, third-party code, or agent-generated code that can install packages or manipulate file descriptors.
Isolation does not solve every security problem. Credentials placed inside an execution environment remain reachable by code running there, regardless of filesystem isolation. The corresponding safeguards are credentials brokered at the network boundary and outbound access disabled by default, then opened only to specific registries and APIs.
How do AI agents share a filesystem across sessions and parallel runs?
A shared workspace needs two properties that temporary local storage does not provide by itself. Its files must survive execution stopping, and its disk must be mountable on multiple machines simultaneously. A handoff can then attach the existing workspace without copying a full disk image. Durability and shared access solve different problems.
Think of a research agent partway through a 50-step task. If its only copy of intermediate work disappears, completing the task requires recovering that work elsewhere or repeating it. With a durable workspace, the next session still has the files written, packages installed, and progress saved. A purely stateless disk cannot provide that continuity without another stateful layer.
One team that separated its persistent agent controller from execution sandboxes reported 10–15% usage savings by suspending sandboxes while preserving workspace state. Suspension still needs care, because network clients disconnect and must reconnect, while freezing a self-managed process on its own does not free resident memory.
For parallel runs, a persistent disk can mount on many machines at once. That supplies a common workspace without rebuilding it for each run. However, shared mounting alone does not establish how simultaneous edits to the same file are coordinated, so shared-write behavior remains an evaluation criterion.
Branching and checkpointing as normal operations, not recovery mechanisms
A branch serves a different purpose from a shared workspace. Shared storage lets agents work on the same files, while branching gives each competing attempt its own environment from the same starting point. Copy-on-write makes each attempt pay only for its changes.
Checkpointing applies the same economics across time. A known-good environment can remain available while an agent attempts a risky next step. If that step fails, execution can resume from the checkpoint. Checkpoints that share most of their content with a base are inexpensive to retain.
Platform-level support is making this less exceptional. Kubernetes checkpointing reached general availability in March 2026, signaling that preserving execution state is becoming a normal infrastructure operation. For coding agents trying competing implementations or research agents following different hypotheses, cheap branches change which approaches are affordable. They replace full-copy overhead with the cost of actual exploration.
Giving agents file access to large datasets without copying them
Large datasets expose another reconstruction bill. Copying data from S3, GCS, or R2 into an ephemeral disk creates a second stored copy and can add multi-minute delays before useful work starts. Transferring the data every session makes setup a cost that keeps coming back. The data has not changed, but the meter runs again.
A mounted filesystem avoids that full upfront copy. AWS S3 Files, generally available since April 7, 2026, provides native NFS access to S3 buckets with a caching layer for active data. GCS Cloud Storage FUSE similarly exposes bucket data through a filesystem, allowing jobs to stream data. These interfaces also match the bash and command-line tools that models already know.
Mounted storage still has access costs. Listing a large directory can trigger a metadata read per file, and prefetch can add writes, so metadata-heavy workloads need measurement before adoption. Implementation choices also affect small-file performance, with geesefs using asynchronous, parallel uploads rather than the synchronous per-file approach of s3fs.
The design principle is to leave the bucket authoritative. Writes can sync back in the background, while revoking access leaves the underlying data in the customer’s account.
Per-tenant storage at thousands of tenants and why the billing model compounds
Across thousands of tenants, repeated setup becomes a platform cost. More tenants and more sessions each mean more work to rebuild. With a durable per-tenant workspace, the cost of setting up the environment is spread across later sessions. The base installation gets more than one shift.
Sharing immutable base content makes this economical without making tenant workspaces the same workspace. Each tenant keeps its own changes, and the shared base is stored just once. Active-data metering also accommodates uneven usage, because a tenant with little state need not incur the same provisioned storage allocation as one accumulating substantial files. Averages across the fleet can otherwise hide a lot of empty disk.
Tenant boundaries extend beyond storage allocation. Credential brokering must preserve each tenant’s identity so another tenant’s code cannot reach its secrets. The platform also has to handle data residency, with cache nodes in the same place as tenant compute and settings that must explicitly allow data to move across regions.
What to look for in a persistent sandbox
A good option to evaluate against these requirements uses Firecracker microVMs with separate kernels, while durable disks support checkpointing, branching, and multi-machine mounting, with storage billing based on active data. Those properties address distinct costs, including repeated reconstruction, full-copy branches, and unused capacity. They are more useful evidence than the phrase “secure sandbox.”
Its bucket integration covers S3, GCS, R2, Azure Blob, and S3-compatible storage through POSIX mounts without migration. Writes are durable once fsync returns and sync to the bucket in the background, keeping the bucket as the source of truth. On the Free plan, outbound traffic is restricted to a managed allowlist, while Developer plans and above support custom firewall rules. Credentials are brokered outside the sandbox, and ports remain private until explicitly exposed.
Other persistent sandbox options deserve the same checks. A team evaluating them should ask for the named hypervisor, default egress policy, secret location, restart behavior, and precise billing basis for both disk and RAM. Shared-write fit needs its own examination, including simultaneous mounting and the handling of concurrent edits. S3-compatible API access and bucket mounting must also fit the rest of the stack.
The deciding comparison is the cost of completed work with state preserved. That is the number a storage architecture has to earn.
This article is sponsored by Archil.


