
Your Multi-Tenant Knowledge Base Works at 10 Tenants. Here's What Breaks at 500.
Isolation is the part everyone writes about. Scale is the part that catches you out.
Month one: everything works
Picture a composite SaaS platform. It adds an AI assistant that answers questions from each customer's own documents. The team follows the published AWS pattern for Amazon Bedrock Managed Knowledge Base:
- one shared knowledge base for every tenant,
- every document tagged with
tenant_idwhen it's ingested,
- every query filtered on
tenant_id, with the filter value built on the server from the caller's verified token, never from the request body.
That last point is the real security boundary, and AWS covers it well. Build multi-tenant agentic chat applications with Managed Knowledge Base walks through the server-side filter and the ingestion pipeline. Fine-grained access control for Managed Knowledge Base tools shows how to keep the scoping intact when an agent reaches the knowledge base through AgentCore Gateway. If you haven't built that foundation yet, start there.
This post picks up where those leave off. The platform launches with 10 tenants and works fine. Then it grows, and four things break that have nothing to do with the original isolation design.
Stage 2: "Tenants" turn out to have users
The first design treats a tenant as a single bucket of documents. Real customers don't work that way. Inside one tenant, some documents belong to one person (an uploaded contract, a personal draft), and others are meant for the whole company (a policy handbook).
A single
tenant_id filter shows everyone in the tenant everything. A single user_id filter hides the shared handbook. You need both.One way to model this is with two metadata attributes and one combined filter. Tag each document with:
-
tenant_id: always set, from the uploader's verified identity
-
owner: the uploader's user ID, or a fixed value such astenant-widefor shared documents
Then filter on both. The shape looks like this (adapt it to your attribute names and test it against your own data before you ship it):
"filter": { "andAll": [ { "equals": { "key": "tenant_id", "value": "<tenant from verified token>" } }, { "in": { "key": "owner", "value": ["<user from verified token>", "tenant-wide"] } } ]}Managed Knowledge Base supports
equals , in , notIn and the range operators, combined with andAll and orAll . It does not support startsWith or stringContains , so avoid designs that depend on prefix matching, such as a hierarchical tenant/team/user string. Use separate attributes instead. ( Configure and customize queries for managed knowledge bases )Both filter values still come from the verified token, never from the request. The tenant boundary works the same way as before. The only change is that one tenant now has two kinds of document.
Stage 3: One tenant gets busy, and everyone slows down
Around tenant 200, a large customer starts running agents that ask multi-step questions all day. Smaller tenants start reporting slow or failed answers. Nothing is wrong with isolation. The tenants are sharing capacity.
These are the Managed Knowledge Base quotas that matter for a shared design ( Service quotas for managed knowledge bases ):
Quota | Default | Adjustable | Shared by |
|---|---|---|---|
AgenticRetrieveStream requests per minute | 300 | Yes | Every tenant, every KB in the account |
Retrieve requests per minute | 600 (burst 25 per second) | Yes | Every tenant on that KB |
Concurrent ingestion jobs | 50 | No | Every tenant on that KB |
Two of these are worth slowing down on.
Agentic retrieval is limited per account, not per knowledge base. Splitting tenants across more knowledge bases doesn't give you more agentic retrieval capacity. Here's my own arithmetic, not an AWS figure: at the default 300 per minute, ten tenants each making 30 agentic calls a minute use up the whole account. You can request an increase, but you still need to decide how it's shared.
Ingestion concurrency is fixed per knowledge base. If one tenant bulk-uploads its document archive, it can take up slots that other tenants' live uploads need. AWS's own guidance applies here: put a queue in front of ingestion, batch documents, and use a scheduled S3 sync for large one-time loads instead of direct ingestion. One detail is easy to miss: going over the concurrency limit returns a
ValidationException , not a throttling error, so retry logic that only retries throttling errors will drop the document. ( AWS multi-tenant Managed KB post )None of these limits care which tenant a request belongs to. Unless you divide the capacity yourself, the busiest tenant decides how much everyone else gets.
Stage 4: Give each tenant a fair share at the gateway
If agents reach the knowledge base through AgentCore Gateway, per-tenant gateway rate limits are the natural place to divide that capacity, using the approach I covered in my previous blog . The gateway docs list built-in connectors among its MCP target types, and say request and connection limits apply to all target types. ( Core concepts , Rate limit metrics ) The docs don't show an example for the Managed Knowledge Base connector specifically, so check that throttling behaves the way you expect before you rely on it in production. The gateway records which limit throttled each request in its trace data, which makes this easy to see.
Three things are different for knowledge base tools:
- Copy the exact tool names from
tools/list. ThetoolNamekey uses the format<targetName>___<toolName>( Rate limit dimensions ), and a name that doesn't match falls through to your wildcard entry without any error. Put a tighter limit onAgenticRetrieveStreamthan onRetrieve, because it's the one with the account-wide quota.
- Per-tenant limits don't cap the total. A wildcard gives every tenant its own bucket, so enough busy tenants together can still exceed the 300-per-minute account quota. Size the per-tenant rate against that quota, and request an increase if you need one.
- Calls that skip the gateway aren't limited. If your application also calls
Retrievedirectly, those calls bypass the gateway's limits. The AWS access-control post shows a resource-based policy that only allows the gateway's role to search the knowledge base. ( Fine-grained access control for Managed Knowledge Base tools )
Stage 5: Your biggest customers want their own knowledge base
Eventually a few large tenants ask for dedicated knowledge bases, for contractual separation, separate storage, or their own data sources. That's reasonable, but don't move everyone. The quotas point to a mixed setup:
- Up to 10,000 managed knowledge bases per account and Region, and this can't be raised. One knowledge base per tenant can work for a long time, but it has a hard ceiling. AWS also points to the baseline cost of many small indexes and the delay of creating a knowledge base at sign-up as reasons to prefer a shared one.
- 200 data sources and 10 TB of raw storage per knowledge base, both adjustable. A shared knowledge base has plenty of headroom for many small tenants.
- Agentic retrieval is still shared across the account, so dedicated knowledge bases separate the data but not that capacity.
A practical setup: dedicated knowledge bases for the few tenants that require them, one shared knowledge base for everyone else, and a server-side lookup that sends each request to the right one based on the verified tenant. Don't use multi-knowledge-base queries to keep tenants apart. AWS describes that feature as a way to combine knowledge domains for one user, not as an isolation mechanism.
Stage 6: The shared data source that leaks
The last failure is the hardest to spot. Some tenants want permissions copied from their source systems, so the team enables document-level ACLs on a few connectors. Later, someone adds a public product-docs source to the same knowledge base without ACLs.
Managed Knowledge Base lets you mix ACL-enabled and non-ACL data sources in one knowledge base. Documents from non-ACL sources are returned to every user, whatever user context you send. In the other direction, a document in an ACL-enabled source with no ACL attached is returned to no one. ( ACL-aware retrieval on managed knowledge bases )
If your isolation depends on ACLs, every data source you add to that knowledge base is a decision about isolation. Two habits help:
- Treat documents in non-ACL sources as scoped only by your metadata. Tag them deliberately (with a
tenant_id, or an explicit shared marker your filter allows), and don't add a source to a shared knowledge base until you know how its documents are tagged.
- Remember that ACL awareness filters results based on the identity you pass in. It doesn't authenticate anyone. That identity has to come from your verified token. ( ACL awareness enablement )
Checklist before tenant 500
- Isolation: filters built on the server from the verified token, applied to every query and every retrieval step.
- Tenant and user model: separate
tenant_idandownerattributes, combined withandAllandin, with no prefix matching.
- Capacity: calculate your peak agentic retrieval traffic against the per-account limit, and request increases before you need them.
- Ingestion: add a queue, batch documents, retry
ValidationException, and run bulk loads through a scheduled sync.
- Fairness: set per-tenant gateway rate limits on the retrieval tools, sized against the account quota, and block direct calls that skip the gateway.
- Placement: decide on dedicated vs. shared knowledge bases tenant by tenant, and route each request on the server.
- Data sources: review every new source added to a shared knowledge base for whether it has ACLs.
The takeaway
Isolation keeps tenants from seeing each other's data. At scale, you also have to stop them from slowing each other down, and keep every new data source from weakening isolation. The published AWS patterns cover the first part. The quota table and the gateway cover the rest.
References
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article