Back to blog
NewGuides · Security

AI Agent Database Permissions Checklist: 12 Controls Before You Connect an Agent

Twelve controls to review before an agent touches production data: role, allowlists, tenant identity, write rules, approval, audit and a fail-closed check.

Claix · November 2026. Related guides: database access permissions, human approval before a write, and what to record in an audit log. Products: Claix Retrieve and Claix Guard.

Connecting an AI agent to a production database is easy. Controlling what that agent can read, what it can change, which user it acts for and what happens when something goes wrong is harder.

A database username and password are not a permission model. A prompt is not a permission model. A read-only role is a useful foundation, but it is not the whole answer.

This checklist gives you 12 controls to review before you let an AI agent access production data.

Why database permissions matter for AI agents

AI agents increasingly need live business data. They may answer questions about orders, inventory, customers, reservations, support tickets or internal operations. Without controlled database access, an agent can retrieve data it should not see, expose another tenant’s data, generate expensive queries, propose writes that violate business rules, modify or delete records, or leave an action that is hard to audit.

A prompt is not a permission model. Instructions can be misunderstood, overridden or manipulated. A robust system needs technical boundaries that do not depend on the model behaving perfectly.

The 12-control checklist

#ControlWhat it answersWhy it matters
1Dedicated database roleWhat can this database user do?Prevents the agent from inheriting broad privileges
2Read-only access for retrievalCan this agent write through the retrieval connection?Removes an entire class of accidental writes
3Table-level allowlistWhich tables can the agent access?Limits the agent’s data surface
4Column-level allowlistWhich columns can the agent retrieve?Prevents exposure of sensitive fields
5Row-level securityWhich records can this role access?Helps isolate users and tenants
6Tenant identityWhich customer or user is making the request?Establishes the scope of every request
7Retrieval limitsHow much data can one request return?Prevents oversized context and broad exposure
8Write permission boundaryCan this agent create, update or delete?Separates read-only agents from write-capable agents
9Business rules for writesWhich changes are allowed in this context?Enforces rules a database cannot easily express
10Human approvalWhich high-risk actions need a person?Prevents irreversible or sensitive actions from running automatically
11Audit trailWhat was requested, decided and executed?Makes incidents investigable
12Failure policyWhat happens if a check fails or times out?Prevents silent fallback to unsafe execution

Use this checklist as a review before production, not as a one-time exercise.

1. Use a dedicated database role

Do not connect an AI agent with a superuser, owner or administrator role. Create a dedicated role for the agent’s executor or retrieval layer. That role should have only the privileges it needs. A support agent may need read access to orders and customers. An operations agent may need read access to inventory and shifts. A write-capable agent may need a separate role with narrow write privileges. A dedicated role makes it easier to audit, revoke and reason about access.

2. Start with read-only access

If an agent only needs to answer questions, give it read-only access. Read-only access prevents the agent from creating, updating or deleting records through that connection. But it does not define which records the agent can read. A read-only role can still access records belonging to another tenant, sensitive columns, large volumes of data, or internal operational data a specific user should not see. Read-only access is necessary. It is not sufficient. See the MySQL read-only user and the Postgres read-only role.

3. Define a table-level allowlist

Do not give an agent access to every table. A support agent may access orders and customers. An operations agent may access inventory and shifts. A finance agent may access invoices and payments. This reduces the chance that an agent reaches data outside its intended scope.

4. Define a column-level allowlist

Even within an allowed table, not every column should be available. A support agent may need order status and customer contact information. It may not need payment details, internal notes or salary information. Column-level allowlists reduce the amount of sensitive data that can enter the model context.

5. Use row-level security for tenant isolation

If multiple customers share the same database, row-level security is essential. A database role can say “this agent can read orders.” Row-level security says “this agent can read only the orders that belong to this tenant.” Without that second boundary, you are sharing data. Keep row-level security when different people or tenants share a table. MySQL has no native row-level security; the workarounds are in the MySQL guide.

6. Establish tenant identity outside the prompt

