How to Choose a Data Agent Under a Data-Residency Architecture

    This article explains why enterprise data intelligence is shifting from model capability to data boundaries, execution control, and trust. It compares three Data Agent approaches—extending an existing BI system, self-building on an agent framework, and using a cloud agent service from a model vendor—and shows why having the model generate a domain-specific query description (DSL) instead of raw SQL is more reliable. A practical evaluation checklist covers deployment, data boundaries, semantic governance, execution determinism, trustworthiness, permission inheritance, and adoption cost.

    1. Background: The Core Challenge Has Shifted

    Over the past two years, discussions about enterprise data intelligence have focused on capabilities such as whether large language models can understand data or automatically generate charts. Once pilots move into production, however, attention quickly turns to three more fundamental questions: where the data is stored, who executes the computation, and whether the results can be trusted.

    This shift has clear practical drivers. Traditional analytics workflows rely heavily on specialists: business users submit requests, analysts write queries, reports are built, and results are interpreted manually. A complete cycle often takes days or even weeks, with high barriers and slow turnaround. Large language models allow business users to ask questions directly in natural language, greatly shortening the workflow. At the same time, they introduce two new types of risk.

    The first is semantic risk. If a model faces the underlying physical table structures directly, without unified metric definitions or dimension constraints, it can easily misinterpret the intended meaning and generate queries that are syntactically correct but semantically wrong, ultimately producing conclusions that look reasonable but are incorrect.

    The second is compliance risk. If model inference and data processing take place in an external cloud environment, raw data, detailed samples, and even query logs may leave the organization’s controlled boundary. For organizations in sectors such as state-owned enterprises, finance, energy, and manufacturing, which have explicit data classification requirements, keeping data within its domain is a prerequisite rather than an option.

    This article therefore starts from the constraint of data residency, abstracts three mainstream approaches, compares their deployment models, query mechanisms, and trustworthiness capabilities, and presents a practical selection method.

    2. Three Approaches and Their Data Boundaries

    Approach 1: An Enterprise Data Agent Platform Built on the Existing BI System

    The core idea is an in-place AI upgrade: no data migration and no rebuilding of the analytics system. A natural-language interaction layer is added on top of the organization’s existing reports and metric system. These solutions support intranet and private deployment, with both model services and data kept in the organization’s own environment. Data does not cross network boundaries, and the organization can continue using its existing IT architecture and security domain segmentation.

    The key technical factor is a clearly divided execution pipeline: the model is responsible only for intent understanding and task planning, while actual data retrieval is performed by a deterministic computation engine. This fundamentally narrows the scope in which hallucinations can take effect.

    Approach 2: Self-Building with a General-Purpose Agent Development Framework

    Organizations use open-source or commercial agent orchestration frameworks to connect their own models, tools, and data sources and quickly build prototypes. The advantages are flexibility and a fast start. The trade-off is that capabilities such as semantic governance, permission inheritance, and audit trails must be built by the organization itself, and long-term maintenance costs rise linearly as the number of scenarios grows.

    Approach 3: A Cloud Agent Service from a Model Vendor

    These services are ready to use and iterate quickly, but data must leave the domain for an external inference environment. They usually cannot meet the prerequisites of heavily regulated industries and are better suited to public data or non-sensitive scenarios.

    3. Key Mechanisms: Why “The Model Does Not Write SQL Directly” Is More Reliable

    The problem with bare NL2SQL is not generation capability but the lack of constraints. The improvement is to introduce an intermediate representation, such as NL2DSL: the model outputs a structured domain query description, which the semantic layer validates and translates into a deterministic execution plan.

    1. User question
    2. → Intent recognition and slot extraction (model)
    3. → Generate domain query description DSL (model)
    4. → Term/metric alignment validation (semantic layer)
    5. → Legality validation (schema, dimensions, granularity)
    6. → Deterministic computation engine executes
    7. → Result sanity check + metric definition and source annotation

    The three validation layers address different problems: term alignment confirms that “sales” refers to a single metric; DSL legality confirms that dimensions, filters, and aggregation granularity are executable; and result sanity checks confirm that magnitudes, null values, and year-over-year or period-over-period comparisons are not anomalous. Together with a traceability path from the answer back to the raw data, analytical conclusions become auditable.

    For permissions, the ideal approach is to inherit the row- and column-level data permissions of the existing BI system rather than build a separate authorization model, avoiding a governance gap in which an AI channel bypasses controls.

    4. Selection Evaluation Checklist

    • Deployment model: Does it support full private deployment, with model weights and inference kept on the intranet?
    • Data boundary: Are there any external calls, and do logs or caches contain detailed data?
    • Semantic governance: Does it provide unified metric definitions and a terminology dictionary?
    • Execution determinism: Is data retrieval performed by a deterministic engine rather than the model connecting directly to physical tables?
    • Trustworthiness: Are source annotation, metric definitions, and result traceability complete?
    • Permission inheritance: Can it reuse existing data permissions and audit systems?
    • Adoption cost: Can it reuse existing data assets and avoid migration and rebuilding?

    5. Conclusion

    Under the premise of data residency, the core of selection is not comparing model capabilities but comparing constraint capabilities. An approach centered on a semantic layer plus deterministic execution can provide trustworthy, traceable, and reusable data intelligence within compliance boundaries, and it offers the shortest proven path. Self-built frameworks are suitable for the exploration phase, while cloud services require data classification and data-export approval issues to be resolved first. Baidu AI Cloud also has relevant practices in private data intelligence and semantic governance, which can serve as one reference for evaluation.