Give an AI agent access to your data warehouse and it will write SQL. It might even write good SQL. But ask two agents the same revenue question and you'll get two different numbers. Neither matches finance's report. That's the core problem: text-to-SQL gives agents access to data, not understanding of it.
A . It writes a query summing amount from orders where created_at is between January 1 and March 31. Reasonable.
Ask GPT the same question. It filters on status = 'completed' first, then sums. Different number. Also reasonable.
Neither agent knows that your finance team excludes refunds and trial conversions from revenue. That logic lives in a Notion doc that got updated six months ago. The agents don't have access to it. They generate plausible SQL from column names and return plausible numbers that don't match anything your team reports.
This isn't a model quality problem. It's a context problem. The agent sees schema, not semantics.
No access control
You're building a B2B product. Customer A asks your agent a question. The agent writes SQL against the warehouse. Nothing in the text-to-SQL pipeline enforces that Customer A only sees Customer A's data.
You can patch this. Add tenant filters to prompts. Write middleware that rewrites queries. Build a validation layer. Each patch is a new surface for bugs. One missed filter and you've got a data leak in production.
requires a fixed, versioned definition that every consumer references. Without it, every query is an ad hoc interpretation of raw data.
What is a semantic layer for AI agents?
A semantic layer is a metadata layer between your data warehouse and every data consumer. It defines business metrics, relationships between tables, and access rules in one place. Consumers query metric definitions instead of raw tables.
For AI agents specifically, the semantic layer:
Translates natural language to governed queries. The agent asks for "revenue." The semantic layer knows that meansSUM(amount) WHERE status != 'refunded' AND type != 'trial'. The agent never writes this SQL itself.
Enforces multi-tenancy and access control. Every query runs through row-level security rules defined in the schema. The agent physically cannot return unauthorized data.
Provides an API, not a database connection. The agent calls a query endpoint or adds avisualizetool to your MCP server in a few lines:
CODEnpm install @bonnard/mcp-charts
CODEimport { addCharts } from "@bonnard/mcp-charts";
// your data, your connection. Bonnard never touches the database
addCharts(server, { runSql });
The agent calls
visualizewith a query, yourrunSqlreturns the rows, and Bonnard infers the chart from the typed result, then renders an interactive widget in Claude or ChatGPT. The chart comes from your query result, not from tokens the model invents. Same data, same chart, every time.
For the full setup walkthrough, see .
Agentic semantic layer vs traditional BI semantic layer
Not every semantic layer works well with AI agents. Most were built for BI tools and retrofitted. The difference matters in production.
Capability
Traditional BI semantic layer
Agentic semantic layer
Primary consumer
Dashboards, analysts
AI agents, LLMs, applications
Interface
SQL or proprietary query language
MCP, REST API, SDK
Multi-tenancy
Afterthought or manual
Built-in, per-query enforcement
Access control
Dashboard-level
Row-level, per-consumer
Discovery
Human browses catalog
Agent calls explore_schemaat runtime
Caching
Cube-level
(Model Context Protocol) is the emerging standard. Without it, you're writing custom integration code for every agent.
Multi-tenancy. If you're building a B2B product, every agent query needs to be scoped to a specific tenant. This should be structural, not a prompt injection.
Row-level security. Beyond tenant scoping, you need fine-grained access control. Marketing agents see marketing data. Finance agents see finance data. Defined in the schema, enforced on every query.
Pre-aggregation. AI agents make more queries than humans. Sub-second response times require cached rollups, not full table scans on every request. Look for configurable pioneered the open-source semantic layer. offer semantic layer capabilities for different stacks. The right choice depends on your stack, your use case, and whether you need the semantic layer to serve AI agents as its primary consumer or as a secondary integration.
Once the agent can query governed metrics, give it a way to chart the result. that data agents are "essentially useless without the right context." They're right. But context isn't a feature you add later. It's the layer you build on.
The companies shipping agentic analytics today are the ones that defined their metrics before connecting their agents. The ones struggling are the ones that gave agents raw warehouse access and are now debugging why different tools return different numbers.
A semantic layer isn't optional infrastructure for AI agents. It's the control plane that makes everything downstream trustworthy.
Frequently asked questions
Do I need a semantic layer if I already use dbt?
dbt defines transformations: how raw data becomes clean tables. A semantic layer defines metrics: how clean tables become business numbers. They're complementary. dbt gets your data into the right shape. The semantic layer defines what "revenue" means on top of that shape. Many semantic layers can import dbt models directly.
What's the difference between a semantic layer and RAG?
RAG (Retrieval-Augmented Generation) feeds documents to an LLM for context. A semantic layer feeds governed metric definitions to an agent for data queries. RAG is for unstructured knowledge ("What does our refund policy say?"). A semantic layer is for structured data ("What was Q1 revenue?"). You likely need both, but they solve different problems.
Can I use a semantic layer with Claude, GPT, and open-source models?
Yes. A semantic layer with MCP support works with any MCP-compatible client: Claude Desktop, Cursor, Claude Code, and others. For non-MCP agents, most semantic layers expose REST APIs or SDKs. The semantic layer is model-agnostic because it sits between the agent and the warehouse, not inside the model.
How is this different from giving agents read-only database access?
Read-only access prevents writes but doesn't prevent incorrect reads. The agent still interprets column names, guesses JOIN conditions, and invents filter logic. A semantic layer replaces interpretation with definition. The agent queries
total_revenueand gets the exact calculation your finance team agreed on, every time.
What's the performance impact of adding a semantic layer?
With pre-aggregation, queries typically get faster, not slower. The semantic layer caches rollups so agents query pre-computed results instead of running full aggregations on every request. Cold queries hit the warehouse directly. Hot queries resolve in single-digit milliseconds.
↗ Original-Artikel auf dev.to lesenVollständiger Original-BerichtAusführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.Wie bewertest du diesen Beitrag?1 Klick FeedbackTeilen mit Netzwerk & Team:Hat Ihnen dieser Tipp / Anleitung geholfen?Community-Analysen & Experten-Meinungen 0
Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf „ Eigene Analyse verfassen“!Community Pulse: Relevanz-Einschätzung1 Klick Experten-Votum🔴 Akute Relevanz 0%🟡 In Evaluierung 0%🟢 Keine Auswirkung 0%Spannende Innovation 0%Port 8095 EngineVerwandte Story-Cluster & Quellen (Vektor-KI)
Tipp: Mit Pfeiltasten [ ← ] und [ → ] blättern
Ähnliche Beiträge
🔍 Verwandte NewsAuch interessante Nachrichten Why Your AI Agents Need a Semantic Layer
Thematisch verwandte Begriffe: Your, Agents, Need, Semantic · 6 Treffer
🔧 AI Nachrichten Elastic Security LabsAgentic Frameworks Summary
🔧 AI Nachrichten freeCodeCamp Programming TutHow to Build AI Systems That Know When They Don't Know: A Practical Guide
⚠️ Malware / Trojaner / Viren Elastic Security LabsAutomating GOAD and Live Malware Labs
🕵️ Sicherheitslücken freeCodeCamp Programming TutHow AI Is Changing Patching and What Devs Need to Know About Exposure Management
Laden...Videos werden geladen ...
Laden...Beiträge werden geladen ...
Laden...Videos werden geladen ...
Laden...Beiträge werden geladen ...
Laden...Videos werden geladen ...
Laden...Beiträge werden geladen ...
Laden...Videos werden geladen ...
Laden...Beiträge werden geladen ...
Laden...Videos werden geladen ...
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.📂 News ⏱️ 3 Min vor 10 MinArtikeldaten werden geladen...Zum Aktualisieren ziehen
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms LadezeitInstalliere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.
Nächster Beitrag🤖Community Radar & Live Chat
Sentinel Bot online • Live-StreamDein Cluster: Security Explorer👥 Match:lädt…📡 Aktivitäten deiner Analysten
lädt…💡 Neues Thema oder Eilmeldung einreichen
Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.
🔥 Heiß diskutierte Einreichungen
SOCIAL SHARE CARD GENERATOR