LLM Agents Academy
Module 14: Enterprise Agent Applications

Data Agents and Analytics Agents

Agents that query, analyze, and explain data using semantic layers and governed access

~20 min readIncludes code

Overview

In Lesson 01, you learned why enterprise agent design differs from consumer patterns: data scale, permission complexity, cost sensitivity, and audit requirements shape every design decision. This lesson applies the four-layer enterprise template to one of the most impactful verticals: data agents.

A data agent is an AI system that plans and executes multi-step data workflows using analytical tools like databases, warehouses, semantic models, and business intelligence platforms. Unlike simple chatbots that answer questions with single queries, data agents iteratively refine their approach, validate intermediate results, and construct evidence trails for human review.

Data agents appear in every data-intensive enterprise workflow: answering executive questions, investigating anomalies, generating reports, validating data quality, and recommending pipeline improvements. Understanding their architecture and limits is essential for deploying reliable analytical automation.

Data Agent vs Data Chatbot

Many organizations confuse data chatbots with data agents. The distinction matters for setting expectations and choosing the right architecture.

Chatbots answer questions; agents execute workflows.

Key takeaway: A data chatbot is a conversational interface to your data. A data agent is an autonomous analyst that plans, executes, validates, and reports on multi-step analytical workflows.

Core Capabilities

Enterprise data agents typically provide:

  1. Connection management — Access to databases, data warehouses (Snowflake, BigQuery, Redshift), lakehouses (Databricks, Delta Lake), and semantic models (Tableau, Power BI, dbt metrics)
  2. Schema understanding — Read table schemas, column types, relationships, and business terminology from metadata catalogs
  3. Query generation — Translate natural language questions into SQL, DAX, KQL, or other query languages appropriate to the platform
  4. Query validation — Check syntax, estimate cost, verify permissions, and prevent destructive operations before execution
  5. Result analysis — Interpret query results, detect anomalies, and explain findings in business terms
  6. Visualization and reporting — Produce charts, dashboards, or evidence-backed summaries for stakeholders
  7. Governance compliance — Respect row-level security, column masking, data lineage, and audit requirements

The capability list looks straightforward, but the enterprise challenge lies in bridging the semantic gap between how users describe their questions and how data is actually organized.

Why Data Agents Need a Semantic Layer

Data agents often fail because they translate natural language directly to database tables without understanding what the business means by terms like "sales," "active customer," "churn," "region," or "quarter."

Consider the question: "What was our revenue in EMEA last quarter?"

Without a semantic layer, the agent faces ambiguity:

  • Revenue definition: Gross revenue? Net revenue? ARR? Bookings? Recognized revenue?
  • EMEA definition: Which countries? Does it include the Middle East? Africa?
  • Quarter definition: Fiscal quarter or calendar quarter? Does fiscal Q1 start in January or another month?
  • Table selection: Is revenue in invoices, transactions, orders, or a materialized view?
  • Joins: How do you link revenue records to regional data? What is the correct join grain?
  • Permissions: Does the user have access to all EMEA data, or are certain rows masked?

A semantic layer provides canonical answers to these questions. It includes:

  1. Metric definitions — Explicit mappings from business terms to SQL expressions

    -- Example metric definition
    revenue = SUM(transactions.amount_usd) WHERE status = 'completed'
    
  2. Entity definitions — What counts as an "active customer," "churned account," or "qualified lead"

    -- Example entity definition
    active_customer = (last_login_date >= CURRENT_DATE - 30) AND (subscription_status = 'active')
    
  3. Business glossary — Canonical term-to-SQL mappings maintained by data teams

  4. Join specifications — How tables relate and at what grain (customer-level, transaction-level, daily aggregates)

  5. Permission-aware views — Pre-filtered tables reflecting row-level security and column masking rules

  6. Canonical dimensions — Standardized hierarchies for time, geography, product categories, and customer segments

Without a semantic layer, every data agent query is a gamble. With one, the agent can reliably translate business questions into correct analytical queries.

Key takeaway: The semantic layer is not optional for production data agents. It is the contract between business language and database reality.

Runtime Architecture

Data agents map to the Module 5 harness architecture with data-specific components:

