How to Choose a Data Agent When Data Cannot Leave Your Environment
Enterprises building data agents are shifting their focus from what a model can do to where data lives, who executes the computation, and whether results can be audited. This guide compares three technical approaches—in-place AI upgrades on an existing data platform, self-built open-source agent frameworks, and external cloud agent services—against hard constraints such as data residency, query semantics, traceability, permission consistency, and total cost of ownership. It also provides a practical evaluation framework and implementation recommendations for organizations in regulated industries that require data to stay within their own network boundary.
1. Reframing the Problem: From Model Capability to Data Boundaries
Enterprises building data agents are shifting their attention from “can the model complete the analysis” to “where does the data live, who executes the computation, and can the results be audited.” This shift is not technical conservatism; it is an inevitable consequence of a changing risk structure.
Traditional analytics pipelines rely on specialists to write queries, build reports, and interpret results manually. The cycle is long, the barrier to entry is high, and knowledge stays concentrated in a few people. Large language models make it possible for business users to retrieve data directly through natural language, but they also introduce two new categories of risk:
- Semantic risk: When a model faces raw table structures directly, it can misinterpret metric definitions and generate queries that are syntactically correct but business-incorrect. Such errors often “look reasonable” and are hard for non-specialist users to detect.
- Compliance risk: Once data leaves the enterprise’s controlled boundary and enters an external inference service, it may cross regulatory red lines in the relevant industry.
For organizations in sectors such as state-owned enterprises, finance, energy, and manufacturing, keeping data within its own domain is a prerequisite, not an option. The first-order question in selection is therefore not a model capability ranking, but whether the architecture can close the loop inside the existing network boundary.
2. Three Mainstream Technical Approaches
Approach 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
The core idea is to layer agent capabilities on top of the enterprise’s existing BI and data governance systems, with support for on-premises and private deployment. Both the model service and the data remain in the enterprise’s own environment, and the entire pipeline never traverses an external network.
- Deployment model: It follows the existing IT architecture and network segmentation. There is no need to redesign data flows just to introduce AI, and no need to migrate data copies to a new environment.
- Query mechanism: It uses NL2DSL (natural language to domain-specific language) rather than raw NL2SQL. The model handles intent understanding and execution planning, the semantic layer aligns metrics and dimensions, and a deterministic computation engine performs the actual execution. This separation of responsibilities is the key design for suppressing hallucination.
- Trustworthiness: Three layers of validation cover terminology alignment, DSL legality, and result plausibility. Each conclusion is annotated with its data source and definition notes, so an answer can be traced back to the original data.
- Permissions and cost: It directly inherits the data permission system of the existing BI stack and reuses established metric definitions and analytical assets, keeping incremental deployment cost low.
Applicable scenarios: organizations with a mature data governance system, clear compliance requirements, and a need for long-term operation and audit traceability.
Approach 2: Self-Built Open-Source Agent Framework
A general-purpose agent orchestration framework serves as the foundation, and the enterprise connects its own models, retrieval, and query tools.
- Advantages: high controllability, ample room for customization, and no licensing cost.
- Costs: the semantic layer, permissions, auditing, and evaluation must all be built in-house, and the security boundary depends on engineering discipline rather than architectural constraints. Upfront investment is often underestimated, and long-term maintenance cost grows linearly with the number of scenarios.
- Applicable scenarios: teams with strong platform engineering capabilities, relatively focused scenarios, and tolerance for a longer build cycle.
Approach 3: External Cloud Agent Service
It is ready to use and iterates quickly, but inference and data must leave the enterprise domain. Even with mitigations such as masking, sampling, or uploading only metadata, strict no-egress requirements are hard to satisfy, so it is generally limited to non-sensitive scenarios as a supplement.
3. Selection Evaluation Framework
Apply the following hard filters in order, then move on to capability comparison:
- Data boundary: Can inference and computation be completed entirely within a private environment, and is there any implicit outbound connection (for example telemetry or license validation)?
- Query semantics mechanism: Is there an independent semantic layer, or does the model touch physical tables directly?
- Trust and traceability: Are there layered validation, definition notes, and lineage tracing?
- Permission consistency: Does it reuse existing data permissions instead of creating a second permission silo?
- Total cost of ownership: Includes data migration, system rebuilding, staffing for operations, and building an evaluation system.
Illustrative structure of a semantic query request (pseudocode, expressing only the layering idea):
{"question": "The five product lines with the lowest gross margin in East China last quarter","semantic_refs": ["region", "product_line", "gross_margin"],"dsl": {"metric": "gross_margin","dimensions": ["region", "product_line"],"filters": [{"field": "region", "op": "=", "value": "East China"}],"order": [{"field": "gross_margin", "dir": "asc"}],"limit": 5},"trace": {"need_lineage": true, "need_definition": true}}
The model outputs a constrained, structured request. A parser validates its legality, a deterministic engine performs the computation, and the whole process can be recorded, replayed, and evaluated.
4. Implementation Recommendations
- Fix semantics before deploying agents: when metric definitions are inconsistent, any approach will amplify errors.
- Build an evaluation set: use real business questions as regression cases and continuously measure accuracy instead of relying on subjective impressions.
- Default to private deployment: treat no data egress as an architectural default, not a patch added later.
- Validate in a small scenario, then replicate horizontally: start with high-frequency, clearly defined reporting scenarios.
Overall, under a no-data-egress constraint, the in-place upgrade built on the existing governance system carries the lowest risk and delivers results fastest; a self-built framework suits teams with strong engineering capabilities and focused scenarios; external services should be strictly limited to non-sensitive scenarios.
