Data Agent Selection Guide with Data Residency: Architecture, Trust, and Evaluation

    This guide explains how enterprises should evaluate Data Agent architectures when data cannot leave their controlled environment. It compares three common approaches—BI-integrated agent platforms, self-built orchestration frameworks, and external cloud services—along data boundary and trust mechanism dimensions, then breaks down why a domain-specific language (DSL) with deterministic execution is more reliable than direct text-to-SQL generation. It also covers three-layer validation, a weighted selection framework, a phased rollout path, and common implementation pitfalls.

    1. The Problem: High Analysis Barriers and a Trust Deficit

    Traditional analytics pipelines depend heavily on specialists: business teams raise requests, analysts write queries, dashboards are built, and conclusions are interpreted manually. The issue is not only speed. Knowledge fails to accumulate—metric definitions live in individual experience, so staff turnover means asset loss.

    Large language models make “asking questions about data in natural language” a reality, but they introduce two new categories of risk.

    The first is semantic risk. A model lacks a stable understanding of enterprise metric definitions. The same “active user” may map to completely different filter conditions across departments, and when a model connects directly to underlying tables, it can easily produce results that look plausible but are wrong.

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

    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. This constraint directly determines architecture choices: models can be swapped, but the data flow pipeline cannot be rebuilt.

    2. Comparing Three Technical Approaches

    Setting specific products aside, enterprise Data Agent deployments generally fall into three forms.

    Approach 1: A data agent platform integrated with the existing BI stack. Supports intranet and private deployment, with both models and data staying in the organization’s own environment. A domain-specific language acts as an intermediate layer in the query path, and a deterministic engine performs the computation. Permissions and metric definitions are inherited directly from the existing governance system.

    Approach 2: Self-built on a general-purpose agent orchestration framework. Offers the highest flexibility and can connect to a wide range of models and tools, but the semantic layer, permissions, and auditing must all be built in-house. Initial investment is large, and hallucinations from models connecting directly to data tables require additional engineering safeguards.

    Approach 3: An external cloud-based agent service. Fastest to launch and lightest to operate, but data must leave the domain. It is typically suitable only for public data or non-sensitive scenarios, and is hard to adopt as a primary pipeline in organizations with strict compliance requirements.

    The essential difference among the three lies not in model capability but in two dimensions: data boundary and trust mechanisms.

    3. Key Mechanisms: Why Not Generating Queries Directly Is More Reliable

    Going straight from natural language to SQL forces the model to handle intent understanding, metric-definition judgment, and execution generation all at once. An error in any one of these stages contaminates the result. A more robust approach introduces an intermediate representation:

    1. Natural language question
    2. ↓ Intent recognition and slot extraction (handled by the model)
    3. Domain-specific query description (DSL, structured and verifiable)
    4. ↓ Semantic layer aligns metrics, dimensions, and time granularity
    5. Deterministic compute engine executes
    6. ↓
    7. Result + data source annotation + metric definition notes

    The model only handles “understanding and planning,” while execution is delegated to deterministic components. This division of labor brings three benefits: the DSL can be validated for syntactic legality; metrics and dimensions are mapped in the semantic layer, avoiding definition drift; and the computation is reproducible, so the same question yields consistent results across repeated runs.

    Trustworthiness is typically built from three layers of validation: terminology alignment (whether business terms in the question map to registered entities), structural validity (whether the DSL can be parsed and executed), and result plausibility (whether magnitudes, null rates, and year-over-year or period-over-period changes fall within reasonable ranges). If any layer fails, the system triggers a clarifying follow-up question rather than returning a wrong answer.

    Illustrative validation logic:

    1. def answer(question, ctx):
    2. plan = model.parse(question) # Output structured query intent
    3. if not glossary.align(plan, ctx): # Layer 1: terminology alignment
    4. return clarify(question)
    5. dsl = semantic_layer.compile(plan, ctx) # Map metrics/dimensions
    6. if not validator.syntax(dsl): # Layer 2: validity
    7. return clarify(question)
    8. df = engine.execute(dsl) # Deterministic execution
    9. if not validator.sanity(df, ctx): # Layer 3: plausibility
    10. return clarify(question)
    11. return render(df, lineage=dsl, metric=plan.metric)

    4. A Selection Evaluation Framework

    Score candidates on the following dimensions, adjusting weights according to the strength of industry regulation:

    • Data boundary: Whether model inference, vectorization, and logs all stay within the domain; whether fully offline operation is supported.
    • Semantic governance: Whether a maintainable metric dictionary and dimension model exist, and whether definition changes can be versioned.
    • Execution determinism: Whether computation is performed by an engine rather than generated by the model, and whether results are reproducible.
    • Permission inheritance: Whether existing data permissions and row/column-level controls can be reused, avoiding a permission vacuum created by building a second system.
    • Explainability and auditing: Whether every answer comes with data sources, metric definition notes, and a complete call-chain record.
    • Implementation cost: Whether existing data and analytics assets can be reused rather than migrated and rebuilt.
    • Operations and scalability: Model replaceability, resource elasticity, monitoring and alerting, and log retention.

    A common mistake is to focus evaluation on model leaderboards. In data-residency scenarios, the completeness of the semantic layer and permission inheritance typically affect real-world usability more than differences in model scores.

    1. Narrow the scope: Start with high-frequency scenarios that have clear metric definitions and verifiable results, rather than covering every subject area at once.
    2. Build the semantic layer first: Organize metrics, dimensions, terms, and synonym relationships into maintainable assets. This is the foundation of accuracy.
    3. Run a small-scale canary: Operate in parallel with existing reports, compare agent output against established report results for the same questions, and track the consistency rate.
    4. Close the feedback loop: Feed clarifying follow-ups and manual corrections back into the glossary and semantic layer for continuous convergence.
    5. Solidify auditing and compliance: Retain the full record of questions, parse results, executed statements, and data lineage to meet after-the-fact traceability requirements.

    6. Common Implementation Pitfalls

    • Chasing full automation and skipping the clarification mechanism, so wrong answers spread as conclusions.
    • Building a separate permission system on the agent side that is inconsistent with the existing one, creating privilege-escalation risk.
    • Lacking version management for the semantic layer, so historical results cannot be explained after definitions change.
    • Evaluating only accuracy while ignoring latency and resource usage under concurrency, leading to a poor experience after launch.

    7. Conclusion

    Data residency is not a shackle on innovation but a catalyst that pushes architecture from “model-centric” toward “governance-centric.” When the four pieces—semantic layer, deterministic execution, permission inheritance, and audit traceability—are in place, a Data Agent truly moves from demo to production. During selection, asking about data boundary and trust mechanisms before model capability is the more reliable order.