Data agent architecture: context assembly (schemas, semantic layer, permissions) feeds the agent core, which dispatches to query engines, semantic models, and data-quality tools. Guardrails enforce read-only mode, validation, and cost limits. HITL gates require approval for write operations. Observability logs queries, sources, and evidence trails.

Context assembly includes:

  • Table and column schemas from metadata catalogs
  • Metric definitions from the semantic layer
  • Business glossary mappings
  • Row-level and column-level permission rules for the current user

Tool dispatch connects to:

  • Query engines (SQL databases, BigQuery, Snowflake)
  • Semantic models (Tableau, Power BI, dbt metrics)
  • Notebooks (Jupyter, Databricks)
  • Data-quality tools (dbt tests, Great Expectations)

Guardrails enforce:

  • Read-only mode by default (prevents accidental writes)
  • Query validation before execution (syntax, cost, permissions)
  • Row limits to prevent expensive scans
  • Cost limits to prevent runaway queries
  • PII masking for sensitive columns

HITL gates require human approval for write operations and high-impact decisions.

Observability logs:

  • Executed queries with timestamps
  • Data sources accessed
  • Result samples (not full datasets)
  • Confidence scores and evidence trails

This architecture prevents the most common data agent failures: unauthorized data access, expensive queries, hallucinated schemas, and unverified results.

Write-Action Autonomy Tiers

Not all data agent actions carry the same risk. Enterprise deployments use a tiered autonomy model:

Autonomy tiers determine when human approval is required.

Most production data agents operate at Tier 1 or Tier 2: they answer questions and produce insights but do not modify data or pipelines. Tier 3 agents recommend actions but require human decision-making. Tier 4 and Tier 5 agents execute changes but only after explicit approval and with full audit trails.

Key takeaway: Match autonomy tier to organizational risk tolerance. Start at Tier 1 and promote cautiously.

Worked Example

Question: "Why did sales decline in Ireland last quarter?"

Step 1: Schema Discovery

The agent queries the metadata catalog to find tables containing sales and geography data:

  • transactions table (columns: amount, currency, country, date, status)
  • customers table (columns: customer_id, country, segment)
  • regions table (columns: country, region)

Step 2: Metric Definition Lookup

The agent checks the semantic layer for the definition of "sales":

-- Semantic layer definition
sales = SUM(transactions.amount_usd) WHERE status = 'completed'

It also confirms that "last quarter" refers to the fiscal quarter (Q2 FY2026: April–June 2026).

Step 3: SQL Generation

The agent generates a comparison query:

SELECT 
  QUARTER(date) AS quarter,
  SUM(amount_usd) AS total_sales
FROM transactions
WHERE country = 'Ireland'
  AND status = 'completed'
  AND date >= '2026-01-01'
GROUP BY QUARTER(date)
ORDER BY quarter;

Step 4: Query Validation

Before execution, the agent validates:

  • Syntax is correct
  • User has permission to access transactions table
  • Estimated cost is within budget
  • No destructive operations (read-only query)

Step 5: Execution and Result Analysis

The query returns:

| Quarter | Total Sales | |---------|-------------| | Q1 2026 | $1.2M | | Q2 2026 | $0.9M |

The agent detects a 25% decline from Q1 to Q2.

Step 6: Evidence Trail Construction

The agent produces a summary with evidence:

Finding: Sales in Ireland declined 25% from Q1 to Q2 2026 (from $1.2M to $0.9M).

Data sources: transactions table (schema version 3.2), filtered by country = 'Ireland' and status = 'completed'.

Metric definition: Sales = SUM(amount_usd) for completed transactions.

Recommended next step: Investigate transaction volume and average transaction size to determine whether the decline is driven by fewer customers or smaller orders.

This evidence trail allows stakeholders to verify the analysis and decide on next steps.

Code Example

Here is a compact data analysis agent using the Anthropic SDK:

data_analysis_agent.py

This compact implementation demonstrates:

  • Schema discovery and query validation before execution
  • Read-only enforcement (rejects DROP, DELETE, UPDATE)
  • Semantic layer integration (metric definitions in system prompt)
  • Evidence trail construction (sources and definitions cited in output)

A production implementation would include connection pooling, cost estimation, permission checks, result caching, and integration with enterprise semantic layers.

