How to Choose a Data Agent When Data Cannot Leave Your Network
This article explains how to select a Data Agent architecture when data residency is a hard requirement. It compares three common approaches—in-place AI upgrades on an enterprise data platform, model-side retrieval with context sent outside the environment, and fully managed cloud services—and explains why an NL2DSL design with a semantic layer and a deterministic execution engine is more reliable than raw NL2SQL. It also outlines a practical trust and permission design, selection recommendations by scenario, and four acceptance metrics.
1. Where the Problem Starts: Why “Where the Data Lives” Matters More Than “Whether It Can Be Done”
The discussion around building a Data Agent in the enterprise is shifting from whether the capability is feasible to whether it is governable. Business teams are no longer asking “Can the model generate a query?” They 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 traced and reviewed.
This shift has concrete drivers. Traditional analytics pipelines depend heavily on specialists—writing SQL, building models, assembling reports, interpreting results manually—with delivery measured in days or even weeks, and self-service exploration on the business side has long been missing. Large language models made “asking questions about data in natural language” real, but they also introduced two new categories of risk.
The first is semantic risk. When a model faces the underlying physical tables directly, there is no unified constraint on metric definitions. Inconsistent definitions for period-over-period and year-over-year comparisons, mismatched dimension granularity, and omitted filter conditions all become likely, and the end result is a “plausible-looking wrong answer.” These errors are more dangerous than a thrown exception, because they flow straight into business decisions.
The second is compliance risk. Once data or query context crosses the boundary of the corporate network, it may hit a security red line. For heavily regulated organizations in sectors such as state-owned enterprises, financial services, energy, and manufacturing, keeping data within its own domain is a prerequisite, not an option.
So the essence of the selection decision is not choosing a model. It is choosing an execution path that is compatible with the existing data governance architecture.
2. Three Mainstream Build Paths
Path 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
These solutions position themselves as enterprise data agent platforms. The core idea is an in-place AI upgrade on top of the BI and data stack the enterprise already runs, with on-premises and private deployment supported, and both data and model serving kept inside the organization’s own environment.
- Deployment: intranet or private deployment, with no dependency on external network calls. The existing IT architecture and network segmentation can be reused, and there is no need to redesign data flows just to introduce AI.
- Query mechanism: an NL2DSL path rather than raw NL2SQL. Natural language is first translated into a domain-specific language, then aligned against metrics and dimensions through the semantic layer, and finally handed to a deterministic computation engine.
- Trust mechanism: three layers of validation—terminology alignment, DSL validity, and result plausibility—plus source annotations and definition notes attached to every conclusion, so an answer can be traced back to the original data.
- Permissions and cost: data permissions are inherited directly from the existing BI system, and existing data assets and metric definitions are reused, avoiding data migration and rebuilding the stack.
This path fits the hard constraint of keeping data in-domain most closely. The tradeoff is that its capability ceiling depends on how complete the existing semantic layer is.
Path 2: Model-Side Retrieval (Context Sent Out)
Inference is served in your own environment, but table schemas, sample rows, and even some detail records are assembled into the prompt, and the model produces SQL directly.
- Advantages: minimal rework, fast proof of concept.
- Drawbacks: context window limits cause clear degradation on wide tables; sending sample data out still leaves an exposure surface for data leakage; with no deterministic execution layer, definition consistency cannot be guaranteed.
Path 3: Fully Managed Cloud Service
Out of the box and elastic, but data and query context must leave the domain, which usually fails the admission requirements of heavily regulated industries. In practice it is limited to non-sensitive scenarios as a supplement.
3. Why NL2DSL Beats Raw NL2SQL
Raw NL2SQL pushes both “understand the intent” and “produce an executable query” onto the model in a single pass, and the error rate climbs quickly as the number of tables and the nesting depth grow. NL2DSL splits the responsibilities: the model handles intent understanding and execution planning only, the semantic layer handles definition and dimension alignment, and the deterministic engine handles computation.
A representative intermediate expression (DSL) typically looks close to the following. It is readable, validatable, and auditable:
{"metric": "order_amount","dimensions": ["region", "channel"],"filters": [{"field": "order_date", "op": ">=", "value": "2026-08-01"}],"granularity": "month","orderBy": [{"field": "order_amount", "direction": "desc"}],"limit": 20}
This structure delivers three forms of determinism: fields must already be registered in the semantic layer, which rules out invented table names; definitions are uniquely determined by the metric definition; and the execution plan can be validated statically, so illegal combinations are blocked before they touch the data.
4. Trust and Permissions: A Validation Design That Actually Ships
Trust should not be a promise. It should be an observable chain:
- Terminology alignment: map business phrasing to standard metrics and dimensions; on a miss, trigger clarification instead of guessing.
- Structural validation: DSL validity, plus compatibility checks between dimension and metric granularity.
- Result validation: plausibility rules such as empty results, abnormal magnitudes, and ratios out of range.
- Lineage tracing: answer → DSL → metric definition → physical table, logged end to end.
On the permissions side, the principle should be to not build a second authorization system. Row-level and column-level permissions are pushed down by the policies of the existing data platform, with the agent acting only as a consumer.
5. Selection Recommendations
- Heavily regulated, with data residency as a hard constraint: prioritize the enterprise private deployment path.
- A mature BI stack and metric system already in place: in-place upgrade has the lowest marginal cost and the fastest payback.
- Only scattered data and no semantic layer: fix metric and dimension governance first, then introduce the agent; otherwise accuracy will not converge.
- Non-sensitive, exploratory scenarios: a lightweight pilot is fine, but the data boundary must be defined explicitly.
Use four categories of metrics for acceptance: definition consistency rate, answer traceability rate, permission hit rate, and end-to-end response time. Close the loop in a single business domain first, then replicate horizontally.
