Multi-Tenant AI Agents: Your Agent Needs Row-Level Boundaries, Not Just Table Permissions
Table permissions do not say which customer an agent may read. A multi-tenant configuration puts a row boundary on the agent, so it retrieves only the tenant, user or business context you assign.
Most teams building AI agents eventually ask the same question:
“How do I let an agent access the data it needs without letting it access everything else?”
The usual answer is to create a database user with limited permissions. You may allow it to read certain tables. You may exclude sensitive columns. You may make the connection read-only.
That is a useful starting point. It is not a complete access model for an AI agent.
A read-only role can answer whether an agent is allowed to write. It does not answer which customer, organization, project, workspace or user the agent is allowed to read about.
That distinction becomes critical the moment you deploy an agent in a multi-tenant product.
A support agent may need to answer questions about an order. An internal assistant may need to inspect customer records. A workflow may need to check whether a user has accepted marketing consent. In each case, the agent should not simply have access to “the customers table” or “the orders table.”
It should only be able to retrieve the rows that belong to the tenant, user, organization or business context it is serving.
That is multi-tenant AI agent database access, and it is what Claix agents are built to enforce.
Why table and column permissions are not enough
Traditional database permissions are usually designed around roles and objects.
You can grant a role permission to read a table. You can restrict access to particular columns. You can prevent writes. You can limit what a database user can do at the database level.
For AI agents, those controls are necessary, and they leave a gap. An agent may be allowed to read the customers table, but that does not tell the system which customers it may retrieve. It may be allowed to read the orders table, but that does not establish whether it can see orders belonging to another organization.
This creates a gap between technical permission and business authorization.
| Question | What a table or column permission answers | What it does not answer |
|---|---|---|
| Can this role read this table? | Yes or no | Which rows it may retrieve |
| Can this role read this column? | Yes or no | Whether the row belongs to the current tenant |
| Can this role write to this table? | Yes or no | Whether the write is appropriate for the current context |
| Can this agent access customer data? | Yes or no | Which customers it can access |
| Can this agent access order data? | Yes or no | Which orders it can access |
In a single-tenant internal tool, this may feel manageable. In a SaaS product, a marketplace, a CRM, an HR platform, a support system or any application where multiple customers share the same database, it becomes a core security and product requirement.
An agent that can retrieve another tenant’s records is not merely returning an inconvenient answer. It may be exposing confidential business data, personal information, financial records or internal operational data.
The missing layer: row-level boundaries
Claix agents already separate two important responsibilities.
The agent is the endpoint your application or AI agent calls. It has a name, a URL, a business prompt, routes and a response mode. It decides which routes it can use, but it does not decide what data it is ultimately allowed to reach.
The route defines the data available for a purpose: the tables and columns it can use, together with a guide for interpreting that data.
With multi-tenant configuration, Claix adds a third boundary on the agent: which rows it can retrieve. The route still decides tables and columns. The agent decides the rows.
Instead of only saying “this agent can access customers and orders,” you can define “this agent can access customers and orders, but only the rows associated with tenant X.”
That turns data access from a broad capability into a bounded, deterministic retrieval rule.
| Boundary | What it controls | Example |
|---|---|---|
| Table access | Which tables the agent can use | Orders, customers, bookings |
| Column access | Which fields the agent can retrieve | Order status, customer name, consent |
| Row access | Which records the agent can retrieve | Orders belonging to one tenant or user |
| Business prompt | How the agent interprets its job | “Answer reservation questions only” |
| Response mode | How the result is returned | Raw data or a reasoned answer |
The key idea is simple: the agent should not be trusted to infer tenant boundaries from a prompt.
A prompt can guide behavior. It can explain the agent’s role. It can tell the model which route to use and what a status code means. A prompt is not a security boundary.
A multi-tenant rule is.
What multi-tenant means for AI agents
Multi-tenant does not only mean “multiple customers use the same application.”
It means that the same underlying data infrastructure serves different isolated contexts, and each context must only see the records that belong to it.
That context may be:
- A customer account
- An organization
- A company
- A workspace
- A project
- A team
- A store
- A user
- A business unit
- A region or legal entity
The exact model depends on your product. The principle does not.
Your agent should operate within the context of the request.
If a user asks, “What are my recent orders?”, the agent should retrieve orders associated with that user. If an organization asks, “How many active subscriptions do we have?”, the agent should retrieve records belonging to that organization.
It should not retrieve records from another organization because the model chose a different filter, misunderstood a relationship or generated an overly broad request.
Why this matters for AI agent builders
AI agents introduce a new kind of access pattern.
A traditional application usually has a defined user interface. A user clicks a button, opens a page or submits a form. The application decides what data to load.
An AI agent receives natural language, interprets intent and may decide which information it needs to complete a task.
That flexibility is powerful. It is also why access control becomes more important.
You cannot rely only on the model to understand which data is appropriate. You cannot assume that a well-written system prompt will always prevent an overly broad request. And you cannot treat a generated query as a substitute for an authorization decision.
A robust agent architecture separates the work:
| Responsibility | Who should own it |
|---|---|
| Understand the user’s intent | The AI agent |
| Decide which capability to invoke | The AI agent or application |
| Define available capabilities | The developer or product team |
| Enforce data boundaries | The retrieval layer |
| Record what happened | The observability layer |
| Return a usable result | The agent endpoint |
The model should not be the only component deciding what data can leave the database.
The problem with prompt-only isolation
A common approach is to include instructions such as “only retrieve data for the current tenant.”
That instruction can help. It is not enough on its own.
A prompt is guidance for a probabilistic system. It can be misunderstood, forgotten, overridden by context or combined with other instructions in ways that produce an unintended result.
More importantly, a prompt does not establish a technical boundary.
If the underlying retrieval capability can access all tenants, then the agent has the technical ability to retrieve data outside its context. The prompt may reduce the likelihood of that happening. It does not remove the capability.
A multi-tenant boundary changes the situation.
Instead of hoping the agent chooses the correct tenant, the retrieval layer restricts what it can retrieve in the first place.
That is the difference between “please do not access other tenants” and “this agent cannot retrieve rows outside tenant X.”
How Claix agents work
A Claix agent is not the same thing as the AI agent you build. The product page is Claix agents.
Your AI agent decides what to do. A Claix agent retrieves data for it, within the limits you define.
Each Claix agent has a name, which becomes its URL, a description, a business prompt, routes, a response mode and optional call limits. You can also give it a multi-tenant configuration.
When your application sends a question, Claix selects a route attached to that agent. If no route fits, it does not guess. It then executes one read-only query using only the tables and columns available through that route.
The response can be raw data or a reasoned answer, depending on the response mode you choose.
The route defines which tables and columns are available. The multi-tenant configuration on the agent defines which rows those tables may return.
| Component | Role in the architecture |
|---|---|
| Data Map | Describes tables, meanings and relationships |
| Route | Defines available tables, columns and a guide for reading them |
| Agent | Defines who asks, which routes it can use, which rows it can retrieve and how it responds |
| Response mode | Determines whether you receive raw data or a reasoned answer |
| Traces | Help you inspect what happened |
The Data Map gives Claix the business meaning of your database: what each table represents and how tables relate. Routes build on that map. Agents use routes, and the row boundary lives on the agent. This makes the access model understandable and reviewable rather than hidden inside application code.
How do you write a row boundary?
You save it on the agent. Each rule names the tables it covers and the values those tables may match. A single value has to match exactly. A list means any of those values. Several conditions on the same tables are combined with OR: a row only has to match one.
The same fact does not have to share a column name. In this example, customer 42 is id on customers and customer_id on orders and invoices. Those orders can also be read when team_id is 7 or 8. A table that is not in any rule cannot be queried, and a row that matches none of its conditions is not returned. You can create up to 20 rules.
{
"rules": [
{
"tables": ["customers"],
"any_of": [{ "id": 42 }]
},
{
"tables": ["orders", "invoices"],
"any_of": [
{ "customer_id": 42 },
{ "team_id": [7, 8] }
]
}
]
}The walkthrough, including how this sits next to routes and response modes, is on Claix agents.
What a multi-tenant agent looks like
Imagine a SaaS product with a shared database containing customers, orders and support tickets.
You may create three agents:
| Agent | Routes | Row boundary | Intended use |
|---|---|---|---|
| Customer support agent | Orders, tickets | Current customer | Answer questions about one customer account |
| Internal operations agent | Orders, customers, tickets | Internal team scope | Help staff investigate operational issues |
| Consent-check workflow agent | Customers | Current user | Return a boolean consent value for an automated workflow |
The first agent may be able to read order status, shipment information and support tickets, but only for the customer it is serving.
The second agent may have broader access because it serves an internal team.
The third agent may only need one field from one table, but it still needs a row boundary so it can only check the consent status of the relevant user.
This is the practical value of multi-tenant configuration: it lets you give an agent enough access to do its job, without giving it access to every record in the database.
The power of deterministic retrieval boundaries
The most important word here is deterministic.
A multi-tenant rule should not depend on the model deciding, after the fact, whether a result is acceptable.
It should be defined before retrieval and enforced consistently.
That means the boundary is part of the retrieval configuration, not a suggestion in the prompt.
| Approach | What determines access | Risk |
|---|---|---|
| Broad database credentials | Database role and object permissions | Agent may access more rows than intended |
| Prompt-only isolation | Model interpretation | Boundary may be misunderstood or bypassed in practice |
| Application-side filtering | Application logic | Easy to omit in a new endpoint or workflow |
| Retrieval-layer multi-tenant rules | Explicit configured boundary | Agent can only retrieve rows within its defined scope |
The last approach is what Claix multi-tenant agent configuration enables.
It gives developers a way to express the business boundary directly in the agent architecture:
- This agent serves this tenant.
- This agent can use these routes.
- Those routes expose these tables and columns.
- The agent can retrieve only rows within its assigned context.
That is a much stronger model than asking a model to be careful.
Why this improves agent reliability
Multi-tenant configuration is not only a security feature. It also improves the reliability and quality of agent answers.
When an agent has access to too much data, it can produce answers that are technically plausible but operationally wrong. It may mix records from different tenants. It may retrieve irrelevant historical data. It may return more information than the workflow needs.
A narrower row boundary reduces that ambiguity.
If an agent is configured for one tenant, it does not need to infer which tenant’s data to use. The boundary is already defined.
That has several practical benefits:
- Fewer wrong-context answers
- Less risk of mixing records from different tenants
- More predictable behavior across requests
- Easier testing of agent behavior
- Clearer debugging when something goes wrong
- Better separation between agent capabilities and data scope
In other words, multi-tenant configuration is not only about preventing bad access. It is about making agents easier to operate.
A better default for production agents
Many teams start with a broad database connection because it is fast.
You connect the database, give the agent access to a few tables and begin testing. That is understandable during prototyping.
Production requires a different mindset.
In production, an agent is not just a demo. It is a component that can retrieve real business data, sometimes repeatedly, sometimes autonomously and sometimes in response to a user request.
At that point, broad access becomes a liability.
A better default is:
- Start with a read-only database role
- Publish a reviewed Data Map
- Create routes for specific purposes
- Attach only the necessary routes to each agent
- Define row-level boundaries for tenant or user context
- Use typed responses where the result feeds a workflow
- Review traces to understand what the agent requested and received
This does not mean you need to build a complex security system before you can test anything. It means that the path from prototype to production should include a clear access model.
What developers gain
For developers building AI agents, multi-tenant configuration gives you a clearer way to reason about access.
Instead of asking “can my agent access the database?”, you can ask:
- Which tenant, user or business context is this agent serving?
- Which tables does it need?
- Which columns does it need?
- Which rows should it be able to retrieve?
- What should happen if no route fits the request?
- What did the agent retrieve?
Those are much more useful questions.
They turn agent security from a vague concern into a set of explicit design decisions.
How this fits into Claix
Claix is designed around controlled database retrieval for AI agents. Claix agents are the endpoint your application calls.
The Data Map describes your database. Routes define what data can be used for a purpose. Agents define who asks, which routes they can use, which rows they can retrieve and how answers are returned.
Multi-tenant configuration extends that model to the row level.
It means you can define not only what an agent can read, but also which records it can read.
For teams building AI products, that is a meaningful shift.
You no longer have to choose between giving an agent broad access and manually filtering every result in application code. You can define the boundary once, attach it to the agent and let the agent operate within it.
That is the core promise of multi-tenant agents in Claix: one endpoint, one job, only the rows you allow.
Frequently asked questions
- What is multi-tenant agent configuration?
- It is a way to define which rows an AI agent can retrieve, in addition to which tables and columns it can access. It is designed for products where multiple tenants, users or organizations share the same database. You set it on the agent. The product page is Claix agents.
- Why do AI agents need row-level boundaries?
- Because table and column permissions do not establish which records belong to the current tenant or user. Without a row boundary, an agent may retrieve data from another context even if its database role is read-only.
- Is a system prompt enough to isolate tenant data?
- No. A system prompt can guide agent behavior, but it is not a technical access boundary. Multi-tenant rules should be enforced by the retrieval layer.
- Can two agents use the same database but see different data?
- Yes. Two agents can share a database and even share routes, and still return different rows. Each agent chooses its routes, which set the tables and columns, and its own row boundary, which sets the records.
- Does multi-tenant configuration replace database permissions?
- No. It complements them. You should still use a narrowly privileged, read-only database role. Multi-tenant configuration adds a business-level retrieval boundary on top of that.
- What is the difference between a route and an agent?
- A route defines what data can be used for a purpose: the tables, the columns and a guide for reading them. An agent defines who asks, which routes it can use, which rows it can retrieve, how it responds and how often it can be called.
- Where do you configure the row boundary?
- On the agent, when you create or edit it. It is separate from the database role and from the prompt. See Claix agents.
- Can the same customer use a different column name on each table?
- Yes. One rule can match id on customers while another matches customer_id on orders. A single value has to match exactly. A list means any of those values. Several conditions on the same tables are combined with OR.
- What happens when a table is not included?
- The agent cannot query it, even if a route could otherwise reach that table. A row that matches none of the conditions for its table is not returned.
You might also like…
Security · Postgres
Read-only Postgres role for AI agents: step-by-step setup
Comparison · Security
Best Ways to Give AI Agents Safe Database Access in 2026 (Compared)
Guide · Security
Why Giving an AI Agent Direct SQL Access Is Dangerous (and What to Do Instead)
Security · Agents
How to let an AI agent query your Postgres database safely