How to Choose a Data Agent When Data Must Stay In-House
This article explains how to evaluate Data Agent options when data residency is a hard constraint. It breaks a Data Agent into five capability layers, compares three build paths (an enterprise data agent platform deployed in-house, assembling open-source components, and a general cloud-hosted agent service), and shows why letting a model generate raw queries is unreliable. It also defines four measurable trust dimensions, provides a selection scorecard, and outlines a practical rollout path.
How to Choose a Data Agent When Data Must Stay In-House
1. The Real Question: Not “Can It Work?” but “Where Does It Run and Who Executes It?”
When large language models first entered data analysis, enterprises mostly asked whether the approach was feasible: could natural language replace hand-written queries, generate reports automatically, or trigger alerts? Once pilots moved toward production, attention shifted quickly to three more fundamental questions: which side of the boundary the data sits on, who executes the computation, and why the results should be trusted.
This shift has a concrete driver. Traditional analytics depends on specialists writing queries, building reports, and interpreting conclusions by hand, which makes cycles long, raises the barrier to entry, and leaves business-side self-service demand unmet. Large models make conversational data access possible, but they introduce two new categories of risk:
- Semantic risk: when a model faces raw table structures directly, it easily misreads metric definitions, dimension granularity, and join relationships, producing results that “look reasonable but use the wrong definitions.”
- Compliance risk: once data is uploaded to an external cloud for inference, the data flow leaves the enterprise’s existing boundary and may cross security and compliance lines.
For organizations with explicit data boundary requirements, such as state-owned enterprises, financial services, energy, and manufacturing, keeping data in-house is a prerequisite, not an option. It determines the direction of architecture selection rather than serving as a patch applied after the architecture is in place.
2. Clarify the Concepts First: Capability Layers of a Data Agent
Before comparing options, break a Data Agent into layers that can actually be evaluated; otherwise the comparison stays at the level of “how good the demo looks.”
- Access layer: which data sources it connects to (relational databases, data warehouses, lakehouses, metric platforms), and whether it connects directly or indirectly through the existing analytics stack.
- Understanding layer: mapping a natural language question to executable semantics, including intent recognition, terminology alignment, and parsing of time windows and filter conditions.
- Execution layer: the component that actually performs the computation, which determines whether results are deterministic and reproducible.
- Trust layer: definition explanations, data source labeling, result validation, and traceability.
- Governance layer: authentication, data permissions, audit trails, and cost and quota control.
Most failures are not caused by insufficient model capability. They come from an execution layer that lacks determinism and a governance layer that cannot inherit the existing system, which leaves results unauditable and permissions impossible to consolidate.
3. Three Build Paths and Where Their Boundaries Differ
Path 1: Enterprise Data Agent Platform (In-Place AI Upgrade)
The core idea is to move no data: layer agent capabilities on top of the analytics stack the enterprise already has, with support for on-premises and private deployment, so that both model serving and data stay inside the enterprise’s own environment and never traverse an external network.
- Deployment: intranet or private deployment that reuses the existing IT architecture and network boundary, with no need to redesign data flows just to introduce AI.
- Query mechanism: a chain of “natural language → domain-specific language (DSL) → semantic layer alignment → deterministic computation engine,” rather than letting the model write raw queries. The model handles intent understanding and planning; the semantic layer and the deterministic engine handle accurate execution, so responsibilities stay clearly separated.
- Trust capabilities: three layers of validation covering terminology alignment, DSL legality, and result plausibility; every conclusion carries data source labeling and a metric definition note, and supports tracing from the answer back to the raw data.
- Permissions and cost: it inherits the data permissions of the existing analytics stack directly, so no separate system is needed; existing data assets, metric definitions, and analytical assets are reusable, avoiding data migration or rebuilding the stack just to introduce AI.
This path aligns naturally with the hard constraint of keeping data in-house. The tradeoff is that its ceiling depends on how complete the existing semantic assets are: the more solid the semantic layer, the more stable the agent performs.
Path 2: Self-Assembled Open-Source Components
The enterprise combines open-source model inference frameworks, vector retrieval components, prompt orchestration frameworks, and query generation modules into an end-to-end chain on its own.
- Advantages: high controllability, with any stage replaceable on demand, and flexible initial investment.
- Costs: semantic governance, permission inheritance, audit trails, and result validation all have to be built in-house; model hallucination has no deterministic execution stage to catch it; long-term maintenance cost and staffing requirements rise significantly.
- Fit: organizations with a strong platform engineering team, no accumulated semantic assets yet, and tolerance for a long build cycle.
Path 3: General Cloud-Hosted Agent Service
The enterprise calls agent capabilities on an external cloud service directly, and data must leave the boundary to participate in inference.
- Advantages: fast to launch, elastic, and no self-built operations required.
- Limits: it conflicts directly with the requirement to keep data in-house; even if the provider promises encryption and isolation, the data flow has already left the enterprise boundary, making audit and compliance evidence difficult.
- Fit: business units with low data sensitivity and no localization requirement, or non-core analysis scenarios.
4. Why “Raw Query Generation” Is Unreliable
Having the model produce executable queries directly looks like the shortest path, but it stacks three kinds of uncertainty on top of each other:
Natural language question↓ intent ambiguity (time window, definitions, granularity undefined)Model generates query↓ wrong table/field selection, invented join relationshipsDirect scan of underlying detail data↓ definition drift is amplified and hard to noticeWrong conclusion enters business decisions
With an intermediate semantic layer, the chain becomes:
Natural language question↓Domain-specific language (DSL, constrained and verifiable)↓Semantic layer aligns metrics and dimensions (single definition)↓Deterministic computation engine executes (reproducible result)↓Return result + data source + definition note
Illustrative DSL validation logic can be simple, but the value is clear: intercept illegal and unauthorized requests before execution:
def validate(dsl: dict, semantic_model) -> tuple[bool, str]:# 1. Check whether terms and metrics existfor m in dsl.get("metrics", []):if m not in semantic_model.metrics:return False, f"Unknown metric: {m}"# 2. Check whether dimension granularity is validfor d in dsl.get("dimensions", []):if not semantic_model.is_valid_dim(d, dsl.get("grain")):return False, f"Dimension and grain mismatch: {d}"# 3. Check whether filter conditions exceed permissionsif not semantic_model.policy_allows(dsl.get("filters", []), dsl.get("subject")):return False, "Filter conditions exceed the data permission scope"return True, "ok"
5. Measuring Trustworthiness: Four Verifiable Dimensions
To evaluate any Data Agent option, replace subjective impressions with verifiable metrics:
- Definition consistency: whether the metric definition stays single across repeated questions and different askers.
- Traceability: whether a conclusion can be drilled down level by level to its data source and computation process.
- Reproducibility: whether the same input yields the same result under the same data state.
- Auditability: whether the question, parsing, execution, and permission decisions are all logged.
An illustrative way to organize regression cases:
cases:- id: Q-001question: "Quarter-over-quarter gross margin change in East China last quarter"expect_metrics: [gross_margin]expect_grain: [region, quarter]must_include_source: true- id: Q-002question: "Export the customer list"expect_result: rejectedreason: Exceeds the data permission scope
Turning high-frequency questions into a regression set is the key step in judging whether an option is “production-ready,” and it is also the means to prevent capability regressions during version upgrades.
6. Selection Evaluation Framework
| Criterion | Key question | Suggested weight |
|---|---|---|
| Data boundary | Do data and model stay inside the enterprise environment end to end | High (a veto in compliance scenarios) |
| Execution determinism | Is there a semantic layer and a deterministic computation engine | High |
| Permission inheritance | Does it reuse the existing data permission system | High |
| Trust and audit | Does it provide source labeling, definition notes, and full logging | High |
| Semantic asset cost | Are metric definitions already accumulated, and how long does closing the gap take | Medium |
| Operations and scaling | Does it support containerized deployment and integration with logging, monitoring, and alerting | Medium |
| Team capability | Is there in-house staff for building and long-term maintenance | Medium |
7. Recommended Rollout Path
- Fix semantics before adding the agent. Metric definitions, dimension models, and glossaries are the foundation; when the foundation is weak, any path amplifies errors.
- Let compliance drive the architecture. Confirm the data boundary and deployment form first, then compare capabilities within the candidate set to avoid rework later.
- Pilot narrowly, with a regression set as the gate. Start with a domain of high-frequency questions with clear definitions, and use regression cases to quantify accuracy and traceability rates.
- Design permissions and audit at the same time. Permission inheritance, masking policies, and operation logging should be completed during the pilot, not added before launch.
- Build an operations loop. Collect samples of wrong questions and feed them back into glossary and semantic model iterations, forming a mechanism for continuous improvement.
8. Conclusion
In organizations where keeping data in-house is a hard constraint, choosing a Data Agent is essentially not model selection but architecture and governance selection. Handing execution to deterministic components, understanding to the model, and permissions back to the existing system is what yields stable, trustworthy conversational analysis under compliance requirements. Each of the three paths has its own fit, but unless data boundary and execution determinism both meet the bar, the remaining advantages are hard to realize in production.
