AI & Software Architecture

The Silent Failure in Enterprise Data Agents: Why Correct SQL Can Still Produce Wrong Business Answers

A practical architecture guide to semantic correctness, metric definitions, data grain, joins, lineage and verification in AI-powered enterprise analytics

Executive summary

An AI data agent can generate syntactically valid SQL, execute it successfully and return a polished explanation—yet still give the business the wrong answer. The query may join tables at incompatible grains, use the wrong definition of revenue, count cancelled orders, ignore late-arriving records, or interpret a field differently from the finance team.

This is more subtle than a database error. The SQL engine can confirm that a query is valid. It cannot confirm that the query expresses the organisation’s intended business meaning.

The 2026 Data Agent Benchmark, presented in the EMNLP 2026 research programme, evaluates enterprise-style questions across heterogeneous datasets and database systems. Its abstract reports that the best-performing state-of-the-art agent achieved only 57% pass@1 on the benchmark. This is a useful warning: translating natural language into SQL is only one part of answering a business question correctly.

This article argues that production data agents need a semantic execution layer between natural-language intent and database queries. That layer should define canonical metrics, dimensions, data grain, join rules, time semantics, access boundaries and evidence requirements. Agents should generate candidate plans and queries; governed metadata, deterministic validators and business owners should establish whether the result is meaningful.

The objective is not merely executable SQL. It is an answer whose meaning can be explained, traced and verified.

Two colleagues discussing an enterprise data agent dashboard showing semantic metric definitions, relationship rules, query validation, ERP, CRM and analytics sources, and verification and lineage for the final answer.

Why this topic matters now

Enterprise teams increasingly allow users to ask operational questions in natural language: What was our net revenue last month? Which orders are delayed? How many active customers reordered within 90 days? Which products are driving returns? These questions sound straightforward because people share business context that is rarely written down in a database schema.

A database column called order_status may contain values with different operational meanings. A revenue measure may exclude tax, refunds, cancelled orders or internal transfers. A customer table may represent accounts, contacts, billing entities or individual consumers. Even “last month” can mean calendar month, financial period or rolling 30 days.

An agent must infer those semantics from incomplete signals unless the architecture makes them explicit. More capable models may generate more sophisticated queries, but reasoning ability alone does not establish the organisation’s metric definitions or resolve conflicting source systems.

The 2026 Data Agent Benchmark describes the difficulty of enterprise data work across fragmented databases, duplicated and inconsistent records, and important information embedded in unstructured text. Related 2026 research on agentic data engineering highlights risks such as selecting the wrong metric, combining incompatible analytical grains, using unauthorised data or producing conclusions unsupported by evidence.

1. The dangerous gap between SQL validity and business validity

Consider the question: “What was our revenue last quarter?” A data agent might discover an orders table, select total_amount, filter by order_date and calculate SUM(total_amount). The query can run perfectly. But is that the organisation’s revenue?

Perhaps total_amount includes VAT. Perhaps refunds are stored in a separate table. Perhaps cancelled orders remain in the order table. Perhaps revenue is recognised on dispatch rather than order creation. Perhaps the company reports in a functional currency while transactions are stored in local currencies.

The database engine evaluates syntax, types, permissions and execution. It does not know which accounting policy or management definition the question refers to.

Validation layerQuestion it answersExample failure caught
SyntacticCan the query be parsed?Malformed SQL or unknown column.
StructuralCan it execute against these tables?Invalid join key or data type.
PermissionMay this user or agent access the data?Unauthorised customer or financial records.
SemanticDoes it represent the intended concept?Gross sales used where net revenue was requested.
AnalyticalIs the result methodologically sound?Double counting caused by one-to-many joins.
EvidenceCan the answer be traced and supported?Unsupported or untraceable conclusion.

A production data agent needs all these layers. Passing the first two does not imply passing the rest.

2. Business semantics are not reliably encoded in table names

Traditional databases store and process structured records. Their schemas describe technical structure, not necessarily the business meaning users expect. A field called status, amount, date or customer_id can mean different things across systems.

An eCommerce platform may define an order as completed when payment is captured. A warehouse system may consider it completed when dispatched. Finance may recognise revenue only after delivery or invoicing. Each system can be internally consistent while answering a different operational question.

Make business definitions explicit and machine-readable rather than expecting the model to infer them from column names or sample rows.

3. Data grain: the quiet source of inflated numbers

Data grain describes what one row represents. It may be one order, one order line, one payment attempt, one shipment event, one customer per day or one product per warehouse. Combining tables without understanding their grain is a common cause of incorrect analytics.

