semantic layer
How an AI agent reads your database
A live agent writes SQL against a cryptic schema, and real Postgres judges the answer. Start with no layer and hit ask the model — watch it guess wrong. Then flip to context, then to a constrained tool, and watch the same question go from wrong to provably right.
how the layer reaches the model
Definitions are handed over as text — the model still writes SQL, but now it knows the codes and the formula.
the session — what you asked & got
What is the total revenue from active customers in Germany?
ground truth (engine): …
booting the engine…
the wire — what the model actually sees
TABLE t_0 ( c1 text, c2 text, geo_cd text, amt_x numeric, st_flg text, dt_0 date, q integer )
semantic layer · editable
edit me, then ask again whose revenue? — why the layer is the contract
Same question, same rows. Two teams each have their own idea of “revenue” — and the engine gives each of them a different number.
Finance teamblessed
revenue = SUM(amt_x × q)
…
Growth team
revenue = SUM(amt_x)
…
Let your agent query this data anywhere in the app: