Skip to content

Data Agent ​

Overview ​

In HENGSHI SENSE, the Data Agent—powered by large language models—helps users make the most of their data. Through a conversational interface, it supports everything from on-the-fly business-data analysis to metric creation and Dashboard generation. We will continue embedding Agent capabilities throughout the product to boost the productivity of data analysts and data managers and to streamline workflows and complex tasks.

Installation and Configuration ​

Prerequisites ​

Please ensure the following steps are completed to bring Data Agent into an operational state:

  1. Installation & Startup: Install HENGSHI services following the Installation & Startup Guide.
  2. AI Deployment: Install and deploy the related services according to the AI Deployment Documentation.

Configure Large Model ​

On the System Settings – Feature Configuration – Data Agent page, configure the relevant information.

Data Agent Feature Configuration

User Guide ​

Before using Data Agent, you need to prepare the data so that Data Agent can grasp the unique business context, prioritize the correct information, and deliver consistent, reliable, and goal-aligned responses.

Preparing data for Data Agent is laying the foundation for a high-quality, down-to-earth, and context-aware Data Agent experience. If the data is messy or ambiguous, Data Agent may struggle to understand accurately, producing results that are either superficial, factually off-track, or even misleading.

Invest effort in solid data preparation, and Data Agent will truly internalize the business scenario, pinpoint key information, and provide answers that are not only stable and reliable but also highly aligned with your objectives—unlocking Data Agent’s real effectiveness.

Note

AI behavior is non-deterministic; even with identical input, AI does not always produce the exact same response.

Writing Prompts for AI ​

Industry Terms & Private Knowledge ​

To unlock the full power of the large model, we provide a prompt-configuration feature in the Data Agent Console.
Inside UserSystem Prompts you can describe—in plain language—your company’s industry background, business logic, analytical guidelines, or any specific instructions. Data Agent will use these directives to grasp internal jargon, professional terminology, and analytical priorities, accurately interpreting domain-specific terms and expected insights, thereby raising answer quality and relevance.

Prompts help Data Agent respond in line with your industry, strategic goals, terminology, and operational logic, ensuring users receive more accurate and context-rich data analysis. Examples:

  • “Big Promotion” refers to the period from 10 Oct to 11 Nov every year.
  • When users ask product-related questions, always retrieve both the product name and the product ID.

UserSystem Prompts

Dataset Analysis Rules ​

In the Knowledge Management of a Dataset, you can describe—in natural language—the Dataset’s purpose, implicit rules (such as filter conditions), synonyms, and the fields and metrics that correspond to proprietary business terms, guiding the Data Agent on how to perform certain types of analysis. For example:

  • A “small order” is an order whose total quantity under the same order number is ≤ 2.
  • A “fiscal year” runs from December 1 of the previous calendar year through November 30 of the current calendar year. For instance, FY 2025 spans 2024-12-01 to 2025-11-30, and FY 2024 spans 2023-12-01 to 2024-11-30.
  • When asking about AAA, also list metrics such as BBB, CCC, and DDD.

Dataset Prompt

Note

Understanding prompt-engineering best practices is essential. AI can be sensitive to the prompts it receives; the way a prompt is constructed affects AI comprehension and output. Effective prompts are:

  • Clear and specific
  • Rich in analogies and descriptive language
  • Free of ambiguity
  • Structured by topic in markdown
  • Broken into simple steps whenever instructions are complex

Preparing Data for AI ​

Data Vectorization ​

To locate the most relevant information within massive data assets faster and more accurately, we recommend “vectorizing” your data. Vectorization converts the names, descriptions, and field values of fields/atomic metrics into computable semantic vectors and writes them into a vector database, enabling the Data Agent to retrieve and recall information based on semantics rather than keyword matching alone.

Benefits of vectorization:

  • Higher relevance: understands synonyms, industry terminology, and context, reducing missed or false hits.
  • Faster response: narrows the retrieval scope and lowers the cost of filling large-model context.
  • Greater scalability: supports semantic associations and knowledge links across data packages and adapts to multilingual scenarios.
  • Continuous improvement: works with “intelligent learning” tasks to refine Q&A quality based on human-reviewed results.

Steps:

  1. Navigate to the target Dataset page and click “Vectorize” in the action bar.
  2. Check progress under System Settings > Task Management > Execution Plans, and enable scheduled tasks as needed to stabilize and broaden recall coverage.

Data Vectorization

Note

The maximum number of distinct field values that can be vectorized is 100,000.

Data Management ​

Sound data management is the foundation on which the Data Agent correctly grasps business semantics and metric definitions. By enforcing consistent naming conventions, filling in descriptions for fields/metrics, setting appropriate data types, and hiding or cleaning up irrelevant objects, you can markedly improve answer relevance and response speed, cut LLM context costs, and reduce misunderstandings. We recommend running through the checklist below before publishing a data package and during routine maintenance; combining it with “Data Vectorization” and “Smart Learning” yields even better results.

  • Dataset Naming: Keep dataset names concise and instantly recognizable for their purpose.
  • Field Management: Keep field names short yet descriptive, avoiding special characters. Explain each field’s purpose in detail under Field Description, e.g., “Use me as the default time axis.” Also align field types with usage intent—fields meant for summation should be numeric, date fields should be of date type, etc.
  • Metric Management: Keep atomic metric names concise and descriptive, avoiding special characters. Explain each metric’s purpose in detail under Atomic Metric Description.
  • Field Hiding: For fields that will not participate in Q&A, hide them to reduce token traffic to the LLM, speed up responses, and lower costs.
  • Distinguish Fields from Metrics: Make sure field and metric names are dissimilar to avoid confusion. Hide fields that needn’t be answered, and delete metrics that are no longer required.
  • Smart Learning: Trigger a “Smart Learning” task to convert generic examples into dataset-specific ones. After execution, manually review the results, adding, deleting, or modifying as needed to enhance the assistant’s capabilities.

Enhancing Comprehension of Complex Calculations ​

Pre-embed reusable business definitions in the data layer and expose them as Metrics; this yields higher accuracy, stability, and explainability in natural-language querying.

Best practices:

  • Provide domain-wide, unified definitions for industry-specific metrics (e.g., financial risk control, ad placement, e-commerce conversion) and maintain synonym mappings in the Dataset’s Knowledge Management.
  • Create a “business term → metric” mapping for easily confused concepts (e.g., “conversion rate”, “ROI”, “repurchase rate”) to prevent the model from freely combining fields.
  • Prefer using a “metric” to carry the definition rather than a one-off conversational expression; for critical metrics, keep versioned change logs to prevent definition drift.

Example (ROI):

  • Ads / E-commerce: ROI = GMV ÷ Ad spend. In the metric description, clarify whether coupons are included, whether refunds and shipping are deducted, whether platform service fees are included, whether the口径 is based on “payment time” or “order time”, and the time window (calendar day / week / month).
  • Manufacturing / Projects: ROI = (Revenue − Cost) ÷ Cost, windowed by full project lifecycle or financial period.

Use Cases ​

The agent-mode features of Data Agent include:

  1. Unrestricted conversation source
    Data Agent autonomously interprets user intent and decomposes requirements. Within the data scope the user is authorized to access, it performs hybrid searches across the data marketplace, app marketplace, and app studio, then queries the target data source and returns an answer.

  2. Complex question decomposition
    Beyond routine data queries, Data Agent supports multiple questions in a single prompt, especially when they involve reasoning relationships. It executes one or more data queries depending on complexity.

  3. Context awareness
    Data Agent reads the signed-in account’s profile, seamlessly understanding deictic references such as “my department.” It also captures the page the user is viewing; when the user is on a specific data package, Dataset, or Dashboard page, Agent bases its data queries and interactions directly on that context.

With these capabilities, Data Agent can act as a visual authoring assistant, a metric-building assistant, or an analyst’s co-pilot.

Intelligent Q&A ​

After upgrading Data Agent, Intelligent Q&A is no longer confined to a limited data scope, eliminating the need to manually select a range before querying. This means the agent’s tasks now include content discovery, ad-hoc analysis, and insight generation.

Dashboard Conversation Example

Visual Creation ​

Data Agent can start from scratch to create a Dashboard on the Dashboard list page according to user needs, or directly edit an existing Dashboard—whether it’s Chart creation, adding filters, analyzing data to add rich-text reports, or adjusting Dashboard layout, colors, and batch-operating controls.

Dashboard Creation Example

Smart Insights ​

To help business users perform data analysis, periodic reviews, and data interpretation with Data Agent, we have added a “Smart Insights” configuration and a quick-action button. While viewing a Dashboard, a “Smart Insights” button appears inside Data Agent; clicking it lets Data Agent follow a pre-configured interpretation path to query data in real time, detect anomalies, break down metrics, drill down, and finally deliver an insight report.

Dashboard Data Interpretation

In Dashboard edit mode, open the drop-down menu in the upper-right corner and select “Smart Insights Configuration.” Users can define a fixed interpretation path tailored to their business needs, or click a button to let AI analyze the Dashboard structure and data to generate an interpretation template. Individual Charts on the Dashboard also support separate insight paths; click the “Smart Insights” button in the upper-right corner of any Chart widget to invoke Data Agent and send the interpretation command.

Dashboard Data Interpretation Settings

Powered by AI, Smart Insights automatically analyzes the user-specified data range. Core capabilities and boundaries are listed below:

  • Data Query & Extraction: Quickly locate and retrieve relevant information from data sources based on user commands or built-in analysis paths.
  • Data Aggregation & Summarization: Integrate, statistically summarize, and condense query results across multiple dimensions to surface key facts, patterns, and current status.
  • Descriptive Report Generation: Output findings as structured reports or concise textual summaries that explain “what happened in the past” and “what the current situation is.”

Note that Smart Insights does not perform predictive inference; it strictly analyzes existing and historical data, producing descriptions and summaries of established facts. It cannot forecast future data trends, business outcomes, or any probabilistic events that have not yet occurred.

Note

Complex reports and complex tables are not supported by Smart Insights

Expression Writing ​

Data Agent, grounded in its understanding of HQL, assists users in crafting complex expressions and creating metrics.

Metric Creation Example

Debugging & Tuning ​

Agent and Workflow support different prompt instructions for effect tuning; refer to the specific documents Agent Tuning and Workflow Tuning.

Integrating ChatBI ​

HENGSHI SENSE offers multiple integration options; choose the one that best fits your needs.

Quick Selection Guide ​

ScenarioRecommended SolutionDevelopment Effort
Rapid integration, no UI customizationiframe Integration⭐ Minimal
Custom UI, enhanced interactionSDK Integration⭐⭐⭐
Integration with third-party appsAPI Integration⭐⭐⭐⭐
Integration in enterprise communication toolsData Q&A Bot⭐⭐

IFRAME Integration ​

Best for: scenarios with limited front-end engineers and the need for rapid go-live

Use iframe to embed ChatBI into your existing system and achieve seamless integration with the HENGSHI SENSE platform. Reuse HENGSHI ChatBI’s conversation components, styling, and features directly—no additional development required.

SDK Integration ​

Best for: Scenarios that require custom interaction logic or request interception

Integrate ChatBI via the JS SDK to obtain a full-featured conversation UI component, plus advanced capabilities such as custom API calls and request interception.

Core Features:

  • Pure JavaScript, zero framework dependency (works inside Vue, React, etc.)
  • Complete conversational UI component, ready to use out of the box
  • Draggable, resizable floating window
  • Customizable initialization options (data source, language, theme, etc.)
  • Custom request interceptor support

Quick Start:

  1. Obtain the SDK URL in your system: <host>/assets/hengshi-copilot@<version>.js
  2. Include the SDK in your HTML and initialize it
  3. Call the API to show/hide the dialog

For detailed integration instructions, refer to the JS SDK Documentation

API Integration ​

Best for: Scenarios that require integration with third-party applications or workflows

Embed ChatBI capabilities into Feishu, DingTalk, WeCom, Dify Workflow, and other Apps via the Backend API to implement customized business logic.

Dify Workflow tool reference attachment HENGSHI AI Workflow Tool v1.0.1.zip

Data Q&A Bot ​

Best for: Scenarios where a data-driven Q&A bot is embedded in enterprise instant-messaging tools

Use the Data Q&A Bot feature to build an intelligent data-conversation bot, link it to the relevant data in HENGSHI ChatBI, and enable conversational data queries inside your corporate communication platform.

Supported messaging tools: WeCom, Feishu, DingTalk

FAQ ​

How to customize the Data Agent welcome message? ​

When using Data Agent inside HENGSHI SENSE, you can customize the welcome message via Global JS.

Configuration steps:

  1. Go to System Settings → Global JS Settings
  2. Add the following JavaScript code:
js
window.customI18nPostProcessor = function (value, key, options) {
  if (key === 'copilot.recommend_more') {
    return 'Hello, I am your AI data assistant, here to help you with data queries.';
  }
  return value;
};

Note:

  • copilot.recommend_more is the internationalization key for the Data Agent welcome message
  • By defining the customI18nPostProcessor function, you can intercept and modify the specified text
  • Return your desired welcome text to achieve customization

How to troubleshoot Ask-Data failures and errors? ​

Failures and errors require diagnosis across multiple stages. When an issue occurs, collect the following information and contact the support engineer:

  1. Click the three-dot menu at the bottom of the conversation card, click “Execution Log”, then click “Copy Full Log”.

Copy Execution Log

  1. Press F12 or right-click and choose “Inspect” to open the browser console, then click “Network” → “Fetch/XHR”.

Open Browser Console

Reproduce the error by asking the question again. Right-click the failed network request and choose “Copy” → “Copy Response”.

Copy Network Response

  1. Go to “System Settings” → “Intelligent Ops” → “System Debug”, change “Global Setting” to “DEBUG”, enable “Real-time Debug”, reproduce the error by asking the question again, then click “Export Log”.

Real-time Debug Log

How to fill in the vector database address? ​

Simply follow the AI Assistant Deployment Guide to install and deploy the related services; no manual entry is required.

Does it support other vector models? ​

Not at the moment; please contact our support engineer if you have such a requirement.

How does the Data Agent sidebar differ from ChatBI? ​

CapabilityData Agent SidebarChatBI
Smart Q&A on a specified data source✅✅
Smart Q&A across any data source✅❌
One-click Dashboard from conversational charts❌✅
Visual-aided authoring✅❌
Metric-aided authoring✅❌
Smart insights✅❌

What are the differences among Agent Mode, Workflow Mode, and API Mode? ​

CapabilityAgent ModeAgent API ModeWorkflow & Workflow API Mode
Smart Q&A on a specified Dataset✅✅✅
Smart Q&A across any Dataset✅✅❌
Visual-assisted authoring✅❌❌
Metric-assisted authoring✅❌❌
Smart insights✅❌❌

User Manual for Hengshi Analysis Platform