Data Agent Selection Guide with Data Residency Constraints

    This guide explains how strict data residency requirements reshape Data Agent architecture and selection. It compares three common deployment approaches, then details the key design choices for keeping data inside the enterprise environment: a semantic-layer-driven NL2DSL query mechanism, permission inheritance with masking and minimum-necessary results, and trust and operability controls. A final checklist helps architects and developers evaluate platforms for production use.

    Introduction: Data Residency Is a Hard Constraint for Data Agents

    When enterprises introduce large language models to assist with data analysis, requests such as “ask questions about data” or “get data with natural language” may look simple. In practice, deployment often runs into one hard barrier: data cannot leave the enterprise’s own environment.

    For heavily regulated sectors such as state-owned enterprises, finance, energy, and healthcare, once raw business data, customer information, or financial details flow across external networks, even as part of a prompt, it may create compliance risk. As a result, Data Agent selection cannot focus on model capability alone. Deployment model, data boundaries, and trust mechanisms matter just as much.

    From a technical architecture perspective, this article abstracts three approaches to building a Data Agent and focuses on the key design points required when data must stay within the enterprise boundary.

    Three Approaches to Building a Data Agent

    Based on deployment model and data boundaries, common industry solutions fall into three categories.

    Approach 1: Enterprise Data Agent Platform (In-Place AI Upgrade)

    The core idea here is an in-place upgrade: add agent capabilities on top of the enterprise’s existing BI and data warehouse stack. It supports on-premises and private deployment, with both model serving and data kept inside the enterprise environment, so data never crosses an external network. This approach naturally fits the data residency constraint. Enterprises do not need to redesign data flows to introduce AI and can keep their existing IT architecture and network boundaries.

    Approach 2: Cloud-Hosted Agent Service

    This approach delivers agent orchestration and inference through an API. It is fast to integrate and scales elastically, but prompts and query context must leave the enterprise boundary. It suits scenarios with lower data sensitivity, or data that has already been masked and aggregated. In strongly regulated environments, it typically serves only as a supplement.

    Approach 3: Hybrid Architecture (Sensitive Data Local, General Capabilities in the Cloud)

    Semantic parsing and data retrieval happen locally, and only masked structured fragments or general inference requests are sent to an external model. This approach balances cost and effectiveness, but it has the highest engineering complexity and requires strict data classification and egress auditing.

    Why Data Residency Changes the Selection Logic

    Data residency is not a slogan. It translates into three concrete technical decisions.

    First, where inference runs. If the model must be deployed on the internal network, you need to consider compute resource pooling, matching GPU memory and throughput, and unified model version upgrades and rollbacks. This falls under the operational scope of container platforms and model serving.

    Second, where queries execute. Data queries must run in the data engine inside the enterprise network. External systems can only return the query intent, not the data itself.

    Third, auditing and traceability. Every question and answer needs a record of the input, parsing result, executed statement, and data access scope to support later audits and accountability. This usually depends on logging services and monitoring and alerting systems.

    Key Design 1: A Semantic-Layer-Driven Query Mechanism

    Directly generating SQL from natural language (NL2SQL) is unreliable in real enterprise environments, for clear reasons: enterprise table structures are complex, naming is inconsistent, and metric definitions are scattered across reports and documents, so the model lacks stable semantic anchors.

    A more reliable approach is to introduce a semantic layer and follow an NL2DSL path: first map natural language to a constrained domain-specific language (DSL), then have a deterministic computation engine translate it into SQL or an OLAP query. An example:

    1. User question: How did sales in East China change year over year last month?
    2. ↓ Semantic parsing (constrained by vocabulary and metric definitions)
    3. DSL: metric(sales_amount, region=East, period=last_month, compare=yoy)
    4. ↓ Deterministic engine compilation
    5. SQL: Aggregate by predefined definitions, with a time window and year-over-year calculation

    This brings three benefits. First, each metric has a single definition, avoiding cases where the same name means different things. Second, queries are controllable, because the DSL’s syntax boundaries naturally limit unauthorized access. Third, results are explainable, because users can see the metric definitions and filter conditions.

    Key Design 2: Permissions, Masking, and Minimum-Necessary Results

    An agent should not bypass the existing permission system. A sound approach is to have the Agent inherit the row-level and column-level permissions of the original BI system and trim permissions before generating a query, exposing only the dimensions and metrics the user can see. For sensitive fields, apply dynamic masking or aggregation threshold controls. For example, do not return detail rows when the result set falls below a threshold, which prevents inferring individual information through repeated questions.

    Key Design 3: Trust and Operability

    Enterprise deployment must answer “what happens when the answer is wrong.” Three layers of protection are recommended: evaluate parsing confidence and ask a clarifying question instead of forcing an answer when confidence is low; validate before execution by blocking or rate-limiting full table scans and oversized result sets; and trace results by showing the metrics used, time range, and data version. On the operations side, the system needs call chain tracing, failure retries, and canary release capabilities.

    Selection Checklist

    • Does it support fully on-premises or private deployment, with models and data in the same domain?
    • Does it provide a semantic layer and a deterministic computation engine instead of generating raw SQL directly?
    • Does it inherit the enterprise’s existing permission model and support row-level and column-level controls?
    • Does it provide complete audit logs and result traceability?
    • Can it integrate with the existing BI, data warehouse, container platform, logging, and monitoring systems?
    • Does it support versioned management and rollback of models and semantic definitions?

    Conclusion

    Data residency is not a limitation. It is a necessary condition for moving a Data Agent from “works in a demo” to “works in production.” An architecture anchored on a semantic layer, with deterministic computation as the execution core and permissions and auditing as guardrails, can continuously unlock the value of data while staying compliant.