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.
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 layer
Question it answers
Example failure caught
Syntactic
Can the query be parsed?
Malformed SQL or unknown column.
Structural
Can it execute against these tables?
Invalid join key or data type.
Permission
May this user or agent access the data?
Unauthorised customer or financial records.
Semantic
Does it represent the intended concept?
Gross sales used where net revenue was requested.
Analytical
Is the result methodologically sound?
Double counting caused by one-to-many joins.
Evidence
Can 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.
Define canonical business entities and their relationships
Publish approved metric definitions, including inclusions, exclusions and calculation logic.
Describe dimensions, valid values, units, currencies and time zones.
Document the grain of each table and measure.
Identify authoritative sources for conflicting attributes.
Record ownership, effective dates and version history for important definitions.
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.
Dataset
Row grain
Potential join risk
Orders
One row per order
Order total repeats for each child row.
Order lines
One row per item per order
Multiple lines per order.
Payments
One row per payment attempt or transaction
Retries, partial payments and refunds create multiple rows.
Shipments
One row per shipment or event
Split 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.
What does one row represent in each table?
Is the relationship one-to-one, one-to-many or many-to-many?
Which key is authoritative?
Will the join multiply a measure being aggregated?
Should one side be deduplicated or pre-aggregated first?
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 field
Example
Metric name
Net Revenue
Business owner
Finance
Definition
Approved recognised revenue measure; excludes tax and cancelled orders.
Calculation
Governed expression or tested semantic-model measure.
Time basis
Accounting date; fiscal calendar.
Currency
Functional currency using approved exchange-rate policy.
Grain
Aggregated by legal entity, period and product category.
Exclusions
Test orders, voided invoices and other policy-defined exclusions.
Version
Definition 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.
Define the event date used by each metric.
Distinguish event time from ingestion time and record-update time.
Specify the organisation’s time zone and daylight-saving treatment.
Use an explicit fiscal calendar where financial reporting requires it.
Handle late-arriving events, corrections and backdated records.
Clarify whether “current” means latest available snapshot or live operational state.
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.
Expose approved metrics and dimensions rather than every raw table by default.
Publish synonyms and glossary terms with explicit definitions.
Declare join relationships and grain constraints.
Attach ownership, freshness, lineage and sensitivity metadata.
Version semantic definitions and test changes before release.
Provide a safe way for agents to discover available concepts.
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.
Interpret the question and identify the intended business outcome.
Resolve ambiguous terms against the glossary and metric contracts.
Identify measures, dimensions, filters, time basis and data grain.
Construct a logical query plan using approved entities and relationships.
Validate permissions, join cardinality, aggregation behaviour and resource limits.
Generate SQL or call a governed semantic query interface.
Execute against an appropriately scoped read-only connection where possible.
Validate the result and preserve query, metric version and source lineage.
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.
Reconcile totals against an approved source or known control total where available.
Check row counts, null rates, duplicates and unexpected value distributions.
Compare results with prior periods and investigate material deviations.
Check whether aggregation and joins preserve declared grain.
Verify filters and exclusions against the selected metric contract.
Ensure every material claim in the narrative is supported by returned data.
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.
Original question and resolved interpretation.
Metric and semantic definition identifiers and versions.
Source systems, tables, views or APIs used.
Query plan and executed query, with sensitive values appropriately protected.
Data freshness or snapshot timestamp.
Filters, time boundaries, currency and relevant assumptions.
Validation checks performed and their outcomes.
Agent/model version and execution trace identifier.
Result identifier or reproducible reference, subject to retention and access policy.
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.
Respect row-level and column-level security in the query execution path.
Do not rely on the model to decide whether a field is sensitive.
Ensure semantic definitions do not expose hidden attributes through derived metrics or joins.
Log access decisions and data usage without copying sensitive values unnecessarily into prompts or traces.
Test whether aggregates can reveal restricted information through repeated or differencing queries.
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 failure
Why it happens
Architectural control
Uses order total as revenue
Order value is not approved revenue definition.
Resolve to finance-owned metric contract.
Counts cancelled orders
Status exclusions were not defined.
Apply governed filters and business rules.
Duplicates revenue after joining returns
One-to-many relationship multiplies order rows.
Use declared grain and approved join path.
Uses order creation date
Finance reports by recognition or invoice date.
Use metric-specific time semantics.
Compares currencies directly
Source amounts are in local currencies.
Apply approved exchange-rate policy.
Reports decline without evidence
Narrative 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.
Semantic mapping: does “active customer” resolve to the approved definition?
Grain: do joins preserve the expected aggregation level?
Metric: are inclusions, exclusions and calculations correct?
Temporal: are fiscal periods, time zones and event dates interpreted correctly?
Permission: are restricted rows and fields inaccessible through direct and derived queries?
Robustness: does the agent handle missing, duplicated, stale or contradictory data?
Abstention: does it ask for clarification when a question is ambiguous?
Evidence: can each numerical claim be traced to query output and source definitions?
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
User and identity layer — Authenticates the user, resolves role, tenant and permitted data scope.
Intent and clarification layer — Parses the question, detects ambiguity and asks for missing business meaning.
Business glossary and semantic contracts — Resolves approved metrics, dimensions, grain, time semantics and source authority.
Query planner — Builds an inspectable logical plan using governed entities and join paths.
Policy and query validator — Checks permissions, cardinality, aggregation, filters, resource limits and approved operations.
Execution layer — Runs queries through governed views, semantic APIs or scoped read-only database access.
Result verification — Reconciles totals, checks anomalies, validates evidence and determines whether to accept or abstain.
Provenance and observability — Records definitions, source versions, query, freshness, validation and final answer lineage.
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
Business metrics have named owners and approved definitions.
Table and view grain is documented for agent-accessible data.
Join paths and cardinality constraints are explicit.
Time zones, fiscal calendars and event-date semantics are defined.
Source authority and freshness are available to the agent.
Ambiguous business terms trigger clarification rather than silent assumptions.
Permissions are enforced in the query execution layer.
Queries are checked for fan-out, duplicate aggregation and resource limits.
Results are validated against independent business constraints where possible.
Material claims can be traced to data, definitions and query execution.
Evaluation covers semantics, grain, time, permissions, ambiguity and abstention.
Schema and metric-definition changes trigger tests and version updates.
Users can inspect assumptions and limitations of important answers.
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
Why can AI-generated SQL be correct but the answer be wrong?
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.
What is a semantic layer in enterprise AI?
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.
What is data grain and why does it matter?
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.
What is a metric contract?
A governed definition of a measure, including its calculation, owner, source, grain, time basis, inclusions, exclusions and version.
Can a semantic layer eliminate hallucinations in data agents?
No. It reduces ambiguity and constrains available business concepts, but agents still need query validation, permissions, result verification, evaluation and abstention.
How should enterprises evaluate data agents?
Use business-approved test questions and expected results. Test semantic mapping, joins, time logic, permissions, freshness, ambiguity, evidence and ability to abstain.
Should data agents query production databases directly?
Prefer governed views, semantic APIs or scoped read-only access. Direct access requires least privilege, query limits, auditing and protection for operational workloads.