Data Agent Architecture for Data Residency: Technology Selection and Implementation Guide

    A practical guide to building enterprise Data Agents that keep data within an organization’s controlled environment. Learn how private deployment, natural-language-to-DSL queries, semantic layers, layered validation, and existing BI permissions can support secure, trustworthy analytics while reusing established data assets.

    Introduction: From Traditional Analytics to Data Agents

    Data is a core enterprise asset, but traditional analytics still depends heavily on specialists who write SQL, build business intelligence (BI) dashboards, and interpret results manually. This approach creates long turnaround times and a high technical barrier, making it difficult to respond quickly to business users’ changing information needs.

    Data Agents address this bottleneck through natural-language interaction. They allow business users to explore and analyze data without having to write queries or build reports themselves.

    Deployment, however, involves more than adding a language model to an existing analytics stack. In highly sensitive sectors such as financial services, government-owned enterprises, and energy, data security and regulatory compliance are fundamental requirements. Data must remain within the organization’s controlled environment.

    The central technology-selection challenge is therefore how to deliver useful AI-driven analytics without moving sensitive data outside that boundary.

    The Core Constraint: Keeping Data Within the Enterprise Boundary

    When an enterprise connects directly to a public-cloud model service, business data may need to travel over external networks for inference. This introduces risks involving data exposure and compliance review. In regulated industries, transferring core business data outside an approved environment may conflict with applicable data-protection requirements and expose commercially sensitive information.

    For the strict no-data-egress architecture discussed here, both model services and underlying data must remain inside the enterprise environment, without relying on external network transfers.

    This requirement shapes three major architectural decisions: where the platform runs, how it queries data, and how it validates analytical results.

    Technology Selection: Building an Enterprise Data Agent Architecture

    1. Deployment: End-to-End Private Infrastructure

    The foundation is end-to-end private deployment. An enterprise Data Agent platform should be able to operate independently within an internal network or private-cloud environment.

    All essential components must remain within the enterprise-controlled infrastructure, including:

    • Large language models
    • Vector databases
    • The semantic layer
    • The query and computation engine

    This deployment model lets an organization introduce AI capabilities without redesigning its data-transfer architecture or changing existing network boundaries. It can use established infrastructure, including container platforms and object storage, to deploy the Data Agent within its internal environment.

    Keeping the entire processing chain inside that environment supports strict data-residency requirements and reduces the security-audit burden associated with external data transfers.

    2. Querying: From Direct NL2SQL to NL2DSL

    Many Data Agent implementations use direct natural-language-to-SQL, or NL2SQL: the language model generates SQL from a user’s question and submits it to the underlying database.

    This approach has significant limitations. A model may generate syntactically incorrect SQL or logically incorrect queries, producing unreliable results. Giving a model direct access to underlying table structures also raises security concerns and can make complex enterprise metric calculations difficult to govern.

    A more controlled approach is natural-language-to-domain-specific-language, or NL2DSL. It separates the model’s interpretation of the question from the engine’s execution of the query.

    The workflow has three stages:

    1. Intent interpretation and planning

      The language model interprets the user’s question and converts it into a domain-specific language (DSL). This representation contains structured information such as metrics, dimensions, and filters. It is not directly executable SQL.

    2. Semantic-layer alignment

      The DSL is passed to the BI semantic layer, which contains standardized metric definitions and dimension mappings.

      For example, a question such as “What were sales in the eastern region last quarter?” references a sales metric that the semantic layer maps to an approved calculation, such as summed order amounts minus refunds. This keeps the metric definition consistent rather than allowing the model to invent a calculation.

    3. Deterministic query execution

      A deterministic engine translates the aligned DSL into SQL and executes it. The established BI engine handles query generation and execution, providing predictable execution logic and more controllable performance.

    The division of responsibility is clear: the model interprets intent; the engine executes the calculation. This reduces the risks associated with allowing a language model to generate executable SQL directly.

    3. Trustworthiness: Three Validation Layers and Result Traceability

    Private deployment and NL2DSL provide a foundation, but enterprise analytics also requires validation. A three-layer approach helps identify errors before and after execution.

    • Terminology alignment: A shared business glossary normalizes terms in user questions and model-generated output. It addresses synonyms and ambiguous terminology so that different expressions map to the intended business concepts.

    • DSL validity checks: Before execution, the system checks the DSL against its syntax and rules. It verifies that the requested metrics and dimensions can be calculated together and rejects logically inconsistent requests.

    • Result plausibility checks: After execution, the system evaluates the returned dataset for issues such as unusual fluctuations or excessive null values. Unexpected results can trigger a warning or a request for additional filtering conditions.

    These checks improve reliability, but they do not establish absolute correctness on their own. Users also need visibility into how an answer was produced.

    Each analytical result should include its data sources and metric definitions. Users should be able to trace a chart or answer back to the underlying records, making the analysis inspectable rather than presenting it as an opaque model output.

    4. Access Control and Reuse of Existing Assets

    An enterprise Data Agent should operate within the organization’s existing data-governance framework, not alongside it as a separate system.

    For access control, the platform should inherit the permissions already established in the BI environment. When users ask questions, their identities should determine the permitted query scope. This supports fine-grained row-level and column-level isolation across roles and departments without requiring a separate permission framework solely for AI analytics.

    Existing assets are equally important to implementation cost. Introducing a Data Agent should not require large-scale data migration or a complete rebuild of the analytics environment.

    By connecting to existing data warehouses or data lakes, the platform can reuse established metric definitions, reports, and data models. This approach reduces incremental deployment effort and helps make existing data assets accessible through natural-language interaction.

    Conclusion

    Data Agents can make enterprise analytics more accessible, but strict data-residency requirements must shape their architecture from the outset.

    For organizations that prohibit data from leaving their controlled environment, direct connections to external model services are unsuitable for sensitive data workflows. Direct NL2SQL also introduces risks that are better addressed through a governed query architecture.

    An enterprise approach combines end-to-end private deployment, NL2DSL, a standardized semantic layer, deterministic execution, layered validation, and traceable results. Inheriting existing BI permissions and reusing established data assets further reduces implementation complexity while preserving governance.

    General-purpose compute and large-model infrastructure, including offerings from providers such as Baidu AI Cloud, can form part of this foundation where they support the required deployment environment. The priority remains the same: keep data within the approved boundary while making analytics more secure, controlled, and accessible.