Imagine an order with three line items and two payment events. Joining the order header to both child tables can create six rows. Summing the order total across the joined result may count the same order total six times. The SQL is valid; the number is wrong.

DatasetRow grainPotential join risk
OrdersOne row per orderOrder total repeats for each child row.
Order linesOne row per item per orderMultiple lines per order.
PaymentsOne row per payment attempt or transactionRetries, partial payments and refunds create multiple rows.
ShipmentsOne row per shipment or eventSplit shipments and status history multiply rows.

A semantic layer should declare grain and approved join paths. Query validation should detect joins that can multiply measures, require pre-aggregation where appropriate, or reject ambiguous combinations.

4. Metric contracts: make business calculations reusable and governed

A metric contract is a governed definition of a business measure. It specifies what is measured, how it is calculated, which source is authoritative, which filters apply, what grain is expected and who owns the definition.

“Net Revenue” should not be a free-form phrase that every agent translates independently. Its contract might define recognised sales excluding tax, cancelled orders and refunded amounts, grouped by accounting date and reported in functional currency. The exact definition must come from the organisation’s finance policy, not an AI-generated assumption.

Contract fieldExample
Metric nameNet Revenue
Business ownerFinance
DefinitionApproved recognised revenue measure; excludes tax and cancelled orders.
CalculationGoverned expression or tested semantic-model measure.
Time basisAccounting date; fiscal calendar.
CurrencyFunctional currency using approved exchange-rate policy.
GrainAggregated by legal entity, period and product category.
ExclusionsTest orders, voided invoices and other policy-defined exclusions.
VersionDefinition version and effective date.

If several definitions are plausible—booked revenue, invoiced revenue and recognised revenue—the agent should ask a clarification question rather than silently choosing one.

5. Time semantics: “today”, “current” and “last quarter” are not trivial

Time-related ambiguity can quietly invalidate an otherwise correct query. Business systems store several dates for the same event: created_at, paid_at, dispatched_at, delivered_at, invoiced_at and recognised_at. The correct date depends on the question.

A data agent should translate relative time phrases into explicit boundaries and state the interpretation. “Last quarter” should not silently become the previous 90 days if the business reports by calendar or fiscal quarters.

6. The semantic layer: a contract between business language and data systems

A semantic layer provides governed business concepts over physical data structures. It can expose approved metrics, dimensions, relationships, filters and calculation logic without requiring every application or agent to understand the underlying database design.

For an AI data agent, this layer acts as a controlled translation boundary. The user asks a business question. The agent maps the intent to approved concepts. The semantic layer resolves metric definitions, valid dimensions, relationships and constraints. A query planner then produces an executable plan against the underlying sources.

The semantic layer need not be one commercial product. It can use a BI semantic model, governed views, a metrics repository, data catalog metadata, typed APIs or a combination. The important point is that business definitions are reusable, versioned and testable.

7. Query planning should be inspectable before execution

A risky data agent jumps from a natural-language question directly to SQL. A safer design separates interpretation, planning, validation, execution and explanation.

  1. Interpret the question and identify the intended business outcome.
  2. Resolve ambiguous terms against the glossary and metric contracts.
  3. Identify measures, dimensions, filters, time basis and data grain.
  4. Construct a logical query plan using approved entities and relationships.
  5. Validate permissions, join cardinality, aggregation behaviour and resource limits.
  6. Generate SQL or call a governed semantic query interface.
  7. Execute against an appropriately scoped read-only connection where possible.
  8. Validate the result and preserve query, metric version and source lineage.
  9. Explain the result, assumptions, freshness and material limitations.

For high-impact analysis, expose a concise interpretation or plan before execution. This lets a user catch a wrong metric or time period before the query produces a confident but misleading answer.

8. Result verification: do not confuse a plausible number with a correct number

After a query runs, the agent still needs to test whether the result is credible. Verification should use independent evidence and business constraints, not merely ask the same model whether its answer looks right.

An unusual result is not necessarily wrong; a sudden revenue drop may be real. Anomaly checks should trigger investigation, not automatically overwrite a result with an expected value.

9. Provenance and lineage: show how the answer was produced

A business user should be able to inspect more than the final number. For important answers, retain enough provenance to reconstruct the result.

Lineage is also a debugging tool. When two departments receive different answers, provenance helps identify whether they used different definitions, source snapshots, filters or join paths.

10. Permissions and semantic correctness must work together

An answer can be analytically correct and still be inappropriate to disclose. Conversely, an agent may have permission to access a table but lack the business context needed to interpret it. Production data agents need both access control and semantic governance.

11. Enterprise example: a natural-language sales performance agent

