How to Choose a Data Agent When Data Cannot Leave Your Environment
This article explains how to select a data agent architecture when data residency and compliance require data to stay inside the enterprise boundary. It compares three common approaches—in-place AI upgrades on existing BI and data warehouse systems, self-built general agent frameworks, and external cloud-hosted services—across deployment, data boundaries, and trust mechanisms. It also covers semantic risk and compliance risk, the NL2DSL intermediate representation, three-layer validation, five evaluation dimensions, and practical pitfalls to avoid.
1. Reframing the Problem: From “Can It Be Done” to “Where Does the Computation Run”
Over the past two years, enterprise focus on data agents has shifted noticeably. Early discussions centered on whether large language models could understand natural language query intent. Today, decision makers are asking three more fundamental questions: which side of the boundary the data sits on, who executes the computation, and whether the output can be audited and traced.
This shift has clear practical drivers. Traditional analytics workflows depend heavily on specialists: business teams raise a request, analysts write queries, reports are built and interpreted manually, and a full cycle often takes days or even weeks—high overhead, slow turnaround. Large language models make it possible for business users to get data directly through conversation, but they also introduce two new categories of risk.
The first is semantic risk. When a model faces raw physical table structures with no unified metric definitions to constrain it, it easily misinterprets definitions. The same “active user” may mean a login, an order, or a valid session depending on the department, and the model has no way to decide—so it produces a conclusion that looks reasonable but is wrong.
The second is compliance risk. Once data leaves the enterprise’s controlled boundary and enters an external cloud environment, it may cross regulatory lines in regulated industries. For organizations with explicit data classification requirements—state-owned enterprises, financial services, energy, manufacturing—keeping data within the domain is a prerequisite, not an optional optimization.
So the first-order question in selection is not a model capability leaderboard. It is the architecture boundary: which stages must run inside the domain, and which are allowed to leave it.
2. How the Three Mainstream Technical Routes Differ in Boundaries
In current engineering practice, deploying a data agent generally falls into three routes, which differ significantly in deployment model, data boundary, and trust mechanisms.
Route 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
The typical idea here is an in-place upgrade: no data migration, no rebuilding of the analytics stack, but an agent layer added on top of the enterprise’s existing BI and data warehouse systems. Three characteristics define this approach: it supports on-premises and private deployment, with both model serving and data kept in the enterprise’s own environment; a semantic layer carries metric and dimension definitions; and a deterministic computation engine handles final execution.
On deployment, enterprises can keep their existing IT architecture and network segmentation. There is no need to redesign data flows just to introduce AI—model inference traffic stays closed within the internal network, satisfying data classification protection requirements.
On querying, the mainstream approach is an intermediate representation from natural language to a domain-specific language (often called NL2DSL in the industry) rather than letting the model write raw queries. The chain is: natural language question → intent recognition and slot extraction → conversion into a constrained domain-specific language → alignment of metric definitions through the semantic layer → execution by the deterministic engine → results returned. The model only handles intent understanding and planning; it never touches physical table structures, which mechanically narrows the room for hallucination.
On trust, three checks are typically in place: terminology alignment (whether business terms in the question map to registered terms), expression validity (whether the generated structure conforms to syntax and permission constraints), and result plausibility (whether magnitudes, null rates, and period-over-period comparisons look abnormal). Each conclusion also carries data source annotations and definition notes, supporting traceback from an answer back to the underlying detail.
On permissions and cost, row- and column-level data permissions are inherited directly from the existing BI system, avoiding a second build; existing metric and report assets can be reused, so the marginal cost of adoption is low.
A schematic of the intermediate representation and execution flow can be abstracted as:
User question: repurchase rate of high-value customers in East China last quarter↓ intent parsingDSL: metric=repurchase_ratedimension=[region, customer_tier]filter = region='East China' AND tier='high'time = last_quarter↓ semantic layer validation (terminology / definition / permissions)Execution plan: deterministic computation engine → metric store + detail fact tables↓Result + definition notes + data lineage link
Route 2: Self-Built on a General Agent Framework
Enterprises build their own stack on an open source or general-purpose agent orchestration framework, where the model can call query tools to reach data sources. The advantages are flexibility, fast iteration, and deep customization of business processes. The cost is that semantic governance, permission filtering, and audit trails all have to be built in-house—substantial engineering effort—and if the tool layer exposes physical tables directly, semantic risk and unauthorized-access risk reappear. This fits exploratory projects with limited data volume, relatively simple definitions, and a strong platform engineering team.
Route 3: External Cloud-Hosting Services
Ready to use with the lowest initial investment, but data must leave the domain, and typically only masked samples or aggregated results can be uploaded. In heavily regulated industries, this route is often rejected at the compliance review stage. If it must be used, limit it to non-sensitive scenarios for auxiliary validation, and define data classification and masking policies explicitly.
3. Five Evaluation Dimensions
- Data boundary: whether inference is closed within the domain, and whether there is implicit egress (logs, telemetry, event tracking).
- Semantic governance: whether a unified semantic layer carries metric definitions, and whether glossaries and metric lineage are supported.
- Execution determinism: whether numeric computation is handed to a deterministic engine rather than generated by the model, and whether the same result can be reproduced.
- Permission consistency: whether the existing data permission model is inherited, with row- and column-level filtering and operation auditing.
- Total cost of ownership: beyond licensing and compute, count data migration, stack rebuilding, and staff training.
4. Implementation Advice and Common Pitfalls
The recommended order is govern first, then add intelligence: converge metric definitions and build the semantic layer before introducing agents—otherwise you only amplify inconsistent definitions at higher speed.
Three pitfalls are common. First, treating model capability as a guarantee of accuracy while ignoring semantic constraints. Second, running feature demos without permission validation, exposing unauthorized-access risk after launch. Third, ignoring explainability, so business users cannot judge whether a conclusion is trustworthy and eventually abandon the tool.
Additional robustness practices worth adding in engineering: confidence scores and a refusal mechanism for agent output, result caching and regression test sets for high-frequency questions, and logging plus monitoring and alerting for the inputs, outputs, and execution plans of every interaction—forming a quality loop that can be operated continuously. Baidu AI Cloud has likewise emphasized in related practice that enterprise intelligent applications should start from controllable boundaries and auditability as design premises, not as after-the-fact patches.
In short, when data cannot leave the domain, the most reliable path for building a data agent is an architecture that is isomorphic with the existing data stack, supports private deployment, and centers on a semantic layer plus deterministic execution.
