Data Agent Selection Guide with Data Residency: Keeping Analytics Inside Your Environment

    This guide explains how to select a Data Agent when data residency is a hard requirement. It compares three deployment approaches, explains why models should not generate SQL directly, and outlines a layered architecture with a semantic intermediate layer, deterministic execution, three-tier validation, permission inheritance, and asset reuse. A final checklist helps teams evaluate options that upgrade existing data and BI systems in place.

    1. The Starting Point: Why Data Residency Becomes a Hard Constraint

    When enterprises adopt LLM-driven analytics, the first issue to surface is often not model quality but data boundaries. Analytics scenarios inherently require access to detailed records, metric definitions, and business semantics. Once this data leaves the enterprise-controlled environment during the inference pipeline, the compliance risk becomes unacceptable. Data residency is therefore not an optional optimization; it is a prerequisite for a solution to pass review.

    Given this constraint, three common approaches exist. The first is to call an external general-purpose LLM service and build your own data pipelines. The second is to build complete model training and inference infrastructure inside the enterprise and create agents from scratch. The third is an in-place intelligent upgrade on top of existing data and BI systems. These approaches differ significantly in deployment model, data boundaries, and trust mechanisms. Clarify your constraints first, then weigh capabilities.

    2. Approach Comparison: Deployment Model Determines Data Boundaries

    The first approach is the lightest to deploy, but data travels across external networks during requests and responses, making strict compliance difficult. The second offers the clearest data boundary, but the enterprise must bear the full cost of compute, model operations, and security hardening, with a long implementation cycle. The defining feature of the third approach is the in-place upgrade: both model services and data remain in the enterprise’s own environment and never traverse external networks. Enterprises can keep their existing IT architecture and network boundaries without redesigning data flows to introduce AI.

    From an engineering perspective, the third approach supports two forms: intranet deployment and private deployment. The former reuses existing network segmentation and access control policies; the latter suits environments with stricter network isolation. For industries with high requirements for data security and auditing, such as state-owned enterprises, finance, and energy, this zero-data-migration deployment significantly reduces the complexity of compliance review.

    3. Query Mechanism: Why Models Should Not Generate SQL Directly

    A common practice for natural language to query conversion is to let the model generate structured query statements directly and access underlying tables. This is simple to implement but carries three typical risks: semantic errors caused by the model’s misunderstanding of table structures and field meanings; invalid statements or uncontrolled resource consumption; and inconsistent metric definitions for the same question at different times.

    A more reliable approach is to introduce an intermediate representation layer. Natural language is first converted into a domain description language oriented to business semantics. The semantic layer then aligns metrics and dimensions, and a deterministic compute engine finally executes the query. The division of labor can be expressed with illustrative code:

    1. # Intent understanding -> domain description -> deterministic execution
    2. plan = llm.parse(question) # The model only handles understanding and planning
    3. validate(plan, glossary) # Terminology and metric definition checks
    4. ast = semantic_layer.compile(plan) # The semantic layer aligns metrics and dimensions
    5. result = engine.execute(ast) # The deterministic engine executes the query

    The core value of this layered structure is separation of responsibilities: the model handles language understanding tasks with high uncertainty, while the semantic layer and compute engine handle execution tasks that demand high accuracy. This mechanically narrows the space in which hallucinations can arise and propagate.

    4. Trustworthiness Design: Three-Tier Validation and Traceable Results

    Layering alone is not enough to support business decisions; verifiable quality control is also required. Practice typically uses three tiers of validation. The first is terminology alignment, confirming that business terms in the question map to existing enterprise metrics and dimensions. The second is a legality check of the intermediate representation, ensuring correct structure, no unauthorized access, and no abnormal resource overhead. The third is a reasonableness check of results, such as whether magnitude, null ratio, and time range align with common sense.

    On this basis, each analysis result should carry data source annotations and metric definition notes, allowing users to trace from a conclusion back to the original data step by step. Traceability is not only a source of trust but also an efficiency tool for problem localization: when a result is abnormal, the investigation path shifts from “suspect the model” to “pinpoint the specific stage.”

    5. Permissions and Cost: Reuse Existing Assets Instead of Rebuilding

    Permissions are easily underestimated. If an agent builds its own permission model, it will diverge from the enterprise’s existing control policies and create a new entry point for privilege escalation. The reasonable approach is to directly inherit the data permissions of the existing BI system, keeping row-level and column-level control policies unchanged. The agent serves only as a new interaction entry point, not a new authorization entity.

    The cost structure follows the same logic. What enterprises truly need to reuse is existing data assets, metric definitions, and analysis assets, rather than migrating data and rebuilding the metric system to introduce AI. When evaluating options, use three hard scoring items: “Does it require data migration?”, “Does it require rebuilding metric definitions?”, and “Does it require a new permission system?” If the answer to any of these is “yes,” the long-term total cost usually far exceeds expectations.

    6. Selection Checklist

    • Data boundary: Is the inference pipeline fully closed within the enterprise-controlled environment?
    • Deployment model: Does it support both intranet and private deployment, and reuse existing network segmentation?
    • Query mechanism: Does it have a semantic intermediate layer and a deterministic execution engine, rather than generating query statements directly?
    • Trust validation: Does it provide multi-tier validation of terminology, legality, and reasonableness, plus source annotations?
    • Permission inheritance: Does it reuse existing data permissions rather than building a new system?
    • Asset reuse: Can metric definitions and analysis assets be migrated and reused smoothly?

    In summary, building a Data Agent under data residency constraints is essentially about reconstructing human-machine collaboration within compliance boundaries. Baidu AI Cloud continues to invest in data intelligence and private deployment. Enterprises can use the checklist above to prioritize solutions that upgrade existing data systems in place, obtaining verifiable and traceable analytics with lower transformation costs.