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.

BeginnerIntermediateExpert · 15 min read · Last updated:

In short

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.

Versions used

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.

Beginner What a data agent is

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.

ApproachWho decides the logicStrengthWeakness
DashboardAnalyst, in advanceConsistent and reviewedOnly answers expected questions
Query builderUser, with menusPredictableUser must understand the data model
Text-to-SQLModel, one stepFast for simple questionsCan be fluent and wrong
Data agentModel, over several steps, within rulesHandles follow-ups and investigationHarder 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 typeExampleWhat it needsTypical risk
LookupHow many orders shipped yesterday?One governed metric and a dateWrong definition or time zone
ComparisonHow does this quarter compare with last?Aligned periods and the same filtersComparing a partial period with a full one
BreakdownWhich regions drove the change?Dimensions and join pathsDouble counting through joins
DiagnosisWhy did renewals fall?Several queries, documents and judgmentA plausible story presented as a cause
PredictionWhat will demand be next month?A tested forecasting methodA guess without error bounds
ActionEmail the customers who lapsed.Write access and approvalIrreversible 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 decisionPossible meanings
MetricBooked, billed, recognized or collected; before or after refunds and tax
TimeCalendar or fiscal month; order date, ship date or payment date; which time zone
PopulationAll customers, external only, one business unit, test accounts removed
CurrencyLocal or converted, and at which rate
FreshnessFinal figures or this morning's partial load
PermissionEverything, 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.

Intermediate The analyst pattern, definitions and example

The AI data analyst pattern

A reliable data agent works in a fixed outline and uses model judgment inside each step.

  1. Understand. Restate the question as metric, dimensions, filters, period and grain.
  2. Resolve. Match each term to an approved definition. Ask when more than one fits.
  3. Plan. Decide which queries and documents are needed, with a budget.
  4. Query. Run read-only queries under the asking person's identity.
  5. Check. Test totals, row counts, empty results, duplicated joins and freshness.
  6. Explain. Give the answer with definition, filters, period, source and limits.
  7. Learn. Record corrections so owners can improve definitions and tests.
Askquestion
Resolvemeaning
Queryread-only
Checksanity
Explainevidence
Resolving meaning comes before writing any query.

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.

ToolAnswersControl
Catalog searchWhich data exists, and who owns itShow only what the user may discover
Metric queryCertified figuresPrefer over free-form SQL
SQL queryExploration beyond defined metricsRead-only role, limits, label as unverified
Document searchContext, causes, definitions in proseDocument permissions and citations
Python sandboxStatistics and charts on resultsIsolated, no network, size limits
Ticket or messageFollow-up workApproval 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.

ElementWhy include it
InterpretationLets the person catch a misread question immediately
Metric and statusDistinguishes certified figures from exploratory ones
Filters, period, time zoneExplains differences from other reports
Data as ofShows whether the load was complete
Query, expandableAllows an analyst to verify
CaveatsSmall samples, missing rows, restricted data
Correction buttonTurns 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.

Expert Reference architecture, evaluation and rollout

A governed data agent reference architecture

Interfacechat, charts, evidence and corrections
Agent serviceplan, budgets, conversation state, traces
Meaning layercatalog, metrics, synonyms, verified queries
Policy layeridentity, row and column rules, limits
Data platformwarehouse, lakehouse, document index
Permissions are enforced below the agent, so a mistaken plan cannot widen access.

Five properties make the design governable:

  1. 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.
  2. Policy sits where it cannot be talked around. Row filters, column masks and grants live in the platform, not in the prompt.
  3. Meaning is versioned. Changing a metric is a reviewed change with tests, like code.
  4. Every answer is traceable. Keep the question, interpretation, definitions used, queries, data version and response.
  5. 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

StageScopeExit test
1. Analyst assistAnalysts review every queryCommon questions pass the test set
2. One domainCertified metrics, a small user groupCorrections are rare and owners respond
3. ExplorationFree-form SQL, clearly labeledUsers can tell verified from exploratory
4. More domainsAdd one at a time with ownersEach has definitions and tests first
5. ActionsDrafted follow-ups with approvalList 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

MistakeConsequenceInstead
Giving the agent raw tables onlyBusiness logic reinvented each timeDefine and certify metrics
Guessing on ambiguous termsCorrect-looking answer to another questionAsk, or state the assumption prominently
One powerful service accountUsers see data they should notDelegate identity to the platform
Showing numbers without contextDisputes and silent errorsDefinition, period, freshness and query
Presenting causes as factsDecisions based on a storyLabel hypotheses and test them
Testing only that queries runWrong meaning passesCompare 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

Where to go next