Role-based access control for AI agents means the agent can use only the tools, rows and fields that the person asking is allowed to see. When a sales rep asks an AI assistant about overdue invoices, the answer should match what their own ERP screen would show: their region, their customers, and none of the bank details they never needed. These permissions are not an instruction in a prompt. They are checks that run on the server, on every tool call, before any data reaches the language model.

Below: tool permissions, row filters, field masking, default deny, deny messages and policy testing.

Why the agent must not use a super-user account

The quickest way to connect an AI agent to an ERP is one service account with broad rights. It is also the riskiest. The agent then sees everything, and the only thing standing between a junior user and the payroll table is the model following instructions. A prompt injection hidden in a customer note, a cleverly phrased question or a plain misunderstanding is enough to leak data.

The rule that holds up: the agent acts with the asking user’s permissions, never more. There are two common ways to connect a business system:

Connection mode Who the target system sees Where row limits come from
On behalf of the user The real user, with their own rights in the ERP The ERP applies its own limits; the agent’s policy adds to them
Service account One technical user The agent’s policy must filter rows; a missing filter means the call is refused

In both modes the agent’s policy can only narrow access. If the ERP itself refuses a request, the user is told that the target system denied it. The agent’s policy never widens what the ERP allows.

Four layers of AI agent permissions

1. Tool permission

Each endpoint the agent can use is a tool, marked as read or write. A role is bound to a set of tools: Finance gets payables.list and bank.balances, Sales gets orders.list and customers.get. A tool that is not bound to a role does not exist for that role. The agent cannot find it, so it cannot call it.

2. Parameter constraints

Some limits belong on the arguments. A warehouse user may query stock only for their own warehouses; a date range may be capped at 90 days. A constraint compares an argument with a fixed value or with a user attribute that comes from your identity provider, such as branch codes or department. When a constraint pins a parameter to one value, that value is filled in automatically, and a request for a different value is refused.

3. Row filter

A row filter removes rows from the result before the model sees them. A sales rep sees only customers whose region matches their own. Totals are then computed from the filtered rows, and the answer says so: the figures come from data within your permissions. If the field a filter relies on is missing from the result, the call is refused instead of being passed through unfiltered.

4. Field masking

Some records are fine to see but contain fields a role does not need. Data masking for LLM use works per field and per role:

  • Hide: the field is removed from the result, for example net salary for a sales manager.
  • Mask: the value is replaced with ••• and its type is kept, so the table still lines up, for example the IBAN for sales or the tax number for warehouse staff.

Masking happens before the result reaches the language model, so a masked value cannot leak through a summary or a follow-up question.

An example policy matrix

Data Sales rep Sales manager Finance HR
Customer orders Own region All regions All No access
Open receivables Own region All regions All No access
Customer tax number Masked Masked Visible No access
Supplier IBAN No access Masked Visible No access
Net salary No access Hidden No access Visible
Payment orders No access No access Draft, then approval No access

The cells that say “No access” matter most. Anything that is not granted is denied.

Default deny, and saying no clearly

With RBAC done properly, a newly published tool belongs to no role until someone binds it. Bindings only grant access; there are no separate deny rules to keep in sync, so least privilege builds up in one direction only.

A good denial is specific without revealing anything. Compare two answers to “Show me Ankara’s orders” from a sales rep in İzmir:

  • Weak: a generic error, or a vague answer the model assembled from whatever it could see.
  • Better: “You can only see data for your own branch. For wider access, contact the sales operations team.”

The second tells the user why and who can help, without hinting at what is behind the wall. In ORQEN, each workspace can name a permissions contact, and that name or link is added to the deny message. Internal codes, policy names and engine details never reach the user.

Policy engine and simulation before publishing

ORQEN evaluates these rules with a policy engine built on Open Policy Agent (OPA). Administrators edit a structured policy rather than raw policy code. The policy is compiled into data for one reviewed program, so one workspace’s rules never run as code next to another’s. If the engine cannot be reached or answers too late, the decision is deny; there is no fallback to allow.

Before a change goes live, you can test it:

  1. Simulate a user, a tool and arguments against the draft, and see the decision, the reasons, and the filters and masks that would apply.
  2. Save test cases with the expected outcome, such as “a sales rep in İzmir asking for Ankara orders is denied”. Publishing runs every case against the draft, and an unexpected result blocks the publish.
  3. Check the impact: replay the draft against the last seven days of decisions and list who would gain or lose access to which tool.
  4. Publish a new version. Published versions never change; a rollback creates a new version.

One enforcement point on every tool call

Where the check runs matters as much as what it checks. If chat enforces permissions and another channel does not, the weakest channel defines your security. In ORQEN, every channel goes through the same tool invoker: the chat, the test console and MCP clients such as Claude or Cursor. On each call the order is:

  1. Decide whether this user may call this tool with these arguments. If not, the target system is never called.
  2. Validate the input and fill in constrained parameters.
  3. Call the target system.
  4. Apply row filters, then field masks.
  5. Record the decision and the call.

Writes go one step further: they become drafts that wait on an approval card, and permissions are checked again at the moment of approval. The human-in-the-loop approval guide covers that flow, and MCP for business explains how external assistants reach the same tools with the same rules.

Audit: answering “who saw what”

Every tool call is written to the audit log: who, which tool, which channel, the outcome and the policy decision behind it. Argument values and result contents are left out, so the audit trail does not turn into a second copy of your sensitive data. Denials are always recorded, which shows you both a role missing a permission it needs and someone probing for data.

Checklist

  • The agent works with the asking user’s identity, or with a service account narrowed by policy, and never as an unrestricted super user.
  • Every tool is bound to roles explicitly; new tools start unbound.
  • Row filters for region, branch or warehouse exist wherever a service account is used.
  • IBANs, salaries, tax numbers and similar fields are hidden or masked for roles that do not need them.
  • Deny messages give the reason and name a contact.
  • Policy changes are simulated and tested before they are published.
  • Chat and MCP go through the same enforcement point.

The same policy applies whichever system sits behind the tools, whether you connect SAP, Salesforce or a custom API. To see these rules in a working team, read the finance and accounting use case or the security overview.

Talk to your company.

Connect your systems, choose what to watch and give your team one place to ask and act. We will show you ORQEN on your own use case.