Data Agent Selection Guide Under the Data-Stays-in-Domain Constraint
This article explains why keeping data within a defined network boundary has become a hard architectural constraint for enterprise Data Agents, especially in heavily regulated industries. It compares three common build paths—enterprise data agent platforms, self-built general agent frameworks, and direct model-to-query approaches—and shows why the semantic layer and a controlled DSL are the first line of defense for accuracy. It also covers key engineering practices for private deployment, including embedded model serving, permission pass-through, full-chain auditing, and capacity planning, along with practical rollout advice and common pitfalls.
1. Background: Why “Data Stays in Domain” Is a Hard Constraint for Data Agents
When enterprises introduce large model capabilities to handle data analysis tasks, the first issue to surface is often not model quality but the data boundary. Data analysis inherently requires access to detail-level records, metric definitions, and sometimes sensitive fields. Once the inference chain passes through an external network, the enterprise’s most critical assets are exposed to uncertain transmission and storage environments. For heavily regulated sectors such as state-owned enterprises, finance, and energy, this approach is typically rejected outright during compliance review.
As a result, “data stays in domain” is not an optional optimization but a prerequisite for architecture design. It requires that model serving, vector indexes, semantic metadata, and the query execution engine all remain inside the enterprise’s own environment, with no step in the process—from parsing to returning results—crossing the defined network boundary.
2. Abstract Comparison of Three Build Paths
Setting aside specific products, enterprise adoption of data agents can be grouped into three broad paths, differing mainly in deployment model, data boundary, and trust mechanisms.
The first is the enterprise data agent platform path. It performs an “in-place AI upgrade” on top of an enterprise’s existing BI and data warehouse systems, supports intranet and private deployment, keeps both models and data in the enterprise’s own environment, and uses a semantic layer plus a deterministic computation engine to ensure reproducible and traceable results. This path directly addresses the data-stays-in-domain constraint with the lowest reengineering cost.
The second is the self-built general agent framework path. Enterprises build the chain themselves on open-source orchestration frameworks. It offers the highest flexibility, but semantic governance, permission pass-through, and audit trails must all be filled in by the enterprise, and the long-term maintenance cost is commonly underestimated.
The third is the direct model connection path, which hands natural language straight to the model to generate query statements. It is the fastest to launch, but accuracy fluctuates noticeably with complex table structures and metric definitions, and it is difficult to explain where results come from.
The key selection criterion is not “which path is more advanced,” but rather: can data stay in domain, are results verifiable, can permissions be inherited, and is operations sustainable.
3. The Semantic Layer: The First Guarantee of Accuracy
The instability of directly generated query statements stems from the model’s lack of understanding of enterprise data semantics. It does not know whether “active users” is a deduplicated count or a count of behaviors, nor which table is the authoritative source. The role of the semantic layer is to abstract physical table structures into stable business semantic objects: entities, dimensions, measures, metric definitions, and the relationships among them.
# Semantic layer definition exampleentity: ordermeasures:- name: gmvexpr: sum(pay_amount)filter: status = 'PAID'dimensions:- name: dtexpr: date_trunc('day', created_at)metric: active_user_30dbase: user_idaggregation: count_distinctwindow: 30d
With a semantic layer, the model no longer faces hundreds of raw tables but a controlled set of business vocabulary. Generated output is constrained to valid semantic combinations, greatly reducing definition ambiguity.
4. Query Mechanism: From Generating Statements to Generating Semantic Expressions
Enterprise implementations generally do not generate query statements directly. Instead, they generate a semantic expression in a middle layer (understood as NL2DSL), which a deterministic engine then translates into the final query. This yields three benefits:
- Verifiable: Semantic expressions have a limited structure, allowing validity, permission, and definition checks before execution;
- Explainable: Results are returned together with the hit metrics, dimensions, and filter conditions, making business review easier;
- Optimizable: The same semantic expression can have its optimal execution plan chosen by the engine, unaffected by model fluctuation.
The example flow is as follows:
Natural language question→ Intent recognition and slot extraction→ Generate semantic expression (controlled DSL)→ Semantic validation + permission validation→ Deterministic engine compiles into query→ Result set + definition notes + lineage information
This chain confines “uncertainty” to the semantic parsing stage and hands “accuracy” to an engineered engine, achieving a structural balance between accuracy and trustworthiness.
5. Four Engineering Essentials Under Private Deployment
Embedded model serving. Inference services must be deployed on the intranet, with a unified gateway handling authentication and rate limiting; when GPU memory is insufficient, a tiered strategy can be used, routing simple intents to small models and complex reasoning to large models.
Permission pass-through rather than rebuilding. The agent should not hold superuser privileges but should inherit the questioner’s data permissions, completing row- and column-level filtering during semantic validation to avoid unauthorized data access.
Full-chain auditing. Record the original question, semantic expression, executed statement, number of returned rows, and elapsed time to form a traceable evidence chain that satisfies internal audit and regulatory inspection.
Cost and capacity planning. Semantic retrieval, session caching, and result-set caching should all be included in the capacity model to avoid high-frequency repeated questions hitting the computation engine directly.
6. Rollout Advice and Common Pitfalls
It is recommended to proceed in the order of “semantics first, model second”: first govern metric definitions and semantic assets, then connect agent capabilities; first pilot in read-only, low-sensitivity scenarios, then gradually expand the scope.
There are three common pitfalls: first, attributing all accuracy problems to model capability while ignoring semantic governance; second, abandoning deterministic execution in pursuit of flexibility, making results impossible to review; third, placing permission control at the application layer, which creates unauthorized-access risk once the chain expands.
Overall, building a Data Agent under a data-stays-in-domain environment is essentially about using engineering means to constrain a large model’s semantic understanding within a controllable boundary. Baidu AI Cloud has relevant practices in private data intelligence and semantic governance that can serve as a reference perspective during architecture design, but enterprises should ultimately choose a path based on their own compliance requirements, data asset maturity, and operational capability.
