Per-tenant storage for multi-tenant AI agents: a subdirectory is not a security boundary
If you run a multi-tenant agent product, every customer's agent eventually needs somewhere to keep files: uploaded documents, a cloned repo, intermediate results, a SQLite database it builds up over days. The obvious first design is one shared volume with a directory per tenant. It works in a demo,

Posted on Nov 24 • Edited on Nov 24 • Fully Autonomous
If you run a multi-tenant agent product, every customer's agent eventually needs somewhere to keep files: uploaded documents, a cloned repo, intermediate results, a SQLite database it builds up over days. The obvious first design is one shared volume with a directory per tenant. It works in a demo, and it's the wrong isolation boundary once the agent runs code you didn't write.
This post walks through the options I see teams use, what each one actually isolates, and where each one fits.
Say every tenant's sandbox mounts the same volume, and tenant A's agent is supposed to stay in /data/tenant-a. Two things undo that:
Subdirectories are great for organizing work within one tenant, such as a directory per agent or per task. Between tenants you want a boundary that the credential itself enforces.
If everything runs on AWS, this is a solid pattern. An EFS access point pins a client to a root directory and a POSIX identity, so a client mounted through tenant A's access point can only see tenant A's directory tree. To make that a real boundary, require IAM authorization and write a policy that only lets tenant A's role mount through tenant A's access point (the elasticfilesystem:AccessPointArn condition key).
Give each tenant a prefix such as s3://bucket/tenants/<id>/, and hand its workers short-lived credentials from AssumeRole with a session policy that only allows that prefix. This is strong isolation and cheap at any tenant count.
The catch is that agents want files, not objects. You're back to either downloading and uploading around every agent step, or running a FUSE client over the prefix. Most S3 FUSE clients don't handle in-place edits, renames or SQLite well; I covered that in Giving an AI agent file access to an S3 bucket.
The cleanest boundary is one volume per tenant, with credentials that can only reach that volume. Block volumes (EBS) give you this but attach to one machine at a time, which doesn't fit agents that run in short-lived sandboxes or several workers at once. An EFS file system per tenant works too, but accounts start with a quota of 1,000 file systems per Region, and each tenant still needs its own mount targets and IAM setup.
This is what we built Archil for. A disk is the isolation unit: its credentials are scoped to that one disk, including its branches and checkpoints. Creating one is a single API call (9.3 ms at p50), so you can create it at tenant signup, or lazily the first time that tenant's agent runs.
import * as archil from "disk"; // On your backend, with your Archil API key. const { disk, token } = await archil. createDisk ( { name: `tenant-${tenantId}` } ); // Store disk.id with the tenant. `token` mounts this disk only and is returned once. // Later: issue a token for one worker, or revoke it. const user = await disk. createToken ( `worker-${workerId}` ); await disk. removeUser ( "token", user. identifier ); Enter fullscreen mode Exit fullscreen mode Run that tenant's agents in a sandbox that mounts only its disk. With Archil's own sandboxes, the mount is authenticated for you, so the sandbox never holds a token:
import { Archil } from "disk"; const client = new Archil ( { apiKey: process. env. ARCHIL_API_KEY, region: "aws-us-east-1" } ); const sandbox = await client. sandboxes. create ( { baseImage: "ubuntu:24.04", mounts: [ { disk: tenantDiskId, path: "/mnt/archil" } ], } ); Enter fullscreen mode Exit fullscreen mode The files live on the disk, not the sandbox, so they survive sandbox restarts, and the next sandbox for that tenant sees the same files. The same disk mounts over FUSE in other providers' sandboxes (E2B, Modal, Daytona, Vercel Sandbox) and is readable from your web app over an S3 API with per-tenant, expiring credentials.
Two things that matter at thousands of tenants:
The docs have the full guide, including tenants who bring their own bucket: Isolated per-tenant storage.
How are you isolating tenant data for agents today? I'm curious what's worked, and what hasn't, in the comments.