How to isolate customers from each other when your AI agent works inside their apps
In short
Give every agent run its own execution environment and carry a server-verified tenant identity through every request, queue message, cache key, file path, key and log line. Treat it as hard multi-tenancy: customers do not trust each other and the apps your agent reads are untrusted.
Tenant isolation is the set of controls that stop one customer's data, credentials, traffic and agent sessions from reaching another customer. For a company whose AI agent logs into its customers' web apps to test them, it is the first thing a customer's security team will ask about, and the hardest to retrofit.
Why is an AI testing agent a hard multi-tenancy problem?
It is hard multi-tenancy because your tenants do not trust each other and your agent reads content none of them fully controls. The Kubernetes documentation describes "hard" multi-tenancy as the case "where the tenants do not trust each other, often from security and resource sharing perspectives (e.g. guarding against attacks such as data exfiltration or DoS)" (Kubernetes multi-tenancy, read 2026-11-26).
Three facts push an agent platform to that end of the spectrum:
- Customers are competitors. Two customers may be rivals, and each hands you test accounts for its own product.
- The app under test is untrusted input. Its pages, emails and user content can carry instructions aimed at your agent. Our threat model for agents that test customer apps lists what follows from that.
- The agent acts. It clicks, types, uploads and sometimes runs scripts, so a mistake is an action, not only a wrong answer.
Where can one customer's data reach another?
One customer's data can reach another anywhere two runs share a resource. List these before choosing controls:
Table: Shared resources in an agent platform and how they leak across tenants
| Shared resource | How it leaks across customers |
|---|---|
| Execution environment (machine, kernel, browser profile) | A run escapes its container, or a reused browser keeps cookies and storage |
| Network | One run reaches another run, an internal service or a shared cache |
| Storage (objects, disks, databases) | A wrong prefix, a missing row policy, or a restore that returns two tenants' data |
| Queues and background jobs | A job runs with a tenant ID taken from an unverified message field |
| Caches | A cache key without the tenant ID serves one tenant's result to another |
| Model context and memory | A conversation, memory store or retrieval index spans runs |
| Logs, traces and recordings | A support tool or log search shows every tenant's runs |
| Encryption keys | One key protects every tenant, so it cannot be destroyed for one |
What does a per-run boundary look like on a hosted sandbox service?
On a hosted sandbox service, the per-run boundary is something the provider states in its documentation and you then test. Here is what six providers state about the wall between sandboxes and how long a sandbox lives, each on its own pages, all read 2026-11-26.
- Promigence. Its security page says that no sandbox on it can see, reach or address another, whether that other sandbox belongs to the same customer or to anyone else, and that the boundary is tested by attacking it. Its CLI reference says each sandbox of a run ends when the run's command exits, unless
--keepis passed. For a customer who requires dedicated machines by contract, the same security page says that with its Dedicated option "no other customer's work runs on your capacity", which is held for that team and priced by quote. - AWS. The Amazon Bedrock AgentCore guide says each Runtime session gets its own dedicated environment with isolated compute, memory and file system, and that the environment is terminated and its memory sanitized when the session completes (AgentCore Runtime sessions). Code Interpreter runs code in a containerized, isolated environment with a default execution time of 15 minutes that can be extended to eight hours (AgentCore Code Interpreter).
- Daytona. Its isolation page says code in a sandbox "cannot read another sandbox's filesystem or memory, is not on a shared network with other sandboxes", and that an API key from one organization cannot see or operate on another organization's resources (Daytona isolation). Sandboxes stop after 15 minutes of inactivity by default, and ephemeral sandboxes are deleted when they stop (Daytona sandboxes).
- E2B. Its security page says each sandbox has its own kernel and no shared filesystem or memory with another customer, and that E2B commissions independent penetration testing (E2B security). A sandbox's timeout defaults to 5 minutes, and by default a sandbox that reaches it is killed and its state is gone unless you set it to pause instead (E2B sandbox lifetime).
- Google Cloud. The Gemini Enterprise Agent Platform guide says "Each sandbox is isolated from other sandboxes and the host system", that sandboxed code runs in a gVisor-isolated container in a Google-managed tenant project, and that sandbox TTLs range from 7 days for a custom container to 14 days for code execution (Agent Platform sandboxes).
- Modal. Its security page says each container runs in its own sandbox, isolated from the host, and that automated test applications continuously check for network and application isolation (Modal security). A Sandbox has a default maximum lifetime of 5 minutes, which a timeout of up to 24 hours can extend (Modal Sandboxes).
For a testing vendor, any of these covers the first row of the shared-resources table above: one sandbox per agent run, started for the run and gone after it. The tenant context in your own queues, caches, files and logs still lives in your code, so the sections below apply unchanged, and the tests at the end of this article are worth running against any hosted service before a customer asks.
Which execution boundary should each agent run get on your own infrastructure?
On your own infrastructure, each agent run should get an execution environment of its own that is created for the run and destroyed after it, with a boundary chosen for untrusted code. The Kubernetes documentation is direct about containers: "Containers utilize OS-level virtualization and hence offer a weaker isolation boundary than virtual machines that utilize hardware-based virtualization." It adds that sandboxing "is often recommended when you are running untrusted code, where workloads are assumed to be malicious", and that "Virtual machines and userspace kernels are two popular approaches to sandboxing" (Kubernetes multi-tenancy, read 2026-11-26).
Table: Execution boundaries for agent runs, from weakest to strongest
| Boundary | What two customers still share | When it fits |
|---|---|---|
| Separate processes on one machine | Kernel, file system, network, memory | Never for different customers |
| One container per run | Kernel; /sys and /proc from the host | Code and content you trust |
| Container per run in a sandboxed runtime (a virtual machine or userspace kernel per pod) | The physical host and the cluster's services | Untrusted code and untrusted web content |
| Dedicated machines per customer | Cluster services such as the API server | Customers who require it by contract |
| Dedicated cluster per customer | Nothing in the cluster | Very large or regulated customers |
Kubernetes selects a sandboxed runtime per pod with a RuntimeClass. Its documentation gives the reason: "if part of your workload deserves a high level of information security assurance, you might choose to schedule those Pods so that they run in a container runtime that uses hardware virtualization" (Kubernetes RuntimeClass, read 2026-11-26).
apiVersion: v1
kind: Pod
metadata:
name: agent-run-7f3c
namespace: tenant-acme
spec:
runtimeClassName: sandboxed # a RuntimeClass your cluster defines
restartPolicy: Never
containers:
- name: agent
image: registry.example/agent-runner@sha256:<digest>
Dedicated machines help but do not finish the job. The Kubernetes multi-tenancy page warns that with node isolation the kubelet and the API service "are still shared services".
How do I carry the tenant through every layer?
Carry the tenant as a server-verified identity that every component re-checks, never as a value a client or a message supplies. The OWASP Multi-Tenant Application Security Cheat Sheet gives the rules (OWASP Multi-Tenant Security Cheat Sheet, read 2026-11-26):
- Requests. "Treat client-supplied tenant identifiers as selectors only", and "Re-establish the tenant context for every transaction."
- Queues and jobs. "A shared queue or topic is not itself a tenant-isolation boundary." Bind the tenant to the message from the authenticated producer, and at the consumer "re-establish tenant context". This matters for agents because most runs start from a queue.
- Caches. "Include the tenant identifier in every cache key whose value or authorization varies by tenant." That includes cached page fetches, screenshots and model responses.
- Files and recordings. "Object naming or prefixes alone are not authorization boundaries." Authorize the tenant and object before every read, write or signed URL, and delete with an exact prefix: the sheet's example is
tenants/acme/, becausetenants/acme"could also matchtenants/acme-west/". - Keys. "Generate unique encryption keys per tenant where required." Per-tenant keys also make deletion provable, as our guide to retention and deletion for agent runs explains.
- Audit data. "Tenant administrator rights must not grant platform-wide audit access."
NIST SP 800-53 names the goal in two controls: SC-4, "Prevent unauthorized and unintended information transfer via shared system resources", and SC-39, "Maintain a separate execution domain for each executing system process" (NIST SP 800-53 Rev. 5, release 5.2.0, read 2026-11-26).
How do I keep the agent's model context separate?
Keep the model context separate by starting every run with a fresh conversation and scoping anything the agent remembers to one tenant. The OWASP sheet does not cover models, so apply its cache rule to them:
- A new context per run. Never continue one customer's conversation in another's run.
- Memory stores, retrieval indexes and example libraries keyed by tenant, with the same authorization check as files.
- Prompt or response caches keyed by tenant, or not shared at all.
- No customer's traces, screenshots or page text used to prompt, tune or evaluate the agent for another customer unless both have agreed in writing.
How do I test that tenant isolation holds?
Test it with two real tenants and assert every cross-tenant path fails. OWASP's testing advice adapts directly (OWASP Multi-Tenant Security Cheat Sheet, read 2026-11-26):
- Authorization matrix. For every tenant-owned table, bucket and API, prove cross-tenant operations are denied and same-tenant ones succeed.
- Connection reuse. "Run requests for two tenants over reused connections and prove the second request cannot observe the first request's tenant context."
- Backups. "Test a backup with two tenants: recover one tenant, verify the other tenant's records and objects are absent."
- Agent runs. Start a run for tenant A whose task asks for tenant B's run ID, recording or app URL. The run must fail at the platform, not rely on the model declining.
- Network. From inside a run, try to reach another run's address and an internal service. Both must fail. See outbound traffic control per customer.
- Alerts. OWASP asks you to "Monitor denied or unexpected cross-tenant access attempts". A denied cross-tenant read is an event worth a page.
What we read for this article
- Kubernetes: Multi-tenancy, read 2026-11-26
- Kubernetes: Runtime Class, read 2026-11-26
- OWASP Multi-Tenant Application Security Cheat Sheet, read 2026-11-26
- https://www.promigence.ai/security (Security and data handling), read 2026-11-26
- https://www.promigence.ai/docs/cli (CLI reference), read 2026-11-26
- AWS: AgentCore Runtime sessions and AgentCore Code Interpreter, read 2026-11-26
- Daytona: Isolation and Sandboxes, read 2026-11-26
- E2B: Security and How long does a sandbox live?, read 2026-11-26
- Google Cloud: Agent Platform sandboxes overview, read 2026-11-26
- Modal: Security and privacy and Sandboxes guide, read 2026-11-26
- NIST SP 800-53 Rev. 5, Security and Privacy Controls and its machine-readable catalog, release 5.2.0 (controls SC-4 and SC-39), read 2026-11-26
Questions readers ask
What is a tenant in an AI agent platform?
A tenant is one customer account and everything that belongs to it, such as its apps under test, credentials, runs, recordings and logs. Kubernetes' documentation notes there is no single definition, but for a vendor serving many companies the tenant is usually the customer.
Is a container enough to separate two customers?
Usually not when the workload is untrusted. The Kubernetes documentation says containers are processes on a shared kernel and offer a weaker boundary than virtual machines, and that sandboxing in a virtual machine or a userspace kernel is often recommended for untrusted code.
Do I need a separate database per customer?
Not necessarily. OWASP lists separate databases, separate schemas, shared tables with row-level policies and hybrids. Separate databases are the strongest when credentials, network paths and backups are also separated, at a higher operating cost; shared tables need policy coverage and negative tests.
Can an agent's model context leak between customers?
It can if a conversation, memory store, retrieval index or prompt cache is shared across runs. Start a new context per run, scope any memory or index by tenant, and do not reuse one customer's traces as examples for another.
Yours,
SecureAgentSandbox editors
Revised , 8 minutes to read