<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Asghar Shah</title>
    <description>The latest articles on Forem by Asghar Shah (@asghar_shah_fbe97d24ce0d5).</description>
    <link>https://forem.com/asghar_shah_fbe97d24ce0d5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854237%2Ff034aa70-cf36-4eee-9959-e1df0f0151de.jpeg</url>
      <title>Forem: Asghar Shah</title>
      <link>https://forem.com/asghar_shah_fbe97d24ce0d5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/asghar_shah_fbe97d24ce0d5"/>
    <language>en</language>
    <item>
      <title>The Agent Data Layer: A Missing Layer in AI Architecture</title>
      <dc:creator>Asghar Shah</dc:creator>
      <pubDate>Thu, 02 Apr 2026 21:46:17 +0000</pubDate>
      <link>https://forem.com/asghar_shah_fbe97d24ce0d5/the-agent-data-layer-a-missing-layer-in-ai-architecture-1beh</link>
      <guid>https://forem.com/asghar_shah_fbe97d24ce0d5/the-agent-data-layer-a-missing-layer-in-ai-architecture-1beh</guid>
      <description>&lt;p&gt;AI agents are getting access to production data and we’re doing it wrong.&lt;/p&gt;

&lt;p&gt;Most teams are connecting agents directly to databases.&lt;/p&gt;

&lt;p&gt;This works in demos.&lt;br&gt;
It breaks in production.&lt;/p&gt;

&lt;p&gt;Because AI agents are not deterministic systems.&lt;/p&gt;

&lt;p&gt;They:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;explore instead of follow rules
&lt;/li&gt;
&lt;li&gt;generate queries instead of executing predefined logic
&lt;/li&gt;
&lt;li&gt;optimize for answers, not safety
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Databases were built for humans.&lt;/p&gt;

&lt;p&gt;Agents don’t understand consequences.&lt;/p&gt;


&lt;h2&gt;
  
  
  What actually goes wrong
&lt;/h2&gt;

&lt;p&gt;When you connect an agent directly to a database, you introduce a new class of failures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unpredictable queries
&lt;/li&gt;
&lt;li&gt;Full table scans
&lt;/li&gt;
&lt;li&gt;Schema exposure
&lt;/li&gt;
&lt;li&gt;Cross-tenant data leaks
&lt;/li&gt;
&lt;li&gt;Destructive operations on production
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simple prompt like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Show me recent orders"&lt;br&gt;
can turn into:&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;customers&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;payments&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Now you’ve exposed everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Including data the agent should never see.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why existing solutions don’t work
&lt;/h2&gt;

&lt;p&gt;Teams try to patch this. None of the current approaches solve the core issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read-only roles&lt;/strong&gt;&lt;br&gt;
Still expose the entire schema. The agent can see everything. It just can’t write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semantic layers&lt;/strong&gt;&lt;br&gt;
Built for humans using BI tools. Not for autonomous agents generating queries dynamically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sandboxes&lt;/strong&gt;&lt;br&gt;
Drift from production immediately. Agents behave differently in real environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Human approval&lt;/strong&gt;&lt;br&gt;
Kills autonomy. Does not scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The missing piece: The Agent Data Layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We are missing a layer.&lt;br&gt;
A control layer between AI agents and production data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Agent Data Layer (ADL)&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Definition
&lt;/h2&gt;

&lt;p&gt;The Agent Data Layer is a controlled interface between AI agents and production data systems, where all access is mediated through predefined, parameterized datasets.&lt;/p&gt;

&lt;p&gt;The agent never touches the database.&lt;br&gt;
It calls named endpoints.&lt;/p&gt;

&lt;p&gt;Core principles&lt;/p&gt;

&lt;h2&gt;
  
  
  An Agent Data Layer enforces:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Datasets as endpoints&lt;/li&gt;
&lt;li&gt;Parameterized access only&lt;/li&gt;
&lt;li&gt;No schema exposure&lt;/li&gt;
&lt;li&gt;Field-level control&lt;/li&gt;
&lt;li&gt;Tenant isolation&lt;/li&gt;
&lt;li&gt;Auditable execution&lt;/li&gt;
&lt;li&gt;Deterministic interface&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this looks like in practice
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Without ADL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agent gets:&lt;br&gt;
host: prod.db.company.com&lt;br&gt;
user: admin&lt;br&gt;
password: ****&lt;/p&gt;

&lt;p&gt;Then generates queries freely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With ADL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agent gets:&lt;br&gt;
GET /datasets/recent_orders?customerId=123&lt;br&gt;
x-api-key: sk_live_...&lt;/p&gt;

&lt;p&gt;Response:&lt;br&gt;
{&lt;br&gt;
  "data": [...],&lt;br&gt;
  "rowCount": 8,&lt;br&gt;
  "executionTimeMs": 42&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;No SQL.&lt;br&gt;
No credentials.&lt;br&gt;
No schema.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI agents are moving into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multi-tenant SaaS&lt;/li&gt;
&lt;li&gt;customer-facing copilots&lt;/li&gt;
&lt;li&gt;production systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without a control layer:&lt;br&gt;
You don’t have an AI system.&lt;br&gt;
You have a data breach waiting to happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shift
&lt;/h2&gt;

&lt;p&gt;Old thinking:&lt;br&gt;
Give the agent access and add guardrails later.&lt;/p&gt;

&lt;p&gt;New thinking:&lt;br&gt;
Define what the agent can access before it runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;AI should not explore your database.&lt;br&gt;
It should operate within rules you define.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Agent Data Layer is that interface.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I’ve implemented this pattern in a real system. If you're exploring this space, I’d be interested in how you're approaching agent data access.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>softwareengineering</category>
      <category>database</category>
      <category>security</category>
    </item>
  </channel>
</rss>
