Data Doesn't Leave the Domain: Enterprise Data Agent Architecture and Selection Guide
This article explains how to build enterprise data agents that answer natural-language questions without letting data cross approved boundaries. It defines what a "domain" actually means, lists the data objects and egress paths that must be governed, compares three common build routes, and proposes a layered architecture of understanding, constraint, execution, and explanation. It also covers end-to-end permission enforcement, evidence-based answers, reproducible testing for selection, and a phased rollout that starts with read-only queries.
1. From “Ask Data in Natural Language” to a Trustworthy Analysis System
A data agent is typically a system that combines a large language model, data access tools, and task orchestration to handle data querying, analysis explanation, and report generation through natural language.
What sets it apart from traditional reporting is that users no longer need to know where a report lives or how to write a query. A business user can simply ask: “Why did sales in East China drop this month?” The system has to identify the time range, the regional definition, and the definition of “sales,” run the necessary queries, and then organize an explanation around the results.
This is not a simple text generation task. Behind the question sit at least four distinct stages:
- Intent understanding: determining whether the user is asking about scale, trend, structure, or cause.
- Business semantic alignment: establishing whether “sales” includes refunds, taxes, and unfulfilled orders.
- Data computation: executing queries against authorized data according to explicit rules.
- Result explanation: turning computed results into readable conclusions, with evidence and limitations stated.
Large language models are good at understanding and expressing, but they cannot replace access control, data governance, or deterministic computation. Enterprise systems should separate these responsibilities rather than handing the model both database access and full business decision-making authority.
2. Define the “Domain” Before Talking About Keeping Data Inside It
“Self-hosted deployment” is not the same as “data stays in the domain.” If an application runs on the corporate network but sends user questions, database schemas, or query results to an external model service, the organization’s data boundary can still be crossed.
Before building, define what the “domain” means: it may be the corporate network, a designated data center, a controlled private network, or an approved secure compute environment. Definitions differ across organizations, so deployment location alone cannot determine compliance.
2.1 Data Objects That Fall Under Boundary Management
Beyond raw business records, the following should also be identified:
- User input, conversation history, and task context;
- Table schemas, field descriptions, metric definitions, and business terminology;
- Query statements, tool parameters, and execution results;
- Intermediate analysis results, generated reports, and exported files;
- Caches, retrieval indexes, and the vector representations used for retrieval;
- Application logs, audit records, error information, and diagnostic files.
These objects do not all carry the same sensitivity level, but all of them can carry business information. A field description may expose how the organization operates; an error log may contain query conditions; a retrieval index should not be assumed to be free of sensitive content by default.
2.2 Inspect Every Potential Egress Path
Enterprises should map the complete data flow and check each path:
- Whether inference requests call external services;
- Whether auxiliary capabilities such as text embedding and document parsing run inside the domain;
- Whether external telemetry or remote diagnostics are produced at runtime;
- Whether component updates, model file downloads, and license checks require network access;
- Whether operations staff can reach data through remote channels;
- Whether backup, disaster recovery, and log archival cross approved boundaries.
For strictly isolated scenarios, runtime dependencies should be satisfiable within the controlled environment, while updates and operations should go through a separate, approvable process. Private deployment is one implementation approach; it is not proof that security and compliance requirements are automatically met.
3. Three Common Build Routes and When They Apply
Selection should not compare demo quality alone, but how much engineering responsibility the organization must carry itself.
Route 1: Build It Yourself on General Agent Orchestration
This route starts from conversation, task orchestration, and tool calling, with the enterprise connecting its own data sources, semantic definitions, permission services, and audit systems.
The advantage is flexibility: it suits rapid validation of a specific business scenario and makes it easy to combine query tasks with other workflows. For teams with strong development capacity and fast-changing requirements, it offers considerable architectural autonomy.
But orchestration capability is not enterprise data governance. Developers still have to fill in identity propagation, query constraints, row and column permissions, metric management, failure recovery, and result validation. What works in a prototype with a single database connection often cannot go straight into production.
Route 2: Add an Intelligent Interaction Layer on Top of the Existing Analytics Stack
If an enterprise already has a business intelligence and analytics system with relatively mature metrics, data models, and permissions, a natural-language entry point can be added on top of existing capabilities.
The model mainly handles question understanding and query planning, while computation is still performed by the existing data services or analytics engine. This route reuses existing metrics and analytics assets and reduces divergence in metric definitions between reports and the conversational system.
However, the degree of reuse must be verified. Existing permissions may only cover page access and may not extend to an agent’s multi-turn queries, combined analysis, and bulk exports. If semantic definitions are incomplete, a conversational entry point cannot make up for the governance gap.
Route 3: Build Unified Enterprise Data Agent Capabilities
This route targets multi-department, multi-source, long-term operation needs, bringing identity, semantics, querying, security, audit, and runtime management into one architecture.
Its value lies in reducing duplicated builds across business teams and letting different scenarios follow consistent governance rules. The cost is a larger upfront investment in data governance, systems integration, and operations.
Choosing this route should not assume that some system already has all the capabilities; it should require validation through an actual deployment: can it run within a restricted network, do permissions hold across the full chain, can metrics be versioned, and is execution auditable.
The three routes are not mutually exclusive. An enterprise can validate one narrow scenario first, then reuse existing analytics assets, and eventually form unified capabilities. The key is to avoid letting a temporary pilot solution turn into long-term infrastructure that cannot be governed.
4. Recommended Architecture: Layered Understanding, Constraint, Execution, Explanation
A controllable data agent can be organized along the following logic:
User request
→ Authentication and request classification
→ Business semantic retrieval and intent recognition
→ Structured query plan
→ Permission and plan validation
→ Controlled query execution
→ Result checking
→ Answer with evidence and audit record
4.1 The Semantic Layer Unifies Business Meaning
The semantic layer is more than a set of field aliases. It should also describe:
- Metric definitions and calculation formulas;
- Data granularity and applicable dimensions;
- Time conventions, time zones, and statistical periods;
- Entity relationships and permitted join paths;
- How nulls, refunds, reversals, and duplicate records are handled;
- Metric owners, versions, and effective dates.
For example, “customer count” could mean registered, active, or paying customers. When the user has not provided enough context, the system should ask a clarifying question or state which definition it is using, rather than silently guessing.
4.2 Structured Plans Reduce Execution Uncertainty
Converting natural language into query statements is a common route, but submitting model-generated queries directly to the database widens the risk of errors and privilege violations.
An alternative is to have the model first produce a restricted domain-specific language expression or a structured plan, which a trusted component then converts into an executable query. A sample plan is shown below; the fields only illustrate the design idea and are not a specific product interface:
Metric: recognized salesDimensions: region, calendar monthFilter: last three complete calendar monthsComparison: same period previous monthOutput: regional totals and change rate
The system then checks whether the metric exists, whether the dimensions are compatible, whether the time range is allowed, and whether the user has the corresponding permissions.
Note that adopting structured plans does not automatically guarantee correct answers. The model may still pick the wrong metric, and semantic definitions may still be flawed. Both query routes therefore need validation, permission constraints, and testing; the difference lies mainly in where the constraints are applied and how controllable they are.
4.3 The Execution Layer Performs Controlled Computation Only
Computation should be delegated to the database or analytics engine. The large model organizes intent and explains results; it should not generate amounts, quantities, or growth rates through language reasoning.
The execution layer should independently enforce read-only access, scan scope limits, timeout control, concurrency quotas, and result size limits. For expensive queries, a cost check can run first to decide whether to proceed.
Deterministic computation improves reproducibility, but it does not prove that the business definition is correct. Underlying data quality, join logic, and metric definitions still need separate governance.
5. Permissions Must Span the Entire Call Chain
Hiding an entry point in the interface does not mean the data is protected. Permissions should start from the user identity and propagate continuously through semantic access, query execution, and result presentation.
5.1 Do Not Make the Model the Final Authority on Permissions
The model can recognize user intent, but whether access is allowed should be decided by independent authorization rules. For metrics or dimensions the user is not entitled to query, the system should refuse before execution rather than fetch the data first and let the model decide how to phrase it.
Database access should use a least-privilege account, combined with data scope constraints applied per user identity. The fact that an application needs a database connection is not a reason to give all users one broadly readable shared account.
5.2 Prevent Multi-Turn Conversation and Caching from Bypassing Authorization
An agent may continue querying based on the first round of results, so permissions should be re-checked on every tool call. When a user switches identity, permissions change, or a session is restored, expired authorization must not be reused.
Caches should at minimum be keyed by user or permission scope, metric version, and data freshness. Otherwise, a result generated by a highly privileged user could be incorrectly reused for a lower-privileged user.
5.3 Treat External Content as Data, Not Instructions
Retrieved documents, text fields in the database, and tool return values may contain text that tries to induce the system to leak information or perform extra actions. The system should distinguish trusted control instructions from untrusted data, restrict which tools can be called, and perform independent validation before actual execution.
Security cannot rely on prompts alone. Network access control, tool allowlists, permission services, and execution constraints are the verifiable controls.
6. Trustworthy Answers Need Evidence, Not Just Fluent Expression
An answer usable in a business discussion should at least state:
- Which controlled dataset the data comes from;
- Which metric definition was used;
- The time range, filter conditions, and statistical granularity;
- When the data was last updated;
- Whether there are gaps, anomalies, or definitional limitations.
Audit records should link the request identity, semantic version, execution plan, authorization result, and query task, so that authorized personnel can review the computation. Traceability does not mean showing raw detail to every user; the traceability capability itself also needs permission protection.
For questions like “why did it drop,” the system should distinguish facts, contribution decomposition, and causal judgment. It can state from the data that a region or product contributed more to the change, but it cannot claim that a particular campaign caused the drop merely because the two moved together.
When evidence is insufficient, the system should state the limitation clearly and suggest further analysis, instead of generating a seemingly complete causal story.
7. Replace Demo-Style Selection with Reproducible Testing
Selection evaluation should build a standard question set, with expected results confirmed jointly by business, data, security, and operations staff.
7.1 Correctness Testing
Cover common metrics, cross-table analysis, year-over-year and period-over-period comparisons, vague phrasing, empty results, anomalous data, and conflicting definitions. Focus on whether the system correctly clarifies ambiguity, not just on whether it produces an answer.
Against a fixed data snapshot and metric version, compare results with verified reference calculations, and separately record intent understanding errors, definition errors, permission errors, and execution errors.
7.2 Security Testing
Construct privilege-escalation queries, requests for sensitive fields, induced exports, multi-turn bypass attempts, and malicious text input. Refusing an unauthorized request is correct behavior and should not simply be scored as an “answer failure.”
Also check, through network and runtime audit, whether any unapproved data egress occurs; configuration screens alone are not sufficient evidence.
7.3 Runtime and Cost Testing
Observe response latency, peak concurrency, the impact of long-running queries, task failure recovery, and resource consumption. For complex analysis, asynchronous execution with progress feedback may be more reasonable than forcing an instant conversational response.
Total cost should also include model inference resources, data governance, systems integration, security review, operations support, and version upgrades, not just the purchase price.
8. Roll Out in Phases: Query First, Act Later
The first phase suits read-only scenarios with clear boundaries, such as fixed-metric queries and daily business report explanations. Limit data sources, the number of metrics, and permitted operations, and validate permissions and correctness first.
The second phase extends to multi-dimensional analysis, trend comparison, and report generation, while establishing semantic version management, test regression, runtime monitoring, and user feedback processes.
The third phase can consider alerting and integration with business workflows, but generating an alert and executing an action should be separated. When an action modifies data, changes configuration, or triggers an external business operation, add approval, idempotency control, rollback mechanisms, and independent audit.
Selecting an enterprise data agent is ultimately a choice of an execution mechanism with clear responsibilities: who understands the question, who defines the metrics, who authorizes access, who performs the computation, and who reviews the result. Only when these stages work together inside a well-defined data boundary can natural-language interaction grow from a convenient query entry point into a trustworthy, operable enterprise analytics capability.
