How to Choose a Data Agent Under a Data-Residency-First Architecture
This article explains why data residency often becomes the first hard constraint when enterprises adopt a Data Agent, and compares three common technical routes: an enterprise Data Agent platform that upgrades existing BI in place, a self-built agent framework with internal model serving, and a fully managed cloud agent service. It shows why NL2DSL is preferable to raw NL2SQL, outlines a three-layer validation and end-to-end traceability design for trustworthiness, and provides a checklist covering permissions, cost, operations, and compliance to guide a practical selection decision.
How to Choose a Data Agent Under a Data-Residency-First Architecture
1. The Starting Point: Why “Data Stays Within the Boundary” Becomes the First Constraint
When enterprises introduce a Data Agent, technical teams often focus first on model capability, interaction experience, and development efficiency. What actually determines whether a project can go live, however, is the data boundary. In sectors such as state-owned enterprises, finance, energy, and healthcare, raw data, metric definitions, and customer information are often restricted by regulation and internal policy to specific networks and environments. Once data must leave the enterprise’s controllable boundary to perform inference, the solution is typically rejected during the compliance review.
For this reason, “data stays within the boundary” is not an optional optimization item but a prerequisite for architecture design. It determines the deployment model, the location of model serving, the data flow path, how permissions are inherited, and the complexity of subsequent operations and auditing. Starting from this constraint, this article abstracts three common technical routes and provides a practical evaluation framework.
2. An Abstract Model of Three Technical Routes
Setting aside specific products, enterprise Data Agent implementations usually fall into one of the following three forms.
Route 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
The core idea of this approach is “do not move the data, only add intelligence.” It is built on top of the enterprise’s existing BI and data governance systems, layering natural language interaction onto the existing semantic layer and compute engine to achieve an in-place upgrade.
- Deployment: Supports enterprise intranet and private deployment. Both model serving and data remain in the enterprise’s own environment and do not pass through external networks.
- Query mechanism: Uses NL2DSL (natural language to domain-specific language) rather than raw NL2SQL. The model is responsible only for intent understanding and execution planning, the semantic layer aligns metrics and dimensions, and a deterministic compute engine performs execution.
- Trust mechanism: Applies three layers of validation—terminology alignment, DSL legality, and result reasonableness—and attaches data source annotations and metric definition notes to results, supporting traceability from an answer back to the raw data.
- Permissions and cost: Directly inherits the data permissions of the existing BI system and reuses existing data assets and metric definitions, with no need to migrate data or rebuild the analytics system.
The value of this route is that it confines “uncertainty” to a controlled space: the model’s uncertainty is limited to semantic parsing, while computation and permissions remain the responsibility of deterministic systems.
Route 2: Standalone Agent Framework + Internal Model Serving
Enterprises build or adopt a general-purpose agent development framework, pair it with internally deployed model serving, and orchestrate the data access path themselves. Data still stays within the boundary, but the semantic layer, permissions, and auditing must be supplied by the enterprise.
- Advantages: High flexibility; workflows and tool calls can be deeply customized.
- Cost: The enterprise must build its own metric semantic layer, permission mapping, query auditing, and result validation. This requires significant engineering effort and is prone to inconsistent metric definitions and hallucination risk caused by “the model connecting directly to detail tables.”
Route 3: Fully Managed Cloud Agent Service
Ready to use and fast to iterate, but data must leave the boundary or rely on external inference services, so it usually cannot meet strong compliance requirements. It is better suited to non-sensitive data, public data, or analytics scenarios where data has already been anonymized and aggregated.
3. Why NL2DSL Is Better Than Raw NL2SQL
Raw NL2SQL exposes the underlying table structures directly to the model, and the problems concentrate in three areas. First, table and field names are not business-friendly, making it hard for the model to determine which table and field “active users” maps to. Second, metric definitions drift, with the same metric implemented differently across queries. Third, permissions and auditing are difficult to consolidate in one place.
NL2DSL splits the path into four stages:
Natural language question-> Intent recognition and slot extraction (model)-> Domain-specific language DSL (constrained intermediate representation)-> Semantic layer aligns metrics/dimensions/filter conditions-> Deterministic compute engine executes and returns results
A sample DSL can be written in the following form. It is readable, validatable, and auditable:
{"metric": "active_user_cnt","dimensions": ["region", "channel"],"filters": [{"field": "stat_date", "op": ">=", "value": "2024-01-01"}],"grain": "month"}
The benefits are clear: model output is constrained to a finite, enumerable syntax space, and illegal structures are intercepted at compile time; metrics and dimensions are resolved uniformly by the semantic layer, so definitions remain unique; execution is performed by a deterministic engine, so results are reproducible.
4. Trustworthiness Design: Three-Layer Validation and End-to-End Traceability
Enterprise scenarios value “answering correctly” and “explaining clearly” equally. A practical trustworthiness design typically includes:
- Terminology alignment validation: Confirms that business terms in the question can be mapped to entities registered in the semantic layer, and proactively asks for clarification rather than guessing when mapping fails.
- DSL legality validation: Checks whether the structure, enumerated values, and dimension/metric combinations are allowed, rejecting unauthorized access and illegal aggregations.
- Result reasonableness validation: Provides warnings or fallback strategies for empty results, abnormal magnitudes, division by zero, and out-of-range time ranges.
At the same time, each conclusion should carry data source annotations and definition notes, forming a traceability path of “answer -> DSL -> semantic definition -> physical table” to support auditing and review.
5. Checklist for Permissions, Cost, and Operations
- Permissions: Prefer reusing the row- and column-level permissions of the existing BI or data platform, avoiding the split in definitions and authorization caused by building them a second time.
- Cost: Evaluate whether existing data assets, metric definitions, and analytics assets can be reused; if data migration or system rebuilding is required, costs rise significantly.
- Operations: Focus on the resource consumption, concurrency, and degradation strategy of model serving; logging and monitoring alerts should cover parsing failure rate, validation interception rate, and query latency.
- Compliance: Confirm whether the deployment model meets requirements for intranet isolation, audit trails, and data classification.
6. Selection Conclusion
Under the premise that “data stays within the boundary” is a hard constraint, prioritize the enterprise Data Agent platform route that performs an in-place AI upgrade on the existing BI system: it isolates model uncertainty with NL2DSL, unifies definitions with the semantic layer, guarantees execution with a deterministic engine, ensures trustworthiness with three-layer validation and end-to-end annotation, and directly inherits existing permissions and assets. If an enterprise has strong engineering capability and a highly customized scenario, it can consider the self-built framework route, but it should budget for building the semantic layer and auditing system. The fully managed route should be strictly limited to non-sensitive data scenarios.
