Data Agents and AI Data Analysts
A data agent turns a question into evidence. The hard part is making sure it answers the question that was meant.
A data agent is an agent that answers questions or performs work over an organization's data: it interprets the request, finds the right definitions and tables, runs queries, checks the result and explains it. It is trustworthy when metrics are defined and owned, permissions are enforced by the data platform, ambiguity leads to a question instead of a guess, and every answer shows how it was produced.
What you will learn: what separates a data agent from a dashboard or a query generator, the AI data analyst pattern, how semantic layers and document retrieval fit in, a governed reference architecture and how to roll one out.
Prerequisites: What Is Agentic AI? and basic familiarity with tables and queries.
The example runs in November 2026 with Python 3.13 and only the standard library. The orders, metric definitions and owners are invented. Product names and features mentioned here were checked on November 28, 2026 and change often.
A working definition
People have asked computers about data for decades through reports, dashboards and query tools. Those require someone to decide in advance what will be asked, or require the person asking to know the tables. A data agent accepts a question in ordinary language and decides at run time which steps to take. It may search a data catalog, read a metric definition, write and run a query, notice that the result looks wrong, try a different table, and then describe what it found.
Three terms are often mixed up. Text-to-SQL is one capability: turning a sentence into a query. Natural language business intelligence is a product experience in which people ask questions and receive numbers and charts. A data agent is the loop around those: it can plan several queries, combine them with documents, ask for clarification and, in some designs, act on the result. It runs the same agent loop as other agents. The tools and the failure modes are different.
| Approach | Who decides the logic | Strength | Weakness |
|---|---|---|---|
| Dashboard | Analyst, in advance | Consistent and reviewed | Only answers expected questions |
| Query builder | User, with menus | Predictable | User must understand the data model |
| Text-to-SQL | Model, one step | Fast for simple questions | Can be fluent and wrong |
| Data agent | Model, over several steps, within rules | Handles follow-ups and investigation | Harder to test and to bound |
Kinds of questions, kinds of risk
Not all data questions are equally hard. Sorting them early tells you what to automate first and what to hand to a person.
| Question type | Example | What it needs | Typical risk |
|---|---|---|---|
| Lookup | How many orders shipped yesterday? | One governed metric and a date | Wrong definition or time zone |
| Comparison | How does this quarter compare with last? | Aligned periods and the same filters | Comparing a partial period with a full one |
| Breakdown | Which regions drove the change? | Dimensions and join paths | Double counting through joins |
| Diagnosis | Why did renewals fall? | Several queries, documents and judgment | A plausible story presented as a cause |
| Prediction | What will demand be next month? | A tested forecasting method | A guess without error bounds |
| Action | Email the customers who lapsed. | Write access and approval | Irreversible effect from a wrong list |
Lookups and comparisons over well-defined metrics are the sensible place to start. Diagnosis is useful when the agent presents findings as leads to examine. Prediction should call a model that has been evaluated for the purpose. Actions belong behind the approval rules described in Tool Permissions, Approvals and Abuse Risks.
Why a simple question is hard
"What was revenue in October?" sounds complete. A database sees several missing decisions.
| Open decision | Possible meanings |
|---|---|
| Metric | Booked, billed, recognized or collected; before or after refunds and tax |
| Time | Calendar or fiscal month; order date, ship date or payment date; which time zone |
| Population | All customers, external only, one business unit, test accounts removed |
| Currency | Local or converted, and at which rate |
| Freshness | Final figures or this morning's partial load |
| Permission | Everything, or only the rows this person may see |
An experienced analyst settles these from habit, context or a short conversation. An agent needs them written down, or it needs to ask. A query that runs without error tells you nothing about whether these choices were right.
The AI data analyst pattern
A reliable data agent works in a fixed outline and uses model judgment inside each step.
- Understand. Restate the question as metric, dimensions, filters, period and grain.
- Resolve. Match each term to an approved definition. Ask when more than one fits.
- Plan. Decide which queries and documents are needed, with a budget.
- Query. Run read-only queries under the asking person's identity.
- Check. Test totals, row counts, empty results, duplicated joins and freshness.
- Explain. Give the answer with definition, filters, period, source and limits.
- Learn. Record corrections so owners can improve definitions and tests.
Governed definitions come first
A semantic layer records what business terms mean in terms of data: which column and filter make up "net revenue", which dimensions it can be split by, which synonyms people use and who owns it. With it, the agent chooses a metric and lets the layer generate or constrain the query. Without it, the model reconstructs business logic from column names on every request. Semantic Layers and Business Metrics for AI covers the design in detail.
Several platforms build this in. Snowflake describes semantic views as database objects holding business concepts, and Databricks documents semantics in Unity Catalog, including metric views. There is also work on a vendor-neutral format: the Open Semantic Interchange effort published a first specification in January 2026 and in August 2026 moved to the Apache Incubator under the name Apache Ossie. Portability between tools is still maturing, so test it before relying on it.
A definition that an agent can use well includes more than a formula:
- A plain description and the questions it should and should not answer.
- Synonyms, including misleading ones that should trigger a clarification.
- The grain, the allowed dimensions and the default time column and time zone.
- Required filters, such as excluding test accounts.
- An owner, a status such as certified or draft, and a last review date.
- A few verified example questions with their expected queries.
The analyst's tools: tables, documents and code
Numbers rarely explain themselves. An analyst also reads release notes, incident reports, policy changes and meeting records. A data agent can do the same by combining structured queries with retrieval over documents, as described in RAG Explained and Agentic RAG.
| Tool | Answers | Control |
|---|---|---|
| Catalog search | Which data exists, and who owns it | Show only what the user may discover |
| Metric query | Certified figures | Prefer over free-form SQL |
| SQL query | Exploration beyond defined metrics | Read-only role, limits, label as unverified |
| Document search | Context, causes, definitions in prose | Document permissions and citations |
| Python sandbox | Statistics and charts on results | Isolated, no network, size limits |
| Ticket or message | Follow-up work | Approval before sending |
Keep the two evidence types distinct in the answer. "Renewals fell from 412 to 370" is a measurement from a named table. "A price change was announced the week before" is a statement from a document. "The price change caused the fall" is a hypothesis. Say which is which. Running code the model wrote needs the isolation described in Code Execution and Sandboxing.
An agent that asks before it guesses
The program below has three approved metrics with owners. The word "revenue" matches two of them, so the agent asks. It also asks for a missing period and declines a metric that does not exist. When it does answer, it prints the definition, the period boundaries and the number of rows used. A real system would use a model to interpret phrasing; the decision rules around it would look much the same.
"""A tiny governed data agent: resolve terms, ask when unsure, then query."""
import sqlite3
METRICS = {
"net revenue": {
"sql": "SUM(amount - refund)",
"table": "orders",
"filter": "status = 'complete'",
"owner": "finance",
},
"booked revenue": {
"sql": "SUM(amount)",
"table": "orders",
"filter": "status <> 'canceled'",
"owner": "sales",
},
"order count": {
"sql": "COUNT(*)",
"table": "orders",
"filter": "status = 'complete'",
"owner": "operations",
},
}
AMBIGUOUS = {"revenue": ["net revenue", "booked revenue"]}
PERIODS = {"october": ("2026-10-01", "2026-11-01")}
def load():
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE orders (day TEXT, amount INTEGER,"
" refund INTEGER, status TEXT)")
db.executemany("INSERT INTO orders VALUES (?,?,?,?)", [
("2026-09-30", 900, 0, "complete"),
("2026-10-02", 500, 0, "complete"),
("2026-10-09", 700, 100, "complete"),
("2026-10-15", 300, 0, "open"),
("2026-10-20", 400, 0, "canceled"),
])
return db
def resolve(question):
text = question.lower()
found = [name for name in METRICS if name in text]
if not found:
for word, choices in AMBIGUOUS.items():
if word in text:
return None, "Which do you mean: " + " or ".join(choices) + "?"
return None, "No approved metric matches. I will not guess one."
period = next((p for p in PERIODS if p in text), None)
if period is None:
return None, "Which period should I use?"
return (found[0], period), None
def answer(db, question):
plan, reply = resolve(question)
if plan is None:
return reply
name, period = plan
metric = METRICS[name]
start, end = PERIODS[period]
where = f"{metric['filter']} AND day >= ? AND day < ?"
sql = f"SELECT {metric['sql']}, COUNT(*) FROM {metric['table']} WHERE {where}"
value, rows = db.execute(sql, (start, end)).fetchone()
return (f"{name} for {period}: {value}\n"
f" definition: {metric['sql']} where {metric['filter']}"
f" (owner: {metric['owner']})\n"
f" period: {start} up to, not including, {end}; rows used: {rows}")
db = load()
for question in [
"What was revenue in October?",
"What was net revenue in October?",
"What was booked revenue in October?",
"What was net revenue?",
"What was customer happiness in October?",
]:
print("Q:", question)
print("A:", answer(db, question))
Output:
Q: What was revenue in October?
A: Which do you mean: net revenue or booked revenue?
Q: What was net revenue in October?
A: net revenue for october: 1100
definition: SUM(amount - refund) where status = 'complete' (owner: finance)
period: 2026-10-01 up to, not including, 2026-11-01; rows used: 2
Q: What was booked revenue in October?
A: booked revenue for october: 1500
definition: SUM(amount) where status <> 'canceled' (owner: sales)
period: 2026-10-01 up to, not including, 2026-11-01; rows used: 3
Q: What was net revenue?
A: Which period should I use?
Q: What was customer happiness in October?
A: No approved metric matches. I will not guess one.
The two revenue figures differ by 400, and both are correct under their own definitions. A system that silently picked one would be right for some askers and wrong for others, with no sign of which. Note also what the program does not handle: it recognizes only one month, matches names literally and ignores who is asking. Those are the gaps the rest of the architecture fills.
Present answers people can check
An answer should carry its own audit trail in a form a busy reader can scan.
| Element | Why include it |
|---|---|
| Interpretation | Lets the person catch a misread question immediately |
| Metric and status | Distinguishes certified figures from exploratory ones |
| Filters, period, time zone | Explains differences from other reports |
| Data as of | Shows whether the load was complete |
| Query, expandable | Allows an analyst to verify |
| Caveats | Small samples, missing rows, restricted data |
| Correction button | Turns mistakes into tests |
Say when rows were hidden by permissions if your policy allows it. Two people asking the same question may correctly receive different totals, and without a note that looks like a fault.
Follow-up questions
Real analysis is a conversation. "And for the north?" or "Excluding the large account" depend on what came before. Store the current interpretation as structured state, with metric, filters, dimensions and period, and update that state on each turn. Show the updated version. Relying on the model to remember filters through a long transcript leads to filters quietly disappearing or persisting when the person has moved to another topic. Reset the state on a clear change of subject, and let the person see and edit it. Context Assembly, Retrieval, Compression and Caching explains how to keep such state compact.
A governed data agent reference architecture
Five properties make the design governable:
- The user's identity reaches the data platform. Prefer delegated credentials to a shared service account that can see everything. See Agent Identity, Authorization and Secrets.
- Policy sits where it cannot be talked around. Row filters, column masks and grants live in the platform, not in the prompt.
- Meaning is versioned. Changing a metric is a reviewed change with tests, like code.
- Every answer is traceable. Keep the question, interpretation, definitions used, queries, data version and response.
- Spend is bounded. Limit queries per question, bytes or seconds scanned and model tokens.
Safe SQL, Permissions and Evaluation covers the policy layer, and Lineage, Governance, Lakehouse and Streaming Agents covers how classifications follow data through pipelines.
Build or use a platform feature
Data platforms increasingly include this pattern. Databricks offers Genie Agents, formerly called Genie Spaces, which its 2026 release notes describe as gaining a generally available agent mode in July for multi-step questions. Snowflake recommended in August 2026 that Cortex Analyst users move to Cortex Agents. Databricks, Snowflake and watsonx compares these. A built-in feature inherits platform permissions and saves integration work. A custom agent gives control over planning, mixed data sources and the user experience. Either way, the definitions, tests and ownership remain your work.
Evaluate meaning, not only syntax
Build a set of questions from real requests, each with the intended interpretation and a result computed by an analyst. Include the awkward ones.
- Questions with one clear answer, scored on the returned numbers.
- Ambiguous questions, where the correct behavior is to ask.
- Unanswerable questions, where the correct behavior is to say so.
- Questions touching data the test user may not see.
- Follow-up sequences that add, change and remove filters.
- Periods that are incomplete, empty or cross a fiscal boundary.
Report accuracy by question type, the rate of confident wrong answers, unnecessary clarifications, cost and time. A confident wrong answer deserves far more weight than a refusal. Rerun the set when the model, prompts, definitions or schema change, following Continuous Evaluation, Statistics and Scorecards.
Roll out in stages
| Stage | Scope | Exit test |
|---|---|---|
| 1. Analyst assist | Analysts review every query | Common questions pass the test set |
| 2. One domain | Certified metrics, a small user group | Corrections are rare and owners respond |
| 3. Exploration | Free-form SQL, clearly labeled | Users can tell verified from exploratory |
| 4. More domains | Add one at a time with owners | Each has definitions and tests first |
| 5. Actions | Drafted follow-ups with approval | List and effect verified before sending |
Starting narrow is not timidity. A domain with twenty well-defined metrics and an owner who fixes problems teaches you more than access to every table at once.
Keep trust after launch
Review corrections weekly. Group them by cause: missing definition, wrong join, stale data, misread question, permission surprise. Most causes point to the data and its documentation rather than the model. Publish what the agent can answer, and keep a route to a human analyst that carries the conversation along so nobody has to repeat themselves. Watch for figures copied out of the agent into reports; if that becomes normal, those figures need the same sign-off as any other published number.
When not to use a data agent
- The question is asked daily by many people: build a reviewed dashboard.
- The figure is regulated or published: use the controlled reporting process.
- Definitions are disputed: settle them first, because an agent will spread the disagreement.
- The data is poorly documented or unreliable: fix that, starting with Data Engineering, Catalog and Quality Agents.
- Nobody is able to check answers during the pilot.
Common mistakes
| Mistake | Consequence | Instead |
|---|---|---|
| Giving the agent raw tables only | Business logic reinvented each time | Define and certify metrics |
| Guessing on ambiguous terms | Correct-looking answer to another question | Ask, or state the assumption prominently |
| One powerful service account | Users see data they should not | Delegate identity to the platform |
| Showing numbers without context | Disputes and silent errors | Definition, period, freshness and query |
| Presenting causes as facts | Decisions based on a story | Label hypotheses and test them |
| Testing only that queries run | Wrong meaning passes | Compare results with analyst answers |
Checklist
- The first domain has certified metrics with named owners.
- Ambiguous and unanswerable questions have defined behavior.
- The data platform enforces the asking user's permissions.
- Queries are read-only and bounded in time, rows and cost.
- Answers show interpretation, filters, period, freshness and source.
- Conversation filters are visible and editable.
- A question set with expected results runs on every change.
- Corrections reach the people who own the definitions.
Frequently asked questions
Will a data agent replace analysts?
It can take routine retrieval and first drafts. Defining measures, judging causes and deciding what matters remain human work, and the agent depends on it.
Do we need a semantic layer before starting?
You need agreed definitions for the questions in scope. A small, owned set is enough to begin and can live in whatever tool your platform supports.
Why do two users get different totals?
Row-level permissions, different filters in conversation state or different load times can all explain it, so show these details with each answer.
Can it explain why a metric changed?
It can break the change into parts and find related documents. Treat the explanation as a hypothesis until someone tests it.
References
- Snowflake: overview of semantic views
- Databricks: Unity Catalog semantics
- Open Semantic Interchange specification repository
- Databricks: AI/BI and Genie release notes 2026
- Snowflake: transition from Cortex Analyst to Cortex Agents
Where to go next
Text-to-SQL Agents and Schema Linking
Turn questions into queries with the right schema context.
Safe SQL, Permissions and Evaluation
Bound access and measure correctness.
Semantic Layers and Business Metrics for AI
Define metrics once for people and agents.