Read-Only Analytical Surfaces for Safe Agent Access
Pre-modeled data layers enforce governance deterministically before agents execute queries.

Safe agent access to data is an architecture problem. Read-only analytical surfaces address it by giving agents data that is governed and pre-modeled in place of direct access to production databases. The architecture separates analytical work from transactional systems while making metric definitions, access boundaries, and audit records part of the data interface itself.
Why giving agents a permissions toggle doesn't solve the data access problem
An agent with read-only access to a production Supabase instance can issue a full-table scan during peak traffic without violating its permissions. It can also select an apparently relevant column, misunderstand its meaning, and return a confident answer. A permissions toggle controls an operation, but it does not establish whether the underlying data architecture is fit for autonomous consumption.
Human analysts can ask colleagues what a field means, flag uncertainty, and wait for an export. An autonomous agent starts a query cold, selects a table, and can act without exposing ambiguity. Without table definitions, ownership, freshness, and access rules available before reasoning begins, a small error in meaning can become a wrong decision. Technical access does not supply business context.
Before the Tool Call: Deterministic Pre-Action Authorization for Autonomous AI Agents characterizes the gap between what agents can do and what they should do as an authorization problem, not an alignment problem. Model alignment is probabilistic and takes shape during training, while post-hoc evaluation looks back at what has already happened. Neither deterministically authorizes an individual tool call before execution. Read-only roles and session-level access checks therefore leave a structural gap, even when the credentials are correctly configured.
What a read-only analytical surface actually is, and what it replaces
A read-only analytical surface is a pre-modeled, governed dataset that agents query. It exposes only data deliberately placed within its boundary. Direct production access, by contrast, exposes the live transactional state and its schema while sharing its query performance budget.
Within that boundary, pre-calculated metrics come with agreed definitions, so each consumer has less need to work out what raw columns mean. Semantic context includes table definitions, ownership, freshness timestamps, and lineage. Agents cannot reach tables outside the surface, regardless of credential scope, and every query has an audit record.
The surface is a queryable data layer. Human teammates and agents consume its modeled data through the same interface, with role-based or attribute-based access controls built into that interface. It replaces direct database access mediated only by read-only Postgres roles. Those roles prevent writes, but they do not separate analytical scans from production CPU, memory, and I/O.
Why production Postgres is the wrong query target for agents
Postgres is optimized for transactional workloads composed of small, fast queries that touch a few rows. Analytical queries do different work. They scan millions of rows, aggregate records, and compute statistics, competing with transactions for CPU, memory, and I/O. In a production Supabase instance, an agent can therefore consume resources needed by the application while remaining entirely within its read-only role.
Row-level security can also slow queries because its policies must be checked for every row a query touches. A naive policy can run an authentication function again for each row, which can make queries on large tables much slower. A policy intended to protect data can also amplify query cost. Wrapping the authentication call so Postgres evaluates it once per statement, with an index on the filtered column, requires deliberate engineering.
A read replica isolates analytical work from the primary, but isolation addresses only part of the problem. The replica still exposes raw tables that an agent must interpret, and it does not supply metric definitions or request-level governance. Decisions that affect money, inventory, or customer experience also need fresh data. Those decisions cannot depend on data that is hours old, yet production Postgres is a transactional system rather than a freshness-optimized analytical serving layer. A replica mitigates workload contention.
How MCP connects agents to data surfaces — and where it stops
MCP standardizes how agents call tools and access resources. Its host is the AI application or agent, its client manages server connections inside that host, and its server exposes tools, resources, and prompts. That division gives the analytical surface a common interface. It does not provide the platform underneath. Identity, governance, semantic grounding, performance, lineage, cost controls, and auditability still depend on the implementation behind the server.
The OAP paper reports that security researchers enumerated hundreds of production MCP servers exposed without authentication or encryption. CVE-2026-26118, with a CVSS score of 8.8, illustrates a different risk. A low-privileged authenticated attacker can supply a malicious URL to an Azure MCP Server tool and cause the server to leak its managed identity token. Microsoft has not confirmed active exploitation in the wild. MCP security guidance also forbids token passthrough because a proxy can become a confused deputy, using elevated permissions for a less-privileged caller.
For analytics, a governed tool set describes approved datasets, retrieves metric contracts, runs metric queries, and checks freshness. It can also expose lineage, compare a value with a baseline, and request workflow approval. These tools define permitted questions. Stateless MCP patterns make it easier to distribute requests across server instances behind a load balancer, isolate requests, and recover from failures. These operational benefits do not replace enforcement beneath the protocol.
What governance must do at the request level, not the session level
Before any attempted action runs, a policy evaluation must check the request, earlier actions in the session, and what is happening in the business at that time. An agent can stay active after the conditions that justified its original permissions have changed. A grant made in January may still be used in August, while monthly reviews cannot catch incidents unfolding at machine speed.
Agents also lack the business context to tell which data they are meant to access and which data they can technically reach. Multi-agent workflows make that distinction harder to enforce. A compliance agent might ingest unmasked PII from another agent’s intermediate output, violating GDPR without either agent exceeding its stated permissions.
The OAP paper tested social engineering under permissive and restrictive pre-action policies. Attacks often succeeded under the permissive policy, while a similar group of attackers had a zero percent success rate under the restrictive OAP policy. That result backs the use of deterministic enforcement before the tool call. Pre-action authorization, sandboxed execution, and model-based screening are complementary controls.
For an analytical surface, approved metrics and typed interfaces make part of the policy physical, eliminating a class of runtime authorization decisions. The remaining requests still need enforcement. Agent identity must also stay distinct, with separate service accounts for each specialization, an enterprise agent registry, and clear steps for retiring agents. Offboarding an agent is an access-control obligation, just as employee offboarding is.

Why pre-calculated metrics are the right unit of agent-readable data
Security controls govern an agent’s access to data, but they do not establish what the data means. A metric contract closes that semantic gap. Without it, one engineer can calculate Q2 revenue using SUM(revenue) while another uses SUM(amount_captured), leaving divergent numbers unnoticed until an investor asks for audited figures. Agents querying those same tables cold can reproduce the drift at machine speed. A governed replica on its own cannot settle which number is right.
Pre-calculated metrics turn the business definitions people have agreed on into first-class objects. A semantic layer defines calculations such as MRR, LTV, and churn centrally, so a calculation change reaches every human and agent consumer immediately. Each metric contract includes its definition, source, freshness timestamp, and lineage. An agent receives a number with the context needed to interpret it without reconstructing its meaning from column names.
For Supabase-native teams, Postgres can remain the analytical home while governed Parquet datasets store pre-modeled metrics for querying through DuckDB. Agents query those datasets in place of production tables and get accurate context quickly and at low query cost. An agent checking MRR a hundred times a day reads a pre-computed result each time. The metric, rather than an improvised query, becomes the stable unit of consumption.
What observability on the analytical surface reveals that production monitoring misses
A healthy production database does not establish that an agent has received a fresh, correctly calculated metric. Production monitoring answers a different operational question. The Supabase Metrics API exposes CPU and memory utilization, disk I/O and WAL statistics, connection pool metrics, and query performance data. Those signals describe the production instance. Agents can consume stale or miscalculated numbers while those production indicators remain healthy.
The surface needs a freshness signal showing when each dataset was last calculated and whether its lag exceeds the threshold for the decision being made. It also needs query lineage recording which agent queried which metric, when, and with what result. That audit record makes decisions traceable and supports reversal. Drift alerts flag metric values outside their expected range before agents act, while replica-backed sources need replication-lag monitoring and alerts against acceptable thresholds.
Operational visibility needs to be established from the start. Just as latency dashboards guide application scaling, metric freshness lag and query audit completeness guide operation of an agent-readable surface. For Supabase-native teams scaling toward a million users, absorbing agent query load outside production also preserves compute headroom for transactions.
Building the single source of truth that agents and humans share
The analytical surface becomes a single source of truth only when people and agents obtain their numbers from the same governed definitions. ARR from billing, cash from the bank, and product usage from the analytics layer must reconcile to definitions shared by the executive dashboard and the agent workflow. Separate interfaces need not create separate calculations.
For a B2B SaaS startup, the practical starting point is five or fewer actionable metrics, including CAC, LTV, monthly churn, NRR, and gross margin. Each needs a precise definition before an analyst or agent queries it. The data dictionary is definitional before it is technical. Terms such as “Active User” and “Churn” need an agreed meaning and a single source of truth, because query infrastructure cannot resolve an unsettled business definition.
For founders and early teams without a dedicated data function, the surface encodes decisions a data team would otherwise make. It records what to measure, how to calculate it, and how fresh it needs to be. Those decisions become reusable. With the data layer decoupled from any single front end and accessible through MCP or an API, a Slack alert, a CEO dashboard, and an autonomous agent can consume the same governed dataset. Safe agent access then rests on the same data foundation that people share, with rules built into that foundation instead of a special permission for one more database consumer.