A sales director asks: “Which product categories generated the highest net revenue last quarter, and which regions are declining?” The agent can access ERP orders, invoice records, returns, product master data and a regional hierarchy.

Potential failureWhy it happensArchitectural control
Uses order total as revenueOrder value is not approved revenue definition.Resolve to finance-owned metric contract.
Counts cancelled ordersStatus exclusions were not defined.Apply governed filters and business rules.
Duplicates revenue after joining returnsOne-to-many relationship multiplies order rows.Use declared grain and approved join path.
Uses order creation dateFinance reports by recognition or invoice date.Use metric-specific time semantics.
Compares currencies directlySource amounts are in local currencies.Apply approved exchange-rate policy.
Reports decline without evidenceNarrative overstates weak or incomplete result.Require claim-to-data support and show limitations.

A robust agent should return the ranking, state the metric definition and reporting period, identify source freshness and explain exclusions. If “net revenue” has multiple approved meanings across entities, it should ask which one the director intends.

12. Testing data agents: test meaning, not just SQL execution

Traditional SQL tests often verify that a query returns expected rows for a fixed dataset. Data agents need additional tests because natural-language interpretation and query plans can vary.

Build a golden evaluation set with business-owner-approved answers and query expectations. Include adversarial and ambiguous questions, not only clean examples. Re-run it when schemas, metric contracts, prompts, models or source pipelines change.

13. Reference architecture for semantically reliable data agents

This is a logical architecture, not a requirement to deploy eight separate products. Semantic contracts and enforcement points can use existing data-platform and application components.

14. Practical implementation roadmap

Choose one business question family: Start with a bounded domain such as sales performance, inventory availability or invoice status.

Identify authoritative sources: Map relevant systems, entities, grains, keys and data freshness expectations.

Agree metric contracts: Have business owners approve definitions, filters, time semantics, units and exclusions.

Expose a governed semantic interface: Publish approved metrics and dimensions through a semantic model, views or typed APIs.

Build the query planner and validator: Separate intent interpretation from query generation and execution.

Create a business-approved evaluation set: Include ambiguous wording, join traps, edge cases and permission tests.

Run in shadow mode: Compare agent answers with existing reports and analyst-reviewed results before users rely on them.

Monitor drift and definition changes: Version contracts, detect source changes and re-evaluate after updates.

Production-readiness checklist

Common anti-patterns

Giving the agent unrestricted warehouse access. A large schema increases ambiguity and exposure; publish a governed data surface.

Treating successful SQL execution as proof of correctness. The database validates execution, not business meaning.

Letting the model invent metric definitions. Business owners must govern canonical measures and exclusions.

Ignoring table grain and join cardinality. Valid joins can multiply facts and inflate aggregates.

Using one generic date field for every report. Different business events require different time semantics.

Asking the model to verify its own answer without independent checks. Use deterministic constraints, source evidence and approved evaluations.

Returning a confident answer when definitions conflict. Clarify, show alternatives or abstain.

Conclusion: make business meaning executable

Enterprise data agents will not become dependable simply by generating better SQL. The difficult part is translating business language into the organisation’s actual definitions, relationships, policies and reporting rules.

A semantic layer makes those definitions reusable. Metric contracts establish ownership and calculation logic. Grain-aware query planning prevents accidental multiplication. Result verification tests whether the answer is supported. Provenance allows teams to reproduce and investigate it.

The model remains valuable: it helps users express questions, discover relevant concepts, construct candidate plans and explain results. But the model should not be the sole authority on what revenue means, which records belong in a calculation or whether a result is safe to publish.

The goal is not to make AI better at guessing what the business means. It is to make the business meaning explicit enough that AI can use it correctly.

FAQ

SQL correctness confirms that a query can execute. It does not prove that the selected metric, filters, joins, time basis or aggregation match the intended business definition.
A semantic layer provides governed business concepts—metrics, dimensions, relationships, filters and definitions—over physical data sources so applications and agents can query consistent meanings.
Grain describes what one row represents. Joining tables with different grains can multiply records and inflate sums or counts unless the query aggregates or joins appropriately.
A governed definition of a measure, including its calculation, owner, source, grain, time basis, inclusions, exclusions and version.
No. It reduces ambiguity and constrains available business concepts, but agents still need query validation, permissions, result verification, evaluation and abstention.
Use business-approved test questions and expected results. Test semantic mapping, joins, time logic, permissions, freshness, ambiguity, evidence and ability to abstain.
Prefer governed views, semantic APIs or scoped read-only access. Direct access requires least privilege, query limits, auditing and protection for operational workloads.