Skip to content
Tencent DataBuddy: Semantic Layers Make Enterprise Data Agents Reliable

Tencent DataBuddy: Semantic Layers Make Enterprise Data Agents Reliable

This article analyzes Tencent's DataBuddy architecture to show how a business semantic layer — combining ontology and semantic models — enables reliable enterprise Data Agents by resolving metric ambiguity, ensuring consistent definitions, and compiling semantic SQL to physical SQL, moving beyond error-prone NL2SQL demos to production-grade analytics.

AI Large Model Application Practice
AI Large Model Application Practice
AI Large Model Application Practice

Overview

Since the advent of large language models, their application in big data has been highly anticipated — especially enabling decision-makers to query and analyze data directly without waiting for technical teams. The representative enterprise analytical Data Agent approach is NL2SQL (natural language to SQL), but domain knowledge gaps, complex data models, and analytical requirements cause high LLM hallucination rates.

This article examines Tencent's DataBuddy, a Data+AI product, to discuss enterprise Data Agent system architecture, focusing on the business semantic layer (ontology and semantic models) in ChatBI scenarios.

01 DataBuddy Capabilities and Architecture

DataBuddy is a cloud workspace for enterprise data teams and business users. Data teams prepare data sources, define business models, metrics, and definitions; business users perform natural-language querying and analysis — all assisted by AI Agents.

Three-Layer Architecture

DataBuddy architecture diagram
DataBuddy architecture diagram

Business Delivery Layer — Provides role-specific task capabilities via engineering, governance, and analysis Agents: data integration workflows, data quality governance, interactive analysis.

Capability Platform Layer — Handles multi-layer data warehouse processing (ODS to DW), data asset catalog management, and critically the business semantic layer — including business ontology, metric/dimension definitions, and lineage.

Storage Compute Layer — Stores raw data and provides batch compute engines for diverse sources: RDBMS, NoSQL, SaaS, messages, events, documents.

Identity & Permissions — Vertical defense via data security labels, risk identification, SQL protection, identity management, authorization, and Agent trace auditing.

Three Types of AI Agents

Data Engineering Agent — Data processing, integration, development: sync, incremental ingestion, SQL architecture, workflow development and scheduling, raw data cleansing, fact table generation, scheduled model updates.

Data Governance Agent — Detects and fixes data quality issues via uniqueness checks, profiling, lineage analysis, distribution change detection (duplicates, consistency, timeliness).

Data Analysis Agent — Converts natural language questions into analysis results by combining business semantic layer models, LLM reasoning, analysis skills, deterministic code and tools. This is the focus: how the semantic layer controls NL2SQL hallucinations and metric chaos.

Accuracy test with and without semantic layer
Accuracy test with and without semantic layer

Tencent test results showing accuracy improvement with semantic layer.

02 How Ontology and Semantic Models Make AI Analysis Accurate

Using DataBuddy's e-commerce retail agent as a test case, the article walks through how ontology and semantic models participate in analysis tasks — what the LLM does, how the semantic layer contributes, and the end-to-end process.

Business Ontology Definition

Business ontology relationships
Business ontology relationships

Defines core entities (Platform, Seller, Category, Product, Order, Order Item) and their relationships.

Semantic Model for Seller Operations & Category Performance

Semantic model diagram
Semantic model diagram

Defines metrics (GMV, Order Count) and dimensions for analysis.

Sample Analysis Question

"What are the monthly GMV and order counts for the platform from September 2016 to October 2018, and what is the overall trend?"

Why Traditional NL2SQL Fails

Metric ambiguity : Does GMV include shipping? Which order statuses count?

Time condition ambiguity : Monthly by order date or delivery date?

Multiple naming : Are "transaction amount", "sales", "GMV" the same?

Join duplication : Joining orders with order items may double-count.

Result : Same question asked multiple times yields completely different answers — non-determinism .

DataBuddy's Deterministic Process

DataBuddy processing steps
DataBuddy processing steps

Intent Parsing — Identify candidate concepts: "GMV", "order count", "monthly", time range.

Ontology Retrieval — Fetch business ontology to understand how "Order" is defined, its relationship to Product, synonyms.

Semantic Model Retrieval — Read published metric definitions (GMV, order count) and verify exact definitions. Example GMV definition shown in image.

Knowledge Query Tool — For complex needs (YoY, MoM, contribution analysis), LLM calls knowledge query tools to fetch guidelines and constraints. Further disambiguation via user clarification or expanded knowledge search.

Semantic SQL Query Tool — LLM now maps intent to explicit business meaning, selects metrics (GMV, distinct order count), granularity, time range, filters. Generates a semantic SQL (intermediate logical query) like:

SELECT month, GMV, distinct_order_count
FROM platform_sales
WHERE month BETWEEN '2016-09' AND '2018-10'
GROUP BY month

The semantic SQL engine compiles this to physical SQL for the target data warehouse and executes.

Physical SQL execution result
Physical SQL execution result

Result Analysis & Presentation — LLM organizes, explains, generates reports, chart configs. Agent can cite data sources, explain numbers. Complex analyses may loop multiple times, calling more semantic models and tools.

Determinism gains come from: Business meaning confirmed via ontology; metric definitions fixed by semantic model; LLM generates semantic SQL (intermediate), not raw SQL.

Component Responsibilities

Component responsibilities diagram
Component responsibilities diagram

Unified metrics — Consistent results across Agents, reports, apps regardless of phrasing or entry point.

Centralized knowledge maintenance — Verified semantic layer reusable even if underlying structures change; Agent focuses on intent understanding and process optimization.

Explainable results — System retains metric versions, query conditions, execution traces to answer "how was this number calculated?"

03 Building an Enterprise Data Agent System

DataBuddy's architectural reference: using governed business ontology and semantic layer to move Data+AI from demo to production-grade decision support. For enterprises with existing warehouses, reports, identity systems, a clear blueprint is essential to build internal Agent systems.

End-to-End Architecture

Enterprise Data Agent architecture
Enterprise Data Agent architecture

Data Foundation — Existing or new warehouse: production systems synced, cleansed, quality-checked into detail/dimension/summary layers. Distributed query engine handles filtering, joins, aggregation. Existing dev/integration platforms continue running.

Business Semantic Service — Core enhancement. Stores published ontology, metrics (graph DB). Combines BM25, vector indexes for semantic model retrieval. Provides semantic SQL engine : compiles semantic queries to physical SQL and executes.

Agent Runtime — Application layer. Harness manages task state, context, skills, tool calls. LLM provides understanding, planning, explanation via model gateway (self-hosted or approved public models) with unified quota, logging.

User Interaction — Frontend: native ChatBI, embedded Copilot, or integrated into office agents like WorkBuddy for seamless decision-maker collaboration.

Identity, Permissions, Audit — Cross-layer security: identity verification at entry, semantic-layer model visibility filtering, row/column-level data access control at execution, detailed trace for audit.

Building the Business Semantic Layer

Core tasks: semantic modeling, model storage/query, semantic SQL engine. Hardest part; ideal to leverage AI and open source:

Modeling Agent — Auto-scans warehouse metadata, objects, documents to draft cross-source ontology, relationships, metric drafts (declarative YAML semantic models). Human review, validation, test-run before publishing.

Modeling agent workflow
Modeling agent workflow

Recommended open-source projects: Helix Foundry and Cube .

Model Storage & Indexing — Persist entities, relationships, metric definitions, dimensions, lineage to graph DB and metadata catalog. Combine graph traversal, BM25, vector indexes for unified semantic model retrieval, recalling minimal model subset per task intent.

Semantic SQL Engine — Compiles parameterized semantic SQL to data-layer language. Key anti-hallucination barrier: LLM generates logical query against semantic layer, not raw SQL. Example semantic SQL compiled to physical SQL.

Semantic SQL to physical SQL compilation
Semantic SQL to physical SQL compilation

Reference implementation: Tencent's early open-source SuperSonic — complete pipeline: natural language → semantic retrieval → semantic SQL → physical SQL.

Building the Analytical Data Agent

With reliable semantic layer, analysis Agent becomes an autonomous planner that learns semantics and calls tools, not just NL2SQL.

Data analysis agent workflow
Data analysis agent workflow

Analysis Workflow — Use workflow orchestration frameworks (LangGraph, Google ADK) to build custom Harness, or customize existing open-source Harness (DSH, Codex-Harness) with custom analysis skills and tools. Core workflow consistent.

Controlled Tools — Agent must use tools for every semantic layer interaction:

Semantic Recall — Input task intent, call semantic layer retrieval, recall relevant ontology/metric subset (entities, relationships, definitions). Avoids stuffing full semantic layer into LLM. May combine with other knowledge-base tools.

Semantic SQL Query — Assemble structured parameters and semantic SQL based on locked metrics; semantic SQL engine compiles and executes physical SQL.

Chart Rendering — Generate and validate structured chart configs (e.g., ECharts) returned with data and conclusions for client-side rendering.

Analysis Sandbox — Isolated sandbox for local analysis/mining on retrieved data (via code): correlation, attribution, forecasting.

Integrating Data Agent into Office Agents

Embedding Data Agent into daily office agents (e.g., WorkBuddy) shortens access path, combines local data/tools, enables team collaboration.

WorkBuddy integration patterns
WorkBuddy integration patterns

MCP Connectors — Wrap semantic layer metric retrieval, ontology query, chart config, Data Agent analysis as standard MCP tools. WorkBuddy mounts MCP connector for natural conversation-driven analysis (with identity/permission handling).

Skill + CLI — For fixed analysis patterns (weekly review, funnel attribution), adopt Cube's cube-agent-skills: codify data retrieval specs and analysis SOPs as reusable Skills with lightweight CLI tools for WorkBuddy (more context-efficient than MCP).

MCP Apps — Using MCP-UI standard extension, deliver "UI-enabled" MCP tools: backend Data Agent returns interactive frontend UI running in sandbox iframe; users explore visualizations directly inside WorkBuddy.

04 Summary

This outlines a design blueprint and key technical considerations for self-built Data Agent architecture. Real-world construction requires balancing existing system state, actual analytical needs, team capability, cost, deployment constraints — choosing the most suitable approach.

Start with a controlled scope (e.g., customer and order operations where data is relatively complete), build the core business semantic layer, perfect the related querying and analysis capabilities. After accumulating experience and demonstrating value, gradually expand: broaden modeling scope, enhance Agent capabilities, ultimately building an enterprise-grade Data+AI agent system that truly "understands the business."

Closing illustration
Closing illustration
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Business Intelligencesemantic layerAI AgentText-to-SQLenterprise architectureNL2SQLontologyData AgentSemantic ModelDataBuddy
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.