You're building a multi-tenant agent platform. Tenants bring their own MCP servers and their own data. What isolates them?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
The dangerous framing is treating this as a normal multi-tenant web app with an LLM inside. It is not, because agents add three leakage channels a web app does not have: shared context, shared caches, and shared execution.
Full worked answer
The dangerous framing is treating this as a normal multi-tenant web app with an LLM inside. It is not, because agents add three leakage channels a web app does not have: shared context, shared caches, and shared execution.
Identity and credentials. Never a shared service account. Each tenant's tool calls execute with that tenant's credentials, so the downstream system enforces authorisation independently of your agent. The agent becomes a confused deputy that cannot be confused: even a fully prompt-injected agent cannot read tenant B's data, because the token it holds does not permit it. This is the load-bearing control and everything else is defence in depth. Concretely, bind the tenant token to the run at creation and thread it through every invocation rather than fetching it from ambient config.
Prompt cache. Underrated and specific to this problem. Provider prompt caching keys on the prefix, so letting tenants share a cache namespace opens a timing side channel: B probes with candidate prefixes and infers from time-to-first-token whether A recently sent the same content. Worse, if you build your own response cache keyed on a prefix hash, a shared key can serve A's cached output to B outright. Partition the cache by tenant, usually via a tenant-specific prefix segment or a provider-side cache key, and accept the hit-rate cost.
Execution sandbox. If tenants run code or connect a stdio MCP server, that server is a subprocess on your infrastructure with your privileges. It is untrusted code you are executing. Container per tenant at minimum, per run if you can afford it, no shared filesystem, egress allowlists, hard kill on budget.
Memory and vector stores. Per-tenant collections, not one shared index with a metadata filter. A filter is one buggy query away from a cross-tenant leak, and embeddings of tenant data in a shared index are a liability even when filtered correctly.
Observability. The one people forget. Agent traces carry reasoning chains, retrieved chunks, and tool arguments: a far richer leak surface than HTTP logs. Redact at collection, route regulated tenants to separate backends, scope trace access by tenant.
Noisy neighbours. Per-tenant token quotas and concurrency limits, so one runaway loop degrades exactly one tenant.
What a good answer covers
- The dangerous framing is treating this as a normal multi-tenant web app with an LLM inside
- It is not, because agents add three leakage channels a web app does not have
- Each tenant's tool calls execute with that tenant's credentials, so the downstream system enforces…
- The agent becomes a confused deputy that cannot be confused
- This is the load-bearing control and everything else is defence in depth
Key terms: Identity and credentials · Prompt cache · Execution sandbox · Memory and vector stores · Observability · Noisy neighbours
In the glossary: Tool call · Confused deputy · Defence in depth · Prompt caching · MCP · Observability
Interviewer follow-ups to expect
A tenant's MCP server description contains an injection targeting your orchestrator. Which of these controls helps?
How do you let tenants share a common tool set without sharing the cache?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep