Keeping Data Within Trust Boundaries: Architecture and Selection Guide for Enterprise Data Agents

    This article explains how to design and evaluate enterprise data agents when data must remain within a defined trust boundary. It covers three build paths, a reference architecture that separates understanding, authorization, and computation, constrained intermediate representations such as NL2DSL, private deployment checks across inference, retrieval, logging, caching, and backup, and a practical framework for evaluation and phased rollout.

    1. Define the Problem: Data Staying in the Domain Is Not the Same as Deploying the Service On-Premises

    An enterprise data agent connects natural language understanding, business semantic mapping, query execution, and analytical presentation. Users can ask questions such as “Why did sales decline this month?” or “Which regions have abnormal inventory turnover?” The system identifies the analytical goal, accesses authorized data, and generates an explanation or chart.

    In enterprise deployment, however, the most important question is often not whether the model can understand the question. It is whether the entire processing chain meets security and trust requirements.

    The “domain” in “data does not leave the domain” should be defined as an explicit trust boundary, such as an enterprise-owned data center, an approved dedicated environment, or a controlled network zone designated by the organization. To determine whether data leaves the domain, it is not enough to check where the database is located. You also need to examine model inference, vector retrieval, log collection, runtime monitoring, backup, and operations.

    Even if raw detail records never leave the database, the following information may still be sensitive:

    • Customer names, transaction amounts, and business events in user input;
    • Database schemas, field comments, and internal metric definitions;
    • Aggregated results, business trends, and anomaly explanations returned by queries;
    • Conversation history, cached content, and troubleshooting logs;
    • Text fragments, vector representations, and associated metadata produced by retrieval.

    Enterprises therefore need to turn “data does not leave the domain” into checkable requirements: which data may enter the model, which components may access the database, which network connections must be prohibited, and which personnel may view runtime records.

    2. Three Build Paths: Compare Capability Boundaries, Not Product Labels

    From a general architecture perspective, enterprises can usually build data agents along three paths. These paths are not fully mutually exclusive, and real projects can combine them.

    2.1 Add Intelligent Interaction to an Existing Business Analytics System

    This path builds natural language understanding and analytical orchestration on top of existing metrics, dimensions, reports, and permission systems.

    A user question is first converted into a constrained analytical expression, then mapped to an existing semantic model, and finally executed by a query or computation engine. The main value is reuse of mature data assets, reduced duplicate construction, and consistent metric definitions across different entry points.

    The prerequisite is that the enterprise already has a relatively stable business analytics system. If the same metric has multiple definitions across departments, or data permissions have not been standardized, adding intelligent interaction will not automatically solve these problems. It may instead expose conflicts faster.

    When evaluating this path, focus on semantic model coverage, completeness of permission inheritance, and how much manual configuration new business questions require. Do not judge solely by the question-answering performance shown in a demo.

    2.2 Build Data Applications with General Agent Orchestration

    This path connects models, retrieval, database queries, and other business services through workflow orchestration. It is suitable for rapid validation and for embedding data analysis into approval, alerting, and other workflows.

    Its advantage is workflow flexibility. Clarification, query, review, and result output can be explicitly configured as steps. However, general orchestration capability is not equivalent to enterprise-grade data governance. Metric definitions, query security, identity propagation, row- and column-level permissions, and auditing usually still require additional design.

    If a workflow allows the model to generate arbitrary queries and execute them directly, unauthorized queries, incorrect connections, or high resource consumption may occur even when the model service is deployed on-premises.

    This path suits scenarios with a clear business scope and a team with integration capabilities. After prototype validation, governance mechanisms should be added promptly. Experimental workflows should not be used directly for critical business decisions.

    2.3 Build a Dedicated Data Agent Service In-House

    This path requires the enterprise to implement intent recognition, semantic mapping, query planning, execution control, result explanation, and audit management itself.

    The advantage is that strict control mechanisms can be designed around specific business needs, complex network partitions, special data models, or highly customized analytical requirements. The cost is ongoing development and operations, including model adaptation, semantic asset maintenance, permission integration, test set construction, and exception handling.

    In-house construction should not be compared only on initial development cost. As database schemas, business definitions, and model versions change, the system requires continuous regression validation. Whether the organization has a long-term maintenance team is often more important than whether it can quickly complete a demo.

    3. Reference Architecture: Separate Understanding, Authorization, and Computation

    A controllable data agent can use the following logical chain:

    User identity and question
    → Intent recognition and necessary clarification
    → Business semantic mapping
    → Structured query plan
    → Permission and security validation
    → Query execution
    → Result validation
    → Analytical explanation and source display

    Models are well suited to language understanding, candidate semantic selection, and explanation organization. They should not be the sole basis for permission decisions or numerical computation.

    3.1 Entry Layer: Identity and Session Isolation

    Every request should be associated with a trusted identity that specifies the user’s organization, role, and accessible resources. The server must not accept identity claims generated by the model, and it should not rely only on prompts telling the model not to exceed permissions.

    When multiple users share a system, conversation history, result caches, and retrieval context must be isolated. If a cache key does not include the permission scope or the relevant version, the result of one question may be incorrectly reused for another user.

    3.2 Semantic Layer: Business Definitions

    The semantic layer needs to describe metric calculations, available dimensions, time definitions, join relationships, and applicable scope. For example, “sales” may mean order amount, collected amount, or net amount after refunds. “This month” may mean the calendar month or month-to-date.

    These differences cannot rely entirely on model guessing. For critical metrics, maintain business-approved definitions and record versions. When a user question cannot be mapped uniquely to a definition, the system should ask for clarification rather than provide a superficially complete answer.

    3.3 Execution Layer: Controlled Computation

    The execution layer reads data according to a validated plan and performs filtering, aggregation, sorting, and comparison. The model should not invent query results or generate apparently precise numbers when data is missing.

    Execution should also be limited by timeouts, concurrency, scan scope, and result count. Specific thresholds should be determined by data scale and business requirements, not copied from a demo environment.

    4. Natural Language to Query: Why a Constrained Intermediate Representation Matters

    Natural language to query statements, commonly called NL2SQL, is direct and flexible, but it can produce incorrect fields, incorrect joins, missing filters, or unreasonable aggregations.

    An alternative approach is to convert natural language first into a domain-specific language, or NL2DSL. Here, a domain-specific language can be a constrained structured analytical plan rather than a complex programming language. Its core goal is to limit expressible operations so that the model plans only within defined business boundaries.

    For example, the following is only an illustrative plan structure, not an interface from any specific platform:

    1. Analysis goal: Compare regional sales performance
    2. Metric: Net sales
    3. Dimension: Region
    4. Time range: Month to date
    5. Comparison baseline: Same date range in the previous month
    6. Sort order: By decline magnitude

    After receiving the plan, the server should separately check:

    1. Whether the metric exists and whether its definition applies to the current business context;
    2. Whether the dimension and metric are allowed to be combined;
    3. Whether the time range and comparison baseline are consistent;
    4. Whether the user is authorized to access the relevant data;
    5. Whether query cost is within the allowed range.

    This architecture can reduce the risk of the model directly manipulating underlying data structures, but it cannot eliminate all errors. The model may still choose the wrong metric, and the semantic model may still be misconfigured. The value of NL2DSL is therefore to improve constraint and verifiability, not to guarantee that every answer is inherently correct.

    Similarly, NL2SQL is not necessarily insecure. With read-only accounts, structured parsing, object whitelists, permission pushdown, and resource limits, it can also be a controlled option. Selection should compare actual control capabilities, not simply technical names.

    5. Private Deployment: Check the Complete Data Path

    Achieving a strict data boundary requires considering model services, retrieval services, query services, and their operational dependencies together.

    5.1 Inference and Retrieval Should Reside Within the Approved Boundary

    If business questions, field definitions, or query results are sent to external model services, it is not accurate to claim that this information always stays within the domain.

    Enterprises should check whether inference components have external dependencies such as automatic updates, telemetry, remote diagnostics, or external content retrieval. Retrieval services should follow the same principle. Vectorization should not be treated as automatic anonymization. Vector representations and associated information should still be protected according to data classification requirements.

    5.2 Network Controls Should Produce Verifiable Evidence

    Measures such as default-deny outbound connections, on-demand internal access, and restricted management entry points can reduce the risk of unintended data flows.

    Acceptance should not rely only on network topology diagrams. Connection records and audit logs should be used to verify whether normal queries, error handling, retries, and troubleshooting paths involve unauthorized external access.

    5.3 Logs, Caches, and Backups Are Also Governance Objects

    Recording full prompts, query results, or detail data for troubleshooting can create new copies of sensitive data. Logs should be collected as needed and configured with masking, access control, and retention periods.

    Caches and backups also need explicit storage locations, encryption requirements, access permissions, and cleanup mechanisms. Private deployment is only the starting point for governance. It does not mean that every internal component can access data without limits.

    6. Permissions and Trustworthiness: From “Can Answer” to “Can Be Verified”

    6.1 Permissions Must Be Enforced on the Server and in Data Execution

    A sound permission model usually includes resource access control, row-level filtering, column-level restrictions, and sensitive field handling.

    When reusing existing business analytics permissions, verify that identity mapping and permission semantics are consistent between the two systems. Visibility permissions in an existing report are not necessarily equal to query permissions on underlying data. Being able to view aggregated results does not mean being able to read related details.

    Tool calls must carry trusted identity context, and the server should reauthorize before query execution.

    6.2 Validation Should Cover Semantics, Structure, and Results

    Semantic validation confirms whether terms and definitions are correct. Structural validation determines whether a plan complies with constraints. Result validation identifies empty results, duplicate aggregation, abnormal orders of magnitude, and missing comparison baselines.

    Result validation can detect some anomalies, but it is not proof of business truth. For major business decisions, human review mechanisms should still be retained.

    6.3 Source Display Should Support Reproduction

    A reliable answer should at least state the metric definition, time range, filter conditions, data update time, and main calculation method. Internally, audit information such as semantic model version, authorization decisions, query plan, and execution status should also be retained.

    Auditing does not require exposing all underlying structures to users, nor does it require storing the model’s internal reasoning process. The key is to record external evidence sufficient to reconstruct the analytical process so that authorized personnel can verify the answer.

    7. Selection Evaluation: Build a Common Question Set Instead of Relying on Demos

    Enterprises should use a question set approved by business experts to test different options under the same conditions.

    Test coverage should include simple queries, multidimensional analysis, time comparisons, terminology ambiguity, empty results, permission boundaries, and high-cost queries. It should also include questions designed to induce unauthorized access and malicious instructions embedded in documents or data text, to check whether the system mistakenly treats retrieved content as control commands.

    Suggested evaluation dimensions include:

    • Business correctness: Whether the correct metric, time range, and aggregation method are selected;
    • Numerical consistency: Whether results match approved baseline calculations;
    • Clarification capability: Whether the system proactively confirms ambiguity;
    • Permission effectiveness: Whether unauthorized access is blocked;
    • Traceability: Whether query conditions and definitions can be reconstructed;
    • Runtime stability: Whether query latency, error rate, and resource consumption are acceptable;
    • Maintenance cost: How much work is required to add metrics, change definitions, and upgrade models.

    Evaluation reports should distinguish among “wrong answer,” “execution failure,” and “reasonable refusal.” For unauthorized requests or uncertain definitions, a correct refusal or clarification request is more suitable for production than forcing an answer.

    8. Implementation Path: Start with Controlled Pilots and Expand Gradually

    In the first phase, clarify the data boundary and business requirements, select high-frequency, low-risk questions with clear definitions, and establish human-confirmed baseline answers.

    In the second phase, build a minimal closed loop that connects identity authentication, semantic mapping, controlled queries, result display, and auditing. Even with limited coverage, the complete security mechanism should be in place.

    In the third phase, conduct security and performance validation, focusing on permission bypass, sensitive data leakage, abnormal outbound connections, cache cross-use, and high-cost queries.

    In the fourth phase, gradually expand metric and scenario coverage and establish ongoing governance processes. After metric definitions, data structures, or model versions change, regression tests should be rerun, with canary releases and rollback plans where necessary.

    For root-cause analysis questions, capability boundaries should also be explicit: the system can identify correlated changes and propose hypotheses to be tested, but query results alone usually cannot prove causality. Outputs should distinguish among data facts, computational conclusions, and analytical hypotheses.

    9. Conclusion: Choose a Verifiable Control System

    Selecting an enterprise data agent is essentially about balancing analytical flexibility, governance depth, and long-term maintenance cost.

    Enterprises with mature semantic assets can prioritize reuse of existing analytics systems. Teams that need to connect multiple business workflows quickly can adopt general orchestration, but must add permission and query governance. Organizations with special constraints and long-term development capabilities can consider a dedicated architecture.

    Whichever path is chosen, the same principles apply: the model is responsible for understanding and organization, the semantic layer for defining business logic, the permission system for restricting access, the execution engine for computation, and the audit system for preserving evidence.

    Data staying within the domain must ultimately be proven by the complete data path, controlled network connections, and verifiable runtime records. Whether answers are trustworthy must be supported by consistent definitions, deterministic execution, and continuous testing. Only when both sets of requirements are met can a data agent move from an experimental tool to an analytical capability suitable for enterprise production environments.