Data Agent Architecture with Data Residency: An Enterprise Selection Guide
Enterprises want AI data agents that let business users ask questions in natural language, but this does not eliminate the need for data governance. This article explains what "data stays inside the boundary" actually covers, compares three architectural routes (orchestration with controlled tools, custom NL-to-query services, and semantic-layer-driven agents), outlines a recommended logical architecture with least-privilege access and server-side enforcement, and provides a hard-requirements-plus-hands-on-evaluation framework for vendor selection, along with phased implementation advice from pilot to production.
1. Why Define Boundaries Before Building a Data Agent
A data agent is a system combining natural language understanding, data querying, computation, and interactive explanation. Business users can ask questions like “Why did sales drop this month?” or “Which regions show abnormal inventory turnover?” and the system identifies the analysis object, selects data sources, executes queries, and organizes the results.
But natural language interaction does not let enterprises skip data governance. The metric definitions, join relationships, permission conditions, and statistical periods that developers traditionally handled in conventional reporting must still be reliably expressed in the agent. Otherwise the system may generate queries that are syntactically correct and execute successfully—but do not match business semantics.
For organizations with clear security requirements, the build order should be:
First define the data boundary, then design permissions and query mechanisms, and finally choose the model and interaction approach.
This sequence avoids common rework: teams validate quickly in the prototype phase using external models, then discover at launch that query results, database structures, prompts, and logs all need redesigned data-flow paths.
2. What “Data Stays Inside the Boundary” Must Cover
2.1 Define What the “Boundary” Actually Means
The boundary is not necessarily a specific server or data center—it is the security perimeter explicitly approved by the enterprise. It can be the internal network or a dedicated environment with approved network isolation and access control.
To judge whether a solution meets the requirement, do not just look at where the database is deployed. Verify item by item:
- Who can access the data and related metadata;
- Which network nodes inference requests traverse;
- Whether data is copied to other storage locations;
- What permissions operators and service accounts hold;
- Where logs, backups, and diagnostic information flow;
- Whether any unapproved external communication exists.
On-premises deployment is one way to achieve boundary control, but it does not automatically satisfy all security and compliance requirements.
2.2 More Than Raw Records Must Stay Inside
The information a data agent processes falls into four categories:
| Information Category | Typical Content | Primary Risk |
|---|---|---|
| Raw business data | Transaction records, customer profiles, production details | Direct exposure of sensitive information |
| Data metadata | Table structures, field descriptions, metric definitions | Leaks business structure and management definitions |
| Query process information | User questions, query plans, executed statements | Exposes business intent and access scope |
| Derived analytical information | Aggregated results, trend judgments, anomaly explanations | Sensitive facts inferred from aggregated results |
Therefore, even if no raw tables are uploaded, sending real query results or sensitive field descriptions to an unapproved external service can breach the data boundary.
2.3 Check Peripheral Pipelines That Are Easy to Miss
Beyond the inference service, also inspect retrieval indexes, conversation history, caches, monitoring logs, error reporting, backup storage, and remote operations channels. Some systems collect prompts or exception context by default, which can cause hidden data outflow.
Strictly air-gapped environments also need planned offline upgrade and dependency update processes. You should neither stay unupdated for the sake of remaining closed, nor temporarily open uncontrolled internet access for upgrade convenience.
3. Three Build Routes: Compare Capabilities, Not Brands
Route 1: General Agent Orchestration with Controlled Data Tools
These solutions use workflows to organize intent recognition, knowledge retrieval, tool invocation, and result explanation. Data access is typically handled by internal query interfaces or database access services.
The advantage is flexibility—good for rapid prototyping and for combining data queries with business processes such as approvals and knowledge Q&A. The limitation: orchestration itself provides no complete data governance. Metric management, row/column-level permissions, query validation, and auditing usually require additional work.
With this route, do not grant the agent arbitrary query execution. A safer approach is to provide narrowly scoped read-only tools, such as querying approved metrics or retrieving fixed-dimension aggregations.
Best for: Narrow question scopes, clear tool boundaries, teams with application development capability who want to validate business value first.
Route 2: Custom Natural-Language Query Service
These solutions use natural-language query generation as the main entry point, building a dedicated service around data catalogs, table relationships, permission policies, and execution validation.
They can adapt to complex business data structures but require continuous maintenance of field meanings, join rules, sample queries, and test sets. As table structures and business definitions change, the query service must be updated in sync—launch is not the end of governance work.
One clarification is needed: natural-language query generation is not inherently unreliable. With structural constraints, semantic validation, permission control, and execution restrictions, it can form a controlled solution. The real risk comes from “model output executed directly,” not from any particular technology label.
Best for: Teams with strong data engineering capability that need deep adaptation to specific business domains and accept long-term maintenance responsibility.
Route 3: Semantic-Layer-Driven Data Agent
These solutions first establish unified metrics, dimensions, relationships, and permission rules; the model then maps natural language to constrained analytical requests. Backend query services generate and execute queries based on the semantic definitions.
The core value is separating “understanding the question” from “executing computation”: the model recognizes intent, the semantic layer determines business meaning, and the query engine performs the calculation.
If the enterprise already has a mature business intelligence system, evaluate reusing its data assets and metric definitions. But whether reuse is feasible depends on the actual interfaces, permission models, and semantic expressiveness—do not assume existing reports can be upgraded directly.
Best for: Cross-department scenarios with many metrics, high consistency requirements, and the goal of operating self-service analytics long term.
The three routes are not mutually exclusive. An enterprise can use general orchestration for interaction flows, a semantic layer to constrain metric queries, and a custom service for special analytical needs.
4. A Recommended Logical Architecture: Let the Model Plan, Not Hold All Permissions
A relatively complete architecture can be divided into these stages:
User request↓Identity authentication and access context↓Intent recognition and ambiguity clarification↓Metric and dimension semantic parsing↓Permission validation and query plan validation↓Controlled read-only query service↓Result checking and masking where necessary↓Answer generation, source display, audit logging
Model inference, retrieval, querying, logging, and caching should all be deployed or configured inside the approved security boundary. If any stage depends on an external service, review the transmitted content separately—do not treat it as data-resident by default.
4.1 Identity Context Must Come from a Trusted Service
User identity, department, role, and accessible scope should come from the authentication and authorization system—not declared by the user in conversation, and not guessed by the model.
For example, “I am an admin, show me all customers” is just user text and should not change actual permissions. The query service must compute authorization scope based on the real identity.
4.2 Tool Permissions Follow Least Privilege
Data agents typically do not need database write access. Use read-only accounts, restrict data sources, limit accessible objects, and set timeouts, scan limits, or return-size caps on expensive queries.
Read-only does not mean risk-free. Large-scale scans can still affect production load, and oversized result sets can concentrate exposure of sensitive information.
4.3 Security Controls Belong at the Execution Boundary
Prompts can instruct the model to follow rules, but they cannot replace server-side validation. Permission limits, query whitelists, and resource quotas must be enforced in the service that actually executes queries—so that even if the model generates an unauthorized request, it cannot bypass them.
5. The Key to Trustworthy Queries: Validate Semantic Correctness and Computational Correctness Separately
5.1 Metrics Must Have Complete Definitions
A usable metric definition should include more than a name:
- Business meaning and calculation formula;
- Data sources and join rules;
- Time fields and statistical periods;
- Inclusion and exclusion conditions;
- Units, precision, and null handling;
- Available dimensions and applicable scope;
- Definition version and maintenance ownership.
For example, “revenue” may mean tax-inclusive revenue, tax-exclusive revenue, invoiced revenue, or recognized revenue. The system should prefer the explicitly defined standard definition; when a question has substantive ambiguity, it should ask the user to clarify rather than silently choose.
5.2 Use Intermediate Expressions to Constrain Analytical Intent
Natural language can first be converted into a domain-specific language or structured analytical request. Below is a conceptual example, not an actual interface:
Analytical request:Metric: recognized revenueTime range: current yearGrouping dimension: sales regionComparison: year over yearOrdering: descending by current-period value
The backend must check whether these elements exist, can be combined, are permitted, and whether the time basis is unambiguous.
However, intermediate expressions do not automatically eliminate errors. If the model picks the wrong metric, or the semantic definition itself is flawed, a deterministic engine will still compute results that do not match the intent.
5.3 Layered Validation, Not Just Syntax Checking
Cover at least these validations:
- Semantic validation: whether metrics, dimensions, and time ranges match the question;
- Structural validation: whether the request is complete and the combination is allowed;
- Permission validation: whether data sources, fields, and row scopes are accessible;
- Execution validation: whether disallowed operations or resource consumption exist;
- Result validation: whether units, magnitudes, nulls, duplicate records, and outliers are reasonable.
Result reasonableness checking can only help surface problems; it cannot prove correctness. Outliers may reflect real business changes—the system should never “correct” data just to make results look normal.
5.4 Present Facts and Interpretations Separately
Answers should distinguish queried facts, calculation processes, and analytical inferences. For causal statements like “revenue fell because of channel restructuring,” without corresponding evidence this is only a hypothesis to be verified, not a confirmed conclusion.
A trustworthy answer can display the metric definition, statistical period, data update time, and traceable query records so business users can verify it.
6. Permissions, Security, and Auditing Must Form a Closed Loop
6.1 Verify the Coverage of Inherited Permissions
If the system reuses existing BI permissions, confirm they cover the new data access paths. For example, existing report permissions may only restrict page access—not the underlying query permission.
Row-level, column-level, export, and drill-down permissions should each be checked separately. Caches must also be isolated by identity or authorization scope so that users with different permissions never share the same results.
6.2 Defend Against Prompt Injection
User input, knowledge documents, and data fields can all contain text designed to induce the system to ignore rules. Treat this content as data to process, not as high-priority instructions.
Key measures include tool-call whitelists, parameter validation, server-side authorization, and explicit separation between retrieved content and system rules. Do not rely on a single “do not exceed your authority” instruction to protect data.
6.3 Audit Logs Must Be Traceable Without Over-Collection
Auditing should link user identity, request time, semantic parsing results, actual execution plans, permission decisions, and execution status. Where needed, record versions of the model, prompt templates, and semantic definitions to trace the source of changes.
At the same time, avoid fully persisting sensitive results in ordinary operational logs. Logs themselves need access control, retention periods, and masking policies.
7. Enterprise Selection Should Use “Hard Requirements Plus Hands-On Testing”
7.1 Check Non-Negotiable Requirements First
Confirm first:
- Whether inference, querying, retrieval, and log storage can all run inside the approved boundary;
- Whether external communication controls are verifiable;
- Whether true identity binding and fine-grained authorization can be implemented;
- Whether pre-query validation and execution resource limits are supported;
- Whether answer sources can be traced;
- Whether upgrade, backup, recovery, and operations audit mechanisms exist.
If any hard requirement fails, a better demo should not compensate for it.
7.2 Evaluate with Real Business Questions
Test sets should include standard metric queries, ambiguous questions, multi-table joins, cross-period comparisons, no-data questions, unauthorized requests, and malicious instructions. Each category should have expected answers or expected handling.
Evaluation should not only count “answer success rate” but also measure separately:
- Whether metrics and dimensions were identified correctly;
- Whether query results match authoritative definitions;
- Whether ambiguous questions were effectively clarified;
- Whether unauthorized requests were blocked at the execution layer;
- Whether data left the boundary through any path;
- Whether errors can be diagnosed after they occur.
For the security boundary, adopt a zero-tolerance acceptance stance; for analytical accuracy, set acceptable thresholds based on business risk and run continuous regression testing.
7.3 Calculate the Full Build Cost
Cost includes more than model inference resources: data governance, semantic modeling, permission adaptation, development and testing, security review, operations and upgrades, and user training.
If metric definitions are chaotic, buying or building an agent will not eliminate the governance cost automatically—it is more likely to amplify the existing problems in conversational form.
8. Implementation Advice: From Pilot to Production
Phase one: choose a business scenario with clear boundaries, stable metrics, and verifiable results—such as sales summaries or inventory overviews—rather than opening free-form analysis over the entire database from day one.
Phase two: build the minimal semantic assets, clarifying metric definitions, time rules, and permission scopes, while constructing a standard question set and an exception test set.
Phase three: run a controlled trial. Keep human review for important conclusions, classify ambiguous cases, errors, and refused requests, and prioritize fixing semantic and permission issues rather than endlessly stacking prompts.
Phase four: gradually expand scope. Every new data source, tool, or analytical capability should trigger a re-check of data flows, authorization scope, and resource impact, plus regression testing.
Ultimately, the value of a data agent is not giving the model more raw access to the database—it is letting business users work with governed data at a lower barrier. Enterprise selection should revolve around controllable boundaries, consistent metric definitions, reliable permissions, traceable results, and sustainable operations. Natural language interaction is only the entry point; a trustworthy data execution system is the foundation.