Do not rely on the agent to decide which tenant it is serving. Tenant identity should come from your application, not from a prompt. A request should carry the authenticated user, the tenant or organization id, the role, and the task the agent is allowed to perform. That context should come from your authentication and authorization system.

7. Limit how much data a request can return

A broad query can expose more information than necessary and overload the model context. Define a maximum number of rows, columns, result size, questions per request, and execution time. Claix Retrieve returns typed values such as booleans, numbers, lists and JSON objects, so your code can branch on a clear value instead of parsing free text.

8. Separate read-only agents from write-capable agents

Not every agent should be able to write. A support agent may only need to answer questions. An operations agent may need to update inventory. A finance agent may need to issue refunds. Read-only agents use a read-only role. Write-capable agents use a narrow write role. Each agent has its own endpoint, retrieval boundary and business rules.

In Claix, a route defines which tables and columns an agent can retrieve. An agent is the identity that uses one or more routes. A support bot and an internal assistant can share the same database while seeing different data.

9. Add business rules for writes

Database permissions can decide whether an agent is allowed to write. They cannot easily decide whether a specific write makes sense: creating an order, changing a status, changing a price, deleting an order, a discount above 20 percent, a refund above 200 euros, or more than five refunds in one hour. Those are business rules. Claix Guard checks the proposed change and returns allow, deny, or needs approval, with the reason.

10. Add human approval for high-risk actions

Not every write should require a person. A routine status update can usually run automatically. A destructive operation should usually be denied. A refund above a threshold, a large discount, a sensitive field, an update that affects more rows than expected, or a deletion on a usually protected table may be legitimate and still deserve a person. Guard’s third verdict, needs_approval, is for that case. The workflow is in human approval with n8n and Slack.

11. Record an audit trail

A conversation transcript tells you what the agent said. It may not tell you what the system did. Distinguish what the agent requested, what the control layer decided, and what the executor actually completed. Claix traces every Retrieve request and every Guard decision. Your executor should record whether the write ran. See the audit log guide.

12. Define a failure policy

A guardrail only works if every write must pass through it. If an agent can reach the database directly with write credentials, it can bypass Guard.

  • Give the agent no write credentials.
  • Keep write credentials in one executor function in your code.
  • Make that executor call Guard before every write.
  • Execute the statement only if Guard returns allowed.
  • Return the denial reason to the agent when the answer is denied.
  • If the check cannot be completed, do not run the statement.

That last point is fail-closed. A timeout, a parse error or check_failed is not a reason to execute.

How Claix fits into this checklist

Claix does not replace database permissions. It adds a control layer on top of them.

Checklist controlHow Claix helps
Dedicated database roleClaix connects with a read-only role for retrieval
Read-only accessRetrieve is read-only by design
Table-level allowlistRoutes define which tables an agent can access
Column-level allowlistRoutes define which columns an agent can retrieve
Row-level securityKeep RLS in the database; Claix complements it
Tenant identityEnforced by your application and database controls
Retrieval limitsRoutes and agent boundaries limit the data surface
Write permission boundaryGuard checks proposed writes
Business rulesGuard enforces rules you approve
Human approvalGuard supports needs_approval
Audit trailRetrieve and Guard create traces
Failure policyDesign the wrapper to fail closed

Claix Retrieve controls what your agents can read. Claix Guard controls what they can change.

Common mistakes

  • Giving the agent broad database access. A prompt injection then has a much larger blast radius.
  • Treating a prompt as a permission. A prompt can guide behavior, but it is not an enforcement mechanism.
  • Letting the agent hold write credentials. It can bypass Guard.
  • Ignoring tenant boundaries when customers share a database.
  • Skipping audit trails, so you cannot tell what was requested, which rule applied and what ran.

How to use this checklist

  • Before development: decide which controls you need.
  • Before production: verify that each control is enforced.
  • After an incident: check which control failed.

Revisit it when you add a new agent, a new database or a new capability.

Conclusion

AI agent database permissions require more than a database username and password. You need to control what agents can read, which data they can access, which writes they can propose, which business rules apply and what happened after execution. Retrieve limits and structures what agents can read. Guard checks proposed writes before they run. Traces make requests and decisions reviewable. Use this checklist before you connect anything.