The Semantic Layer Is the New User Interface

The Semantic Layer Is the New User Interface

When an AI agent writes the SQL, your users stop reading dashboards and start trusting whatever the agent says. The semantic layer decides that answer, making it the real user interface. And it's ours to build. Getting it right comes down to 4 jobs for the data engineering team: capturing knowledge, writing metadata an agent can read, enforcing governance in the pipeline, and learning the business domain. Here's how we approach each one, using fund data as the example.Same question, two answers Picture a head of distribution asking an AI agent, "What were net flows into our equity funds last quarter?" An hour later, the finance controller types the same question. One gets $412 million. The other gets $388 million. Nobody hallucinated. The first query counted reinvested dividends as inflows; the second didn't. Same warehouse, same tables, a $24 million gap. A dashboard would've hidden this, because one analyst picked the definition years ago and froze it behind a chart. An agent picks again on every question. If we haven't written the choice down where it can read it, the model guesses. 1. Knowledge: write down what lives in people's heads Every warehouse runs on rules nobody wrote down. Flows are dated by trade date, not settlement date. Share class conversions don't count. An analyst with 6 years on the desk knows all of it. The agent knows none. So our first job is closer to interviewing than to engineering. We sit with the people who answer these questions today, ask how they'd calculate each number, and commit the answer as code. We capture the exceptions too, because that's where the arguments are: the fund that merged mid-year, the client whose fees are billed in arrears. The syntax below is illustrative and isn't tied to any one vendor. metric: name: net_flows label: Net flows description: > Client-driven money in minus money out, in USD. Excludes market movement, reinvested distributions, and conversions between share classes of one fund. synonyms: [net sales, net new money, net inflows] owner: finance-data expression: sum(subscriptions_usd) - sum(redemptions_usd) filters: - transaction_type not in ('REINVEST', 'CONVERSION') time_dimension: trade_date # not settlement_date fx_policy: daily_rate_on_trade_date grain: [fund, share_class, day] additive_over_time: true version: 3 That one-line comment about trade date used to be a hallway conversation. Now it's versioned, reviewable, and the same for every user. 2. Metadata: the copy the agent reads A person reads a chart title. An agent reads metadata, so we write it with the care we'd give interface copy. Descriptions and synonyms. Our users say "net sales" and "net new money" and mean the same metric. If the synonym isn't listed, the agent goes looking in raw tables. Additivity. Flows add up across days. AUM doesn't, because it's a balance. Sum it across 40 funds, and you're fine. Sum it across 90 days, and you've invented money. Grain and join paths. Join a fund-level measure to holdings, and a fund with 300 positions shows 300 times its assets. Declared joins prevent that; free-form SQL doesn't. Freshness and restatement. Finance data gets restated, so "last quarter" needs both an as-reported and an as-restated date. None of these fields is new. The reader is. A missing description used to annoy the next engineer; today it gives a VP the wrong answer. 3. Governance: enforce it in the pipeline A policy document doesn't stop a bad number. A failing build does. So we put governance where engineers already work. An owner and a version on every metric. "Net flows v3" should be as traceable as an API endpoint. Tests in CI. We keep plain-English questions with known answers and run them on every change. If one fails, the merge doesn't go in. Reconciliation. Each governed metric ties back to a system of record on a schedule, and the agent can say when that last happened. Scoped access. The agent sees only the metrics and rows a given user is entitled to, and we log which data it touched for each answer. Labels on the fallback. When the agent leaves the governed layer and writes raw SQL, the answer says so. The strictness has a reason. At dbt Summit 2026, Zach Mandell of dbt Labs made the point with basketball: a 92.3 percent free-throw shooter makes 10 in a row only about 45 percent of the time. An agent that has to find the table, the column, the join, and the filter runs that chain on every question. A governed metric turns 4 guesses into 1 lookup. 4. Domain knowledge: learn what the numbers mean Schemas don't tell you which definition a regulator expects. People in finance do. So we ask them 3 things about every metric: which system is the book of record, when the period closes, and who signs off the number. The answers matter because other teams use the same 4 words to mean different things. They're not wrong, either. Term What finance means What sales or product often means What breaks AUM Period-end market value, with fund-of-funds holdings eliminated Sum of every fund balance, sometimes averaged Double counting, and a total that will not tie to the reported figure Net flows Subscriptions minus redemptions, excluding reinvestments and conversions Everything in minus everything out Flows overstated in quarters with large distributions Revenue Contract fee rate on average daily AUM, net of waivers and rebates Headline fee rate on period-end AUM Forecasts that miss by the waiver amount Return Time-weighted, net of fees Gross of fees, or money-weighted A performance figure that cannot be published Take the revenue row. A fund billed at 65 basis points with a 10 basis point waiver really earns 55. Forget the waiver on $2 billion of assets, and you've overstated revenue by $2 million a year. An engineer who knows that will model waivers as a first-class field. One who doesn't will ship a clean pipeline that's wrong. It's why we'd rather spend a week inside finance's month-end close than another week tuning prompts. What this won't fix The layer only covers what we've defined, so exploratory questions still fall back to raw SQL. A wrong definition is now wrong everywhere. An agent can draft descriptions from query logs, but someone accountable still has to decide what "revenue" means and put their name on it. Where to start Pick the 10 metrics that reach your board. For each one, write the plain-language description before the SQL, name an owner, and add 5 test questions. None of it needs a new platform. Then run one experiment this week. Ask your agent the same question from two different accounts and compare the numbers. If they match, your semantic layer is doing its job. If they don't, you've just found your first metric to fix.

Original Source

Read the full article at Hackernoon →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.