Common Types

Enterprise data agents vary by scope and autonomy:

  1. Analytics agent — Answers business questions by querying warehouses and semantic models. This is the most common enterprise data agent.

  2. Data engineering agent — Assists with pipeline development, dbt model generation, and ETL troubleshooting. Operates at Tier 3 (recommendations) or Tier 4 (approved changes).

  3. Data quality agent — Monitors data freshness, completeness, and consistency. Detects anomalies and alerts stakeholders. Can execute data-quality tests.

  4. Governance agent — Audits data access, tracks lineage, and enforces compliance policies. Read-only with audit-trail generation.

  5. Data science agent — Supports exploratory analysis, feature engineering, and model evaluation. Often integrated with notebook environments.

Each type requires domain-specific tools, validation rules, and HITL workflows.

Reliability Limits

Data agents are not a solved problem. The 2026 Data Agent Benchmark (arXiv:2603.20576) evaluated frontier models on complex enterprise-style analytical tasks and found:

The best tested model reached only 38% pass@1 on tasks requiring multi-step reasoning, semantic layer understanding, and correct SQL generation.

Common failure modes include:

  • Hallucinating table or column names
  • Ignoring metric definitions from the semantic layer
  • Generating syntactically correct but semantically wrong queries
  • Misinterpreting join requirements
  • Violating permission boundaries

The data agent taxonomy paper (arXiv:2602.04261) notes that the term "data agent" is used inconsistently across vendors and proposes a hierarchy from low-autonomy assistants to more autonomous agents.

Claim status: verify

Some vendor benchmarks report higher success rates, but these often use simplified schemas and single-table queries that do not reflect enterprise complexity.

Key takeaway: Data agents require careful evaluation, human oversight, and continuous monitoring. Do not deploy them assuming reliability without validation.

Evaluation

Evaluating data agents requires both correctness metrics and workflow metrics:

Correctness:

  • SQL/query correctness — Does the generated query match ground-truth queries for known questions?
  • Source selection — Did the agent query the correct tables?
  • Metric-definition accuracy — Did the agent use canonical metric definitions?
  • Permission compliance — Did the agent respect row-level and column-level access controls?
  • Hallucination rate — How often does the agent reference non-existent columns or tables?

Workflow:

  • Reproducibility — Can another analyst verify the result using the evidence trail?
  • Evidence trail quality — Are data sources, filters, and definitions clearly documented?
  • Human-review workflow — How long does it take for a human to review and approve Tier 3+ actions?

Enterprise data teams often maintain golden question sets: a curated list of business questions with known correct answers. Data agents are tested against these questions before deployment and monitored continuously in production.

Enterprise Controls Used in This Vertical

Data agents rely on these enterprise controls (to be consolidated in Lesson 06):

  • Read-only enforcement — Prevents accidental or malicious data modification
  • Query cost limits — Prevents expensive scans and runaway queries
  • PII masking — Automatically redacts sensitive columns based on governance policies
  • Column-level access control — Restricts visibility of sensitive columns by user role
  • Audit of executed queries — Logs all queries with user identity, timestamp, and result samples

These controls are not optional. Without them, data agents pose unacceptable risk to data integrity and compliance.

Summary

Data agents plan and execute multi-step analytical workflows, bridging the gap between business questions and database reality. Unlike simple chatbots, they iterate on queries, validate intermediate results, and construct evidence trails for human review.

The semantic layer is critical: it provides canonical definitions for metrics, entities, and business terminology, preventing the most common failure mode—generating syntactically correct but semantically wrong queries.

Enterprise deployments use autonomy tiers to match agent capabilities to organizational risk tolerance, with read-only agents (Tier 1–2) deployed widely and write-capable agents (Tier 4–5) requiring approval workflows.

Current data agents are not fully reliable. Benchmarks show frontier models achieving only 38% pass@1 on complex tasks, with common failures including hallucinated schemas, ignored metric definitions, and violated permissions.

In Lesson 03, you will apply the same architectural template to knowledge agents and support agents, which navigate document repositories and resolve customer issues.

Check Your Understanding

Question 1 of 4

What is the primary difference between a data agent and a data chatbot?