An AI agent does not have direct access to your database - and that is exactly why it works

An AI agent does not access your database directly. It calls a controlled tool — a dataflow or API — that performs the actual queries or write actions. You determine what is possible; the agent operates within those boundaries. The value is not in retrieving data. It is about the agent deciding which action your process requires — and activating the right tool to make it happen. Controlled, traceable, and repeatable.

Robert Keunen

4 min

“Does the AI agent just go straight into your database?” It is a fair question – and the answer determines whether you trust it. Because if an agent can search your ERP data without any control, that is a problem. And rightly so.

The good news: that is not how it works. An AI agent does not have direct access to your database. Instead, it calls a tool — a data flow, an API, a query service — which then retrieves or writes the data. That sounds like a technical detail, but it is a fundamental architectural principle. And that is exactly why you can trust it.

How it works technically

An agent with tool-calling works in five steps, and each step is transparent:

Step 1: Understands the intent. The user gives an instruction: “Retrieve the outstanding invoices for customer De Vries.” The agent understands what is being asked — not literally, but based on meaning.

Step 2: Selects a tool. The agent chooses the right action from the available toolset. Not a free database query, but a defined tool: Get_OpenInvoices.

Step 3: Passes parameters. It populates the tool: { customerId: 123, status: “open” }. The parameters follow from the intent — not from a self-generated query.

Step 4: The tool executes the command. The data flow, API, or query service does the real work: connecting to the database, retrieving records, writing back changes. The agent waits for the result.

Step 5: The agent processes the result. It summarizes, displays a table, suggests a next action, or indicates if something does not seem right.

The agent does not execute SQL queries and does not make a direct database connection. Unless you have explicitly configured it that way — which is rarely desirable.

Three levels at which AI can work with data

Not all AI implementations are equal. There are three levels, and the level determines how much control you retain:

Level 1: Context (read-only, indirect). Data resides in the prompt, in a vector database, or in files. The agent “sees” the data but cannot act upon it. Safe, but limited.

Level 2: Tool calling (the standard). The agent triggers a controlled action — a data flow or an API endpoint. You determine which search queries are possible, which fields are visible, and which actions are available. This is the level at which serious ERP integrations operate.

Level 3: Direct database access (rare and risky). The agent generates queries itself and executes them directly on the database. The risks are significant: security leaks, unintended changes, and performance issues. In ERP environments, this is almost never the right choice.

The right architecture for ERP environments

The division of labor is clear:

Agent = orchestration and intelligence. It understands the instruction, selects the right tool, and determines the next steps.

Data flow or API = controlled execution. It knows the data model and ensures the right data ends up in the right place.

Dataclips = lookup and reference. Fixed lists and master data that the agent can consult without triggering an action.

The practical conclusion: the agent does not go “into” your ERP or database. It instructs a flow with the right parameters, and that flow does the real work.

Why this is powerful – and not limiting

Security is guaranteed. No direct database access means no risk of the agent operating outside its authorization. What the agent can do is exactly what you have defined.

Logic is reusable. A data flow built for an agent can also be used by your application or your employees. Build once, deploy multiple times.

Behavior is predictable. The agent operates within the boundaries you have set. This makes it easier to test, audit, and trust.

Complex processes are possible. Multiple tools in succession — retrieving, comparing, creating, marking — are coordinated by the agent as a structured chain.

The real insight: the agent decides, the flow acts

The value of an agent does not lie in retrieving data. The value lies in determining what action a process requires.

A search function delivers data.

An agent determines what needs to happen with that data.

Not: “give me the outstanding invoices.” But: “process this purchase confirmation, link it to the outstanding order, and prepare a payment proposal for review.” Behind this are three tools that the agent calls in sequence — controlled, traceable, and repeatable.

An AI agent does not have direct access to your database. And that is exactly why it works.

Curious about what that architecture looks like for your ERP and processes? We would love to think along with you.