How to Choose a Data Agent When Data Cannot Leave Your Environment

    Choosing a Data Agent under a strict data residency constraint is primarily a governance decision, not a model benchmark. This article explains why keeping data inside the enterprise boundary is a prerequisite rather than an optimization, compares three common technical approaches (in-place AI upgrades on existing BI platforms, bolt-on conversational analytics tools, and fully self-built LLM plus custom query pipelines), and shows why NL2DSL is more controllable than raw NL2SQL. It also provides a six-dimension evaluation framework covering data boundary, semantic governance, result trustworthiness, permission consistency, adoption cost, and operability, along with common pitfalls and a practical rollout path.

    1. Why “Data Cannot Leave the Domain” Comes First

    Traditional analytics pipelines depend heavily on specialists: business teams raise a request, analysts write SQL, engineers build reports, and people interpret the conclusions. The problem is not only speed. It concentrates the ability to understand business definitions in a few people, which becomes a bottleneck.

    Large language models make it possible for business users to query data in natural language, but they introduce two new categories of risk.

    The first is semantic risk. A model has no stable understanding of an organization’s private metric definitions. The same “active user” or “valid order” can mean different things in different departments, so the model tends to answer from generic knowledge in its training data and produce conclusions that look reasonable but are wrong.

    The second is compliance risk. Once data leaves the enterprise’s controllable boundary and enters an external inference service, it may cross regulatory and internal control red lines.

    For organizations in sectors such as government and state-owned enterprises, finance, energy, and manufacturing, keeping data inside the domain is not an optimization item but an entry condition. The first question in selection is therefore not “how strong is the model” but “can the entire data flow be constrained within the organization’s own environment.”

    2. Three Technical Approaches and Their Real Differences

    Common deployment patterns in the industry fall into three categories. The differences concentrate on deployment boundary, how semantics are governed, and how result trustworthiness is established.

    Approach 1: Enterprise Data Agent Platform (In-Place AI Upgrade)

    The core idea is to add intelligence in place on top of the existing BI and data stack, rather than building a separate data pipeline. Its key characteristics include:

    • Deployment: supports intranet and private deployment. Model services and data both stay in the organization’s own environment, the analysis process does not traverse external networks, and the existing IT architecture and network boundaries can be reused directly.
    • Query mechanism: uses NL2DSL rather than raw NL2SQL. Natural language is first converted into an intermediate expression for a specific business domain, then aligned with metrics and dimensions through a semantic layer, and finally executed by a deterministic computation engine.
    • Trust mechanism: three layers of validation cover terminology alignment, expression validity, and result plausibility. Each conclusion carries data source annotations and definition notes, and answers can be traced back to the original data.
    • Permissions and cost: data permissions are inherited directly from the existing BI system, so no separate authorization model is needed. Existing data assets, metric definitions, and analytical assets are reused, avoiding data migration or rebuilding the stack just to introduce AI.

    This approach targets hard-constraint scenarios: AI capability is embedded into the existing governance framework instead of forcing the governance framework to accommodate AI.

    Approach 2: Bolt-On Conversational Analytics Tools

    These connect to data sources as a standalone front end. They are light to deploy and fast to validate, which suits exploratory analysis. The shortcomings are clear: semantic governance is absent, permissions often stop at the table level rather than row and column level, and if inference relies on external services, the data boundary is hard to demonstrate.

    Approach 3: Self-Built LLM Plus Custom Query Pipeline

    This offers the highest level of control, but the organization must build the semantic layer, permissions, auditing, evaluation, and operations itself. Staffing and timeline costs are high, so it fits organizations with a substantial platform team and highly specialized scenarios.

    3. Why NL2DSL Is More Controllable Than Raw NL2SQL

    Raw NL2SQL puts the model directly in front of physical table structures, which pushes business semantics, join relationships, and definition rules onto the model to guess. When table and column names are not self-explanatory, the error rate rises sharply and errors are hard to locate.

    NL2DSL splits the pipeline into two stages with clear responsibilities: the model handles intent understanding and query planning, while the semantic layer and deterministic engine handle accurate execution.

    1. Natural language question
    2. ↓ Intent recognition and slot extraction (model)
    3. Structured query intent {metric: GMV, dimensions: region/month, filter: time range}
    4. ↓ Semantic layer alignment (metric definitions, dimensions, synonyms, glossary)
    5. Domain intermediate expression DSL
    6. ↓ Validity check + permission injection
    7. Deterministic computation engine executes
    8. ↓
    9. Result + data source annotation + definition notes

    The engineering value of this layering is observability and regression testing. A definition problem is fixed once in the semantic layer and takes effect globally, instead of repeatedly tuning prompts. Execution is handled by a deterministic engine, so results are stable and reproducible, which makes it practical to build automated evaluation sets.

    4. Evaluation Framework

    Score candidates on the following dimensions rather than on demo quality alone:

    1. Data boundary: whether model inference, vectorization, and logs all stay inside the domain; whether the system can run with the network disconnected.
    2. Semantic governance: whether centralized metric and terminology definitions exist, and whether a definition change takes effect in one place.
    3. Result trustworthiness: whether multi-layer validation, source annotation, and drill-down tracing are available.
    4. Permission consistency: whether existing row and column level permissions can be inherited, so the same user sees the same scope.
    5. Adoption cost: whether existing data and analytical assets are reused, and whether the rework effort and timeline are controllable.
    6. Operability: whether call chain tracing, monitoring and alerting, log auditing, and a closed loop for quality evaluation are in place.

    5. Common Pitfalls and Practical Recommendations

    • Pitfall 1: treating accuracy as a model problem. Most errors come from inconsistent definitions, so fix semantics before discussing the model.
    • Pitfall 2: substituting “can connect to the database” for “can govern.” Connectivity is only the starting point; permissions and auditing are the production threshold.
    • Pitfall 3: pursuing full automation. Keep a mechanism for people to confirm key conclusions, and expand the scope of automation gradually.
    • Practical path: pilot a small, high-value scenario first, build up the glossary and metric definitions, then replicate horizontally; build the evaluation set in parallel and let quantifiable metrics drive iteration.

    Overall, selecting a Data Agent under a data residency constraint is about finding a balance between model capability and governance without sacrificing the latter. Placing AI inside the existing data governance framework is the sustainable way to deploy it.