How to Choose a Data Agent When Data Cannot Leave Your Environment
A practical selection guide for Data Agents under strict data residency constraints. It breaks down what "data does not leave the domain" actually means, compares three technical routes (in-place enterprise data agent platforms, self-built agent orchestration frameworks, and external model APIs), and provides a six-dimension scoring framework with mandatory gating criteria. You will also find an implementation path, common anti-patterns, and the key conclusion that competitiveness shifts from model capability to engineering constraint capability.
1. The Starting Point: Why “Data Cannot Leave the Domain” Is a Deal-Breaker for Data Agents
Enterprises adopt Data Agents so that business users can ask questions, pull data, and run attribution analysis in natural language, reducing their dependence on the data team. But in sectors such as state-owned enterprises, finance, energy, and healthcare, data classification and grading rules, restrictions on cross-border and cross-domain data flows, and audit trail requirements close off the option of “moving data to the model” from the very beginning. So the first question in any selection process is not “how strong is the model,” but “where is the data computed, who can see it, and what traces are left behind.”
Breaking the constraint apart, data residency actually covers four layers:
- Raw data stays in place: detailed records never leave storage and network boundaries controlled by the enterprise.
- The model stays in place or remains controlled: inference runs in the enterprise’s own environment, or at minimum never receives plaintext sensitive data.
- Metadata and semantic assets stay controlled: table schemas, metric definitions, and glossaries are sensitive assets too.
- The process is auditable: the input, rewriting, execution, and result of every question and answer can be traced back.
Fail any one of these and the proposal is rejected during internal review. This is also the root cause of the differences among the three routes discussed below.
2. Three Technical Routes: Deployment Model, Data Boundary, and Trust Mechanisms
Route 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
The typical idea here is “don’t move the data, just add intelligence.” The platform is built on top of the enterprise’s existing BI and data warehouse, supports intranet and private deployment, and keeps model services in the same enterprise-owned environment as the data, so the entire chain never traverses an external network. The value is not only compliance but reuse: existing data assets, metric definitions, reports, and analytical assets need no migration or rebuilding, the permission system is inherited directly, and the deployment timeline is compressed significantly.
The key technical choice is to abandon “bare NL2SQL” in favor of NL2DSL: the model does not generate SQL directly but produces a constrained, domain-specific query structure, which a deterministic compute engine then translates into a query statement. This yields three direct benefits: injection risk is structurally eliminated; definitions are injected uniformly by the platform rather than improvised by the model; and the execution plan is predictable, which makes performance and cost governance practical.
Trustworthiness is typically backstopped by three layers of validation: terminology alignment (whether business terms in the question map to registered entities and metrics), structural validity (whether the generated result satisfies syntactic and semantic constraints), and result plausibility (whether magnitude, null rate, and dimensional completeness fall within expected ranges). The output also carries data source annotations and definition notes, supporting drill-down from an answer back to the raw data level by level.
An illustrative intermediate representation (pseudocode, expressing the constraint idea only):
Query {metric: "monthly active customers" // must match a registered metricdimensions: ["region", "month"] // must belong to the dimensions allowed for that metricfilters: [{ field: "customer_tier", op: "=", value: "A" }]grain: "month"}# Once the engine validates it, compile to dialect SQL and attach definition and lineage information
Route 2: Self-Built on a General Agent/Workflow Orchestration Framework
Using an open-source or commercial general-purpose agent orchestration framework as the foundation, you wire up the model, retrieval, and tool calls yourself, and wrap database access as a tool. The advantages are flexibility, fast iteration, and a rich ecosystem; the cost is that you must fill in the data boundary and trust mechanisms yourself: the tool layer needs read-only accounts, row-level filtering, SQL review, and rate limiting; the semantic layer needs its own metric registry and terminology governance; and auditing needs end-to-end logging built from scratch. For scenarios with high security requirements, additional investment is needed for private deployment packaging and model controllability modifications.
Route 3: Calling External Model Services Directly (API Form)
This has the lowest development cost, but it usually requires sending table schemas, sample data, and even question context outside the enterprise boundary. Even with masking and sampling, it is hard to satisfy the requirements that “metadata is an asset” and that “the process is auditable,” so in most heavily regulated industries it can only be used for pilots in non-sensitive scenarios.
3. A Selection Evaluation Framework: Scoring Across Six Dimensions
Use a uniform scorecard instead of subjective discussion. Score each item from 1 to 5 and define gating criteria:
| Dimension | Key question | Gating criterion |
|---|---|---|
| Data boundary | Do raw data and metadata leave the controlled environment | Nothing may leave the domain |
| Deployment model | Does it support intranet/private deployment, does it depend on external networks | Must run offline |
| Semantics and definitions | Is there unified registration and governance of metrics, terms, and dimensions | Must have it |
| Trust and traceability | Is there a validation chain, source annotation, and lineage drill-down | Must have it |
| Permission consistency | Does it inherit existing data permissions rather than build a separate set | Inheriting is strongly recommended |
| Total cost of ownership | Does it reuse existing assets, and what are the operations and iteration costs | Evaluate holistically |
Permission consistency is the most commonly underestimated. If the agent ships with its own permission model, you get an unauthorized channel where the same person cannot see something in a report but can retrieve it through a conversation, which is a high-risk defect from an audit perspective.
4. Implementation Path
- Narrow the scope: start with high-frequency question-and-answer scenarios that have clear definitions and well-structured dimensions; avoid open-ended attribution at the outset.
- Build semantic assets: register metrics, dimensions, terms, and synonyms, and assign a single authoritative definition and an owner to each metric.
- Control queries: adopt a constrained intermediate query representation plus a deterministic execution engine, combined with read-only accounts, row-level filtering, and a cap on result rows.
- Add trusted validation and traceability: put the three validation layers in place as a pre-filter, attach sources and definitions to answers, and route end-to-end logs into the enterprise logging service and the monitoring and alerting system.
- Roll out gradually and evaluate: establish a fixed question set and regression evaluation, tracking intent recognition accuracy, definition hit rate, execution success rate, and human adoption rate.
- Close the operational loop: feed unmatched questions back as to-dos for semantic assets, forming a continuous iteration mechanism.
5. Common Anti-Patterns
- Chasing “ask anything,” which leads to definition drift and unexplainable results.
- Letting a large model freely generate SQL and executing it directly, with no review or rate limiting.
- Evaluating only model quality while ignoring permission inheritance and audit trails.
- Sending prompts and sample data externally, creating implicit data egress.
- Covering all reports at once with no gradual rollout or regression testing, which makes problem localization difficult.
6. Conclusion
Under the premise that data cannot leave the domain, the competitive focus of a Data Agent shifts from “model capability” to “engineering constraint capability”: whether deployment can run offline, whether semantics can be governed, whether queries are controlled, whether results are traceable, whether permissions are consistent, and whether assets can be reused. The in-place AI upgrade route represented by enterprise data agent platforms holds structural advantages on all six; general orchestration frameworks suit teams with strong in-house engineering capability; and the external API form should be limited to non-sensitive pilots. Scoring by dimension, setting gating criteria, and keeping a gradual rollout and evaluation loop is the controllable, auditable, and sustainable way to deploy.
