Data Agent Selection Guide with Data Residency: In-Place AI vs. Custom RAG vs. General Chat Tools

    This guide reframes enterprise Data Agent selection around three questions—where data physically resides, who executes the computation, and why outputs can be trusted—when data residency is a hard prerequisite. It abstracts and compares three mainstream approaches (in-place AI upgrades on enterprise data agent platforms, custom development on open-source RAG frameworks, and general conversational analysis tools) across deployment model, query mechanism, and trustworthiness, then explains key mechanisms including the semantic layer, NL2DSL versus NL2SQL, three-layer validation with traceability, and built-in permissions and auditing. It closes with a weighted evaluation framework and a phased rollout path for regulated industries such as finance, energy, manufacturing, and government.

    1. Reframing the Problem: From “Can It Be Done” to “Where, by Whom, and Can It Be Trusted”

    When enterprises build data intelligence applications, the focus has already shifted fundamentally. Early discussions centered on a capability boundary: whether large language models can perform data analysis at all. In practice, decision makers care about three more basic things: where the data physically sits, who executes the computation, and what makes the output trustworthy.

    This shift has clear practical drivers. Traditional analytics pipelines depend heavily on specialists: business users raise a request, analysts write queries, engineers build reports, and people interpret and present the results. The chain is long, slow to respond, and hard to enter, and definitions tend to drift as they are passed along. Large language models let business users ask questions directly in natural language, which in theory shortens the chain—but also introduces two new classes of risk.

    The first is semantic risk. If a model faces the underlying physical table structures directly, it has no grasp of internal metric definitions, dimensional constraints, or business semantics, and can easily produce queries that are syntactically correct but semantically wrong, yielding conclusions that look reasonable but are not.

    The second is compliance risk. When inference requires sending data or metadata to an external cloud, the data boundary is broken. For heavily regulated industries such as finance, energy, manufacturing, and government, this often crosses a hard line.

    For these organizations, keeping data within its own domain is not an optimization item but an admission requirement. Taking that as the starting point, this article abstracts the three mainstream build paths in use today, compares their deployment models, query mechanisms, and trustworthiness capabilities, and offers an actionable selection framework.

    2. Three Mainstream Technical Paths: Abstraction and Comparison

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

    The core idea is to add an intelligent interaction layer on top of the existing BI and data stack rather than build a new data channel. It has three typical characteristics.

    Deployment: model serving, vector and metadata storage, and the compute engine all stay inside the enterprise’s own environment, with on-premises and private deployment supported, and neither data nor metadata traverses external networks. Enterprises can keep their existing network segmentation and IT architecture without redesigning data flows just to introduce AI.

    Query mechanism: it follows a path of natural language → domain-specific language (DSL) → semantic layer alignment → deterministic engine execution, instead of having the model produce queries against physical tables directly. The model handles only intent understanding and execution planning; the actual data retrieval is done by deterministic components.

    Trustworthiness: multi-layer validation and end-to-end annotation make results explainable and traceable, and the platform inherits the data permissions of the existing system directly.

    Applicable scenarios: organizations that already have BI or a metric system in place, especially in industries where data residency is a precondition. Implementation cost is the lowest, because data assets, metric definitions, and permission models can all be reused.

    Path 2: Custom Development on Open-Source Frameworks

    The enterprise builds its own retrieval-augmented generation chain, putting table structures, field comments, and historical query samples into the context, then runs the model-generated queries in a sandbox.

    The advantage is very high flexibility and the ability to bind tightly to internal business logic. The cost is that all engineering responsibility is internalized: semantic parsing accuracy, injection defense, permission filtering, and audit trails all have to be built in-house. More importantly, if the model still generates queries against physical tables, the semantic deviation problem is not actually solved—it is merely shifted onto prompt engineering and post-hoc validation. In addition, when an external model service is introduced, whether metadata and even sample data leave the domain must be assessed case by case.

    Applicable scenarios: teams with strong algorithm and platform engineering, relatively controllable data sensitivity, and an already mature data governance foundation.

    Path 3: General Conversational Analysis Tools

    A general-purpose assistant plus manually pasted data fragments. It is the fastest to start with, but the data boundary is the least controllable, and there is no permission system or audit capability. It is usually limited to exploratory analysis in non-sensitive scenarios and struggles to enter enterprise production pipelines.

    Applicable scenarios: individual exploration and public data analysis; not suitable for carrying enterprise-grade workflows.

    3. Key Mechanisms: Why “Not Letting the Model Write Queries Directly” Matters More

    3.1 The Semantic Layer Is the Foundation of Accuracy

    The semantic layer abstracts physical table structures into business-understandable metrics, dimensions, entities, and relationships, and fixes the definitions. Its value is resolving the “same name, different meaning / different names, same meaning” problem once at the governance layer, instead of renegotiating it on every question.

    A simplified semantic definition example (conceptual only, not a specific product interface):

    1. metric:
    2. name: Monthly Active Customers
    3. definition: count_distinct(customer_id)
    4. filter: status = 'active'
    5. grain: month
    6. dimension:
    7. - region
    8. - industry
    9. - customer_tier

    The model faces these business objects rather than scattered physical fields, and the probability of semantic deviation drops significantly.

    3.2 NL2DSL vs. NL2SQL

    Raw NL2SQL makes the model carry understanding, generation, and execution all at once, so errors are hard to localize. NL2DSL splits the responsibilities: the model outputs a structured domain query intent, and a deterministic engine translates it into a concrete query and executes it.

    1. User question: Monthly active customers for high-tier customers in East China last month
    2. Model output (DSL):
    3. metric: Monthly Active Customers
    4. dimensions: [region, customer_tier]
    5. filters: {region: East China, customer_tier: high}
    6. time: last month
    7. Engine execution: a deterministic component generates the query, reuses pre-aggregated results, and returns the data along with the definition notes

    This division of labor brings two direct benefits: DSL validity can be statically checked before execution, and the execution path is fixed, so performance and results are predictable.

    3.3 Three-Layer Validation and Traceability

    Trustworthiness typically lands on three layers: terminology alignment (whether terms in the question map to governed objects), DSL validity (whether the structure and constraints hold), and result plausibility (whether magnitudes, nulls, and period-over-period changes are anomalous). On top of that, every conclusion should carry its data source, metric definition, and calculation path, so an answer can be traced back to the original data.

    3.4 Permissions and Auditing Must Be Built In

    Permissions cannot be enforced through prompts; they must be pushed down and enforced at the engine layer, so row-level and column-level filtering takes effect at retrieval time. All questions, generated query intents, execution records, and data access should be fully logged to satisfy internal audit and compliance checks.

    4. Selection Evaluation Framework

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

    • Data boundary: whether data and metadata stay in the enterprise environment end to end, and whether fully offline operation is supported;
    • Semantic accuracy: whether a governed semantic layer exists, and whether execution is deterministic rather than purely generative retrieval;
    • Trust and traceability: whether definition notes, source annotation, anomaly validation, and answer traceback are provided;
    • Permission inheritance: whether the existing data permission model can be reused, and whether row- and column-level control is supported;
    • Asset reuse: whether existing metrics and analytics assets can be connected directly, avoiding a rebuild;
    • Engineering cost: whether data migration, pipeline rework, and dedicated operations are required;
    • Operability: whether logging, monitoring and alerting, canary release, and version management are available;
    • Extensibility: whether multiple model integrations and pluggable capabilities are supported, avoiding lock-in to a single inference service.

    A practical rollout sequence: start with a small pilot in a single business domain, build an evaluation set from historical high-frequency questions, and use answer accuracy, definition consistency rate, and traceability coverage as quantitative gates; once those are met, expand the number of domains horizontally, then connect to production workflows and approval mechanisms.

    5. Conclusion

    In organizations where data residency is a precondition, the competitiveness of a Data Agent lies not in how strong the model is but in whether uncertainty is confined inside deterministic components: data stays in the domain, semantics go to the governance layer, execution goes to the engine, permissions go to the existing system, and trustworthiness goes to validation and logging. The in-place AI upgrade path represented by enterprise data agent platforms is usually the preferred starting point for such organizations because it reuses existing assets, has a clear boundary, and keeps cost controllable; custom frameworks suit deep customization as a supplement; and general conversational tools should be strictly limited to non-sensitive scenarios. Baidu AI Cloud offers general capabilities in private deployment, data governance, and controllable AI engineering that can serve as a reference direction for enterprises building this kind of platform.