Building a Data Agent from Scratch
During daily operations and maintenance, engineers often face the challenges of large volumes of tickets, diverse types, and difficult analysis. Especially when needing to submit summary reports to clients or summarize the handling of a particular phase, traditional methods usually rely on manual statistics and analysis, which are time-consuming, labor-intensive, and prone to errors, severely impacting work efficiency and response speed.
To address this pain point, this tutorial will guide you through building a data source-driven ticket statistics and analysis assistant from scratch. Leveraging intelligent analytics, you can achieve automatic aggregation, categorized statistics, trend analysis, and other multi-dimensional processing of massive ticket data. Whether you need to quickly extract high-frequency issues, identify response bottlenecks, or generate visual reports for clients, this assistant will greatly enhance your operations team's data processing capabilities and service quality.
Data Source Preparation
In daily operations, the system regularly synchronizes ticket data to the enterprise database, forming a structured ticket record table. This data includes key information such as ticket ID, category, issue, processing status, response time, resolution duration, and more.
In this example, we will use the Data module to add a data source connected to the database for subsequent Agent analysis.
✅ Tip: For detailed data integration steps, refer to the "Data Preparation" section in "Quickly Build Sales Intelligence Analysis Reports".
- The data source created in this example is named
Microsoft Support
After ensuring the data source connection test passes and you can successfully preview the data, you can proceed to the next step of Agent creation.

Creating the Ticket Analytics Agent
Standard Creation
After integrating the data source, we will create an intelligent Agent using the standard method for automatic analysis and aggregation of ticket data.
✅ Tip: For the creation process, refer to the tutorial "Building a Simple Agent Assistant from Scratch".
In this example, the Agent we create is named Ticket Analytics. It is positioned as a data analysis assistant for operations personnel, capable of understanding user needs and automatically generating insightful reports and statistical results from the data.
The Agent creation interface is as follows:

Configuring the Ticket Analytics Agent
1. Prompt Configuration
- Enter a brief prompt in the Prompt input box.
- You can click "Smart Generate" to let the system automatically expand the prompt using the model, generating a more complete version.
- The prompt used in this example is:
## Role
You are a Ticket Analytics Specialist, dedicated to extracting, analyzing, and summarizing ticket data from various data sources to help users gain actionable insights into their ticketing operations.
## Skills
1. Retrieve and aggregate ticket information:
- Access ticket data from specified data sources, ensuring comprehensive coverage of all available tickets.
- Organize ticket data by relevant attributes such as status, category, time period, and assigned personnel for further analysis.
2. Perform ticket data analysis based on user requirements:
- Analyze total ticket volume, trends over time, or distribution by specific categories as requested by the user.
- Generate clear, concise summaries and visual representations (such as tables or charts) of ticket statistics to help users understand the results easily.
## Constraints
- Only discuss topics and perform analyses directly related to ticket data; do not address unrelated subjects.
- All outputs must be organized according to the specified structure and presented in English (en-US) language.

2. Greeting Configuration
- You can enter a custom greeting or click "Smart Generate" to automatically generate a welcome message.
- The greeting used in this example is:
Hello, I am Ticket Analytics, here to assist you with all your ticket analysis needs.
[How can I use Ticket Analytics to gain insights from my ticket data?] [What types of reports and analytics can you provide for my tickets?] [How can Ticket Analytics help improve my support team's performance?]

3. Model Group Settings
-
The model group (such as
General Modeling Group) is selected during Agent creation and will be automatically displayed here. -
You can switch as needed, but note:
- Model group contents may differ in different environments;
- Model group contents are pre-configured by the administrator;
- The
General Modeling Groupused in the example includes models:gpt-4.1,Qwen/Qwen3-32B.

4. Data Source Configuration
Configuring the data source is a key step to enable the Agent to access actual ticket data. Please complete the binding as follows:
- Click the "+" button to the right of the data source to open the data source selection popup;
- Find and select the previously prepared data source
Microsoft Supportfrom the list; - Click "Confirm" in the lower right corner to complete the data source binding;
- After returning to the configuration interface, confirm that the data source is correctly displayed in the Agent's configuration panel;
- Finally, click the "Publish" button in the upper right corner to ensure all settings take effect.
✅ After completing the above steps, the Agent will have access to the ticket data in the
support_logstable and can perform analysis and aggregation based on this data.


The final configuration effect is as follows:

Testing Q&A Effect
After configuring the data source, you can enter the Agent chat interface to test the effect of the ticket analysis assistant. Below is an example interaction process for this case:
-
Enter a natural language request in the chat box
帮我按照工单类型统计所有的工单数据并形成统计图表
As shown below:

- The Agent will first extract all ticket data from the data source and categorize and summarize it based on the
categoryfield, outputting the count statistics for each ticket type;

- Next, the system will automatically generate a bar chart based on the statistical data, visually displaying the comparison of ticket quantities by type to help users quickly identify high-frequency issue types;

- Below the chart, the system will also provide an Intelligent BI Analysis Area supporting the following functions:
- Data Preview: View the raw data used to generate the chart;
- Chart Editing: Switch the bar chart to a line chart, pie chart, etc., or customize the X and Y axis fields;
- SQL Query Viewing: View and copy the SQL query statement behind the current analysis for further analysis or reuse;
- View Data: Click to jump to the original data table view;
- Intelligent Insights: Click to let the system provide automated insights based on the current data, such as trend analysis, anomaly detection, etc.
Data Preview:

Chart Editing:

SQL Viewing:

The overall Q&A effect is as follows:
