Letting agents query your semantic model safely

“Can we just ask the data a question?” is now one of the most common requests a BI team hears. Agentic AI makes it possible. The challenge is doing it without losing the definitions, security and auditability that make the data trustworthy in the first place.
Three ways to connect an agent to data
| Pattern | How it works | Main risk |
|---|---|---|
| Text-to-SQL on raw tables | The model writes SQL against the warehouse | Re-invents metric logic; inconsistent answers |
| Text-to-DAX on the semantic model | The model writes DAX against curated measures | Still free-form code; needs guardrails |
| Curated tools | The model calls named functions with parameters | Less flexible, but predictable and testable |
In practice the best systems combine the last two: a small set of well-described tools for the most common questions, and constrained query generation against the semantic model for the long tail.
Tools are the new API
With tool use (also called function calling), you describe operations the model may invoke, and your code executes them. The Model Context Protocol (MCP) standardises how those tools are exposed, so the same data tools can be reused across assistants and agent frameworks.
{
"name": "get_measure_by_period",
"description": "Return an approved business measure for a period, optionally split by one dimension.",
"input_schema": {
"type": "object",
"properties": {
"measure": { "enum": ["Gross Written Premium", "Claims Paid", "Policies Sold"] },
"period": { "type": "string", "description": "e.g. 2026-Q2 or 2026-09" },
"split_by": { "enum": ["Product", "Channel", "Region"] }
},
"required": ["measure", "period"]
}
}Notice the enum: the agent can only ask for measures that already exist in the model, with their agreed definitions. It cannot invent a new version of “premium”.
Guardrails that matter
Run as the user, not as a service account
Queries should execute with the requesting user’s identity so row-level and object-level security in the model still apply. An agent with god-mode credentials is a data leak waiting to happen.
Read-only, bounded and logged
- Agents query; they do not write back to production data.
- Limit rows returned, query time and the number of tool calls per request.
- Log every tool call, its parameters and the result for later review.
Show the working
Answers should cite the measure, filters and period used — ideally with a link to the equivalent report. Users trust what they can verify, and reviewers can spot errors quickly.
Treat data as untrusted input
Free-text fields (claim notes, complaint descriptions) can contain instructions that a model may follow. Keep tool outputs clearly separated from instructions and never let retrieved content trigger new actions on its own.
Prepare the model for its new audience
- Hide technical columns and helper measures.
- Write descriptions for every visible table, column and measure.
- Add synonyms for the words people actually use (“GWP”, “sales”, “new business”).
- Remove ambiguity: one measure per concept, clearly named.
- Build an evaluation set of real questions with verified answers before launch.
The semantic model was always meant to be the single source of truth for people. Done well, it becomes the single source of truth for agents too.