Intelligent number asking method and system based on agent architecture

By using an intelligent data query method based on an intelligent agent architecture, the entire process of enterprise-level data query and analysis is automated, solving the problems of high usage threshold and insufficient process automation, improving data analysis efficiency and adaptability to multiple scenarios, and reducing enterprise deployment costs.

CN122045247APending Publication Date: 2026-05-15SI-TECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SI-TECH INFORMATION TECH CO LTD
Filing Date
2025-12-26
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing technologies have high barriers to entry in enterprise-level data query and analysis scenarios, insufficient process automation, lack of engineering support, poor adaptability to multiple scenarios, and cannot achieve a closed loop of 'query-analysis-visualization'. Furthermore, the tool collaboration mechanism is insufficient.

Method used

It adopts an agent-based architecture approach, which uses agent modules to parse user natural language requests, dynamically call data query, extraction, calculation and analysis and plot generation tools to achieve full-process automation, and combines secure access control and error backtracking mechanisms to support multi-data source adaptation.

Benefits of technology

It lowers the barrier to entry for non-technical users, improves data analysis efficiency, shortens response time, enhances adaptability to multiple scenarios and system stability, and reduces enterprise deployment costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122045247A_ABST
    Figure CN122045247A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent number asking method and system based on an intelligent agent architecture. The method comprises the steps that a user sends a natural language number asking request to an intelligent agent module through a front-end client; the intelligent agent module receives a natural language number asking request of a user, and analyzes the natural language number asking request in combination with a session context to obtain an intention containing a tool demand; the agent module calls a corresponding tool according to the intention and a priority strategy, preferentially executes a data query tool to obtain basic data, then triggers a data extraction, computational analysis or drawing generation tool as required, and updates a tool execution result to a session context in real time; and the agent module summarizes execution results of the tools, generates answers containing text analysis, structured data or image resource paths, and pushes the answers to the front-end client through the streaming interaction module. According to the method, full-process automatic processing of data query-statistical analysis-visual presentation is realized through natural language interaction, the use threshold of non-technical users is reduced, and the data analysis efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and data analysis technology, specifically to an intelligent data query method and system based on an intelligent agent architecture. Background Technology

[0002] In enterprise-level data application scenarios, data querying and analysis are core components supporting decision-making. Existing related technologies can be mainly divided into two categories: 1. Traditional BI (Business Intelligence) and Reporting Tools This type of technology relies on professional data modelers for data warehouse design and dimensional modeling, followed by developers writing SQL scripts or configuring visualization charts using reporting tools such as Tableau and Power BI. Its core components include a data warehouse, ETL tools, a reporting engine, and a front-end display module, with data flow rules between these modules requiring manual configuration. Users must obtain data through preset report templates or fixed query interfaces and cannot directly initiate personalized queries using natural language.

[0003] Traditional BI and reporting tools require high user skills, and non-technical personnel cannot independently complete personalized data queries; they rely on manual modeling and script writing, resulting in long response cycles; the modules are highly coupled, and adding new data sources or analysis dimensions requires redesigning the data chain, leading to poor scalability.

[0004] 2. Existing intelligent question-answering system These technologies are mostly based on large language models (LLMs) to achieve text interaction, enabling question-and-answer sessions on pre-set knowledge bases or simple data tables. Some systems integrate basic query functions, but lack tool collaboration mechanisms, only completing a single "natural language → text answer" process, unable to connect data query, computational analysis, and visualization generation stages. Their architecture typically includes an intent recognition module, a question-and-answer database, and a result generation module, with tool invocation capabilities limited to single query scenarios.

[0005] Existing intelligent question-answering systems lack a tool collaboration mechanism centered on intelligent agents, making it impossible to form a closed loop of "query-analysis-visualization"; their engineering capabilities are insufficient, with architectural vulnerabilities in areas such as front-end and back-end access control, session state management, and error backtracking; and their ability to adapt to multiple data sources is weak, making it difficult to be compatible with various storage types such as relational databases, cloud data warehouses, and time-series databases. Summary of the Invention

[0006] To address the problems of high usage threshold, insufficient process automation, lack of engineering support, and poor adaptability to multiple scenarios in existing technologies, this invention provides an intelligent data query method and system based on an intelligent agent architecture, specifically applied to enterprise-level data query and analysis scenarios. It achieves fully automated processing of "data query - statistical analysis - visualization presentation" through natural language interaction, reducing the usage threshold for non-technical users and improving data analysis efficiency.

[0007] This invention discloses an intelligent questioning method based on an intelligent agent architecture, comprising: Users send natural language question requests to the intelligent agent module through the front-end client; The intelligent agent module receives the user's natural language question request and, in conjunction with the conversation context, parses it to obtain the intent containing the tool requirement; The intelligent agent module calls the corresponding tools according to the intent and priority strategy. It first executes the data query tool to obtain basic data, and then triggers the data extraction, calculation and analysis or plot generation tools as needed. The tool execution results are updated to the session context in real time. The intelligent agent module aggregates the execution results of various tools, generates a response that includes text analysis, structured data, or image resource paths, and pushes it to the front-end client through the streaming interaction module.

[0008] As a further improvement to the present invention, it also includes: If the tool execution fails, the error backtracking module categorizes the exception, generates alternative solutions or readable prompts, and re-triggers the tool call process based on the session checkpoint.

[0009] As a further improvement to the present invention, it also includes: Before parsing the intent, the agent module first verifies the session identifier in the natural language query request through the API security proxy module. If the verification is successful, it combines the session context to parse the intent containing the tool requirement, so as to enable only the thread owner to access, thereby achieving session isolation and secure access control.

[0010] This invention also discloses an intelligent questioning system based on an agent architecture, comprising: The front-end client is used for users to input natural language questions and requests; The intelligent agent module is used to receive users' natural language question requests and, in conjunction with the conversation context, parse out the intent containing the tool requirement; The toolset component includes a data query tool, a data extraction tool, a computational analysis tool, and a secure drawing tool, which are used by the agent module for invocation. Specifically, the agent module invokes the corresponding tool according to the intent and priority strategy, prioritizing the execution of the data query tool to obtain basic data, and then triggering the data extraction tool, computational analysis tool, or drawing generation tool as needed. The tool execution results are updated to the session context in real time. The streaming interaction module is used to push the generated answer containing text analysis, structured data, or image resource paths to the front-end client after the agent module summarizes the execution results of various tools and generates an answer containing text analysis, structured data, or image resource paths.

[0011] As a further improvement to the present invention, it also includes: The error backtracking module is used to classify exceptions, generate alternative solutions or readable prompts when tool execution encounters an error, and re-trigger the tool call flow based on session checkpoints.

[0012] As a further improvement to the present invention, it also includes: The API security proxy module is used to verify the session identifier in the natural language query request. If the verification is successful, the intelligent agent module receives the user's natural language query request and, in combination with the session context, parses the intent containing the tool requirement.

[0013] As a further improvement of the present invention, the agent module is a ReAct agent, which is built based on a large language model (LLM), and its core functions include intent recognition, tool selection and context management.

[0014] As a further improvement of the present invention A data query tool that adapts to multiple data sources, generates query statements that conform to the data source syntax, and returns paginated / sampled structured results after execution; Data extraction tools are used to convert query results or data source schemas into a common DataFrame format and cache them in session storage; A computational analysis tool that receives a DataFrame and operation instructions, performs statistical calculations using Python code, and returns the analysis results. A secure drawing tool used to verify drawing code. After execution, it saves the image to object storage and returns the resource path accessible to the front-end client.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Significantly lower barrier to entry: Non-technical users can directly query and analyze data using natural language without needing to master SQL or programming skills. Compared with traditional BI tools, the number of user operation steps is reduced by more than 80%.

[0016] 2. Significantly improved query efficiency: The intelligent agent automatically orchestrates the entire process, eliminating the need for manual intervention in data modeling and script writing. Request response time is reduced from hours in traditional BI to minutes, and the average query time is reduced by 60%.

[0017] 3. Strong adaptability to multiple scenarios: It supports multiple data sources such as relational databases, cloud data warehouses, and time-series databases. It has been verified in scenarios such as telecom customer analysis, e-commerce sales statistics, and IoT device monitoring, with an accuracy rate of over 95%.

[0018] 4. Reduced enterprise deployment costs: Built-in secure access control and error rollback mechanisms reduce system failure rate by 40%; modular architecture reduces the development cycle of new features, reducing enterprise-level deployment costs by 35%.

[0019] 5. Significant scalability advantages: The toolset is decoupled from the intelligent agent, and the integration of new machine learning prediction tools can be completed in just 3 days, compared to the 2-week cycle of the existing system, which improves the scalability efficiency by 70%. Attached Figure Description

[0020] Figure 1 This is a framework diagram of the intelligent questioning system based on the intelligent agent architecture disclosed in this invention; Figure 2 This is a flowchart of the intelligent questioning method based on an intelligent agent architecture disclosed in this invention; Figure 3 A flowchart for selecting a state machine for the tool disclosed in this invention; Figure 4 This is a flowchart of the SQL synthesis and execution data disclosed in this invention; Figure 5 This is a flowchart of the drawing generation and front-end display process disclosed in this invention; Figure 6 This is the thread ownership and security routing diagram disclosed in this invention; Figure 7 This invention discloses error handling and backtracking attempts. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] The present invention will now be described in further detail with reference to the accompanying drawings: This invention provides an intelligent questioning method and system based on an intelligent agent architecture. It constructs an intelligent questioning system with the ReAct intelligent agent at its core, achieving end-to-end automated processing from natural language input to structured results and visualized charts through the collaboration of intelligent agent modules, toolkit components, and supporting mechanisms. Its purpose is: 1. Non-technical users can directly query and analyze data using natural language without needing to master SQL or programming skills; 2. Construct an agent-driven tool collaboration framework to automatically orchestrate the entire process of "data acquisition - processing - visualization"; 3. Improve engineering mechanisms such as secure access control and error rollback to reduce enterprise-level deployment costs; 4. Enables adaptation to multiple data sources, supporting analysis scenarios in multiple industries such as telecommunications, e-commerce, and the Internet of Things.

[0023] like Figure 1 As shown, this invention provides an intelligent query system based on an agent architecture, comprising: The front-end client is used for users to input natural language questions and requests; The intelligent agent module receives natural language queries from users and, combined with the conversation context, parses the intent containing the user's tool request; specifically: The agent module is the ReAct agent, which is built on a large language model (LLM). Its core functions include intent recognition, tool selection, and context management. Driven by strategic prompts, the agent follows a priority strategy of "data query → data extraction → computational analysis → plot generation," dynamically scheduling among four types of tools. Simultaneously, it maintains session-level context objects and updates tool execution results (such as SQL query results, DataFrame data, image paths, etc.) in real time.

[0024] The toolset component includes data query tools, data extraction tools, computational analysis tools, and secure plotting tools, which are invoked by the intelligent agent module. Specifically, the intelligent agent module invokes the corresponding tools according to intent and priority strategy, prioritizing the execution of the data query tool to obtain basic data, and then triggering the data extraction tool, computational analysis tool, or plotting tool as needed. The tool execution results are updated to the session context in real time. A data query tool that adapts to multiple data sources (relational databases, cloud data warehouses, time-series databases, etc.), generates query statements (SQL / NoSQL commands) that conform to the data source syntax, and returns paginated / sampled structured results (including data and summaries) after execution. Data extraction tools are used to convert query results or data source schemas into a common DataFrame format and cache them in session storage; furthermore, by setting a TTL expiration time, the efficiency of repeated queries can be improved. Computational analysis tools are used to receive DataFrames and operation instructions (such as aggregation, sorting, and indicator calculation), perform statistical operations through Python code, and return analysis results. A secure drawing tool used to verify drawing code (ensuring it contains fig / ax graphic objects), saves the image to object storage after execution, and returns a resource path accessible to the front-end client.

[0025] Supporting components include an API security proxy module, an error backtracking module, and a streaming interaction module; among them, The API security proxy module is used to verify the session identifier (sid) in the natural language query request. If the verification is successful, the intelligent agent module receives the user's natural language query request and, in combination with the session context, parses the intent containing the tool requirement to ensure that only the thread owner is allowed to access the system, thus guaranteeing session isolation and secure access control. The error backtracking module is used to classify exceptions when the tool execution is abnormal (permission error, SQL syntax error, code execution error, etc.), generate alternative solutions or readable prompts, and re-trigger the tool call flow based on session checkpoints; The streaming interaction module is used to push the generated answer containing text analysis, structured data, or image resource paths to the front-end client after the agent module summarizes the execution results of various tools and generates an answer containing text analysis, structured data, or image resource paths.

[0026] like Figure 2 As shown, this invention provides an intelligent questioning method based on an intelligent agent architecture, comprising: S1. The user sends a natural language question request to the intelligent agent module through the front-end client; S2, the API security proxy module verifies the session identifier in the natural language query request. If verification succeeds, S3 is executed; if verification fails, a permission error is returned. Figure 6 As shown; S3. The intelligent agent module receives the user's natural language question request and, in conjunction with the conversation context, parses out the intent containing the tool requirement; S4, such as Figures 3-5 As shown, the intelligent agent module invokes corresponding tools according to intent and priority strategy. It prioritizes executing data query tools to obtain basic data, and then triggers data extraction, calculation and analysis, or plotting tools as needed. Tool execution results are updated to the session context in real time. If a tool execution encounters an error, the error backtracking module categorizes the error, generates alternative solutions or readable prompts, and re-triggers the tool invocation process based on session checkpoints. Figure 6 As shown; S5 and the intelligent agent module aggregate the execution results of various tools, generate a response containing text analysis, structured data, or image resource paths, and push it to the front-end client through the streaming interaction module; for example... Figure 7 As shown.

[0027] Example 1: Comparative Analysis of New Customer Acquisition and Churn Rate in the Telecommunications Industry over the Past Three Months Experimental objective: To verify the system's ability to automate the entire natural language query process in a relational database scenario.

[0028] Experimental conditions: The data source is a MySQL database (including the customers table: customer ID, registration time; the subscriptions table: customer ID, subscription status, expiration time); the agent is built based on GPT-4; the front end uses the Vue.js framework.

[0029] Experimental steps: S11. The user inputs the natural language question "Comparison of new customers and churn rate in the past three months". The front end sends the question and the session ID (sid=20251113001) to the agent service.

[0030] S12, the agent resolves the intent (requires_sql=True), calls the data query tool to generate SQL: "SELECT DATE_FORMAT(c.register_time,'%Y-%m') AS month, COUNT(c.customer_id) AS new_customers, SUM(CASE WHEN s.expire_time BETWEEN '2025-08-13' AND '2025-11-13'THEN 1 ELSE 0 END) AS churned_customers FROM customers c LEFT JOINsubscriptions s ON c.customer_id = s.customer_id WHERE c.register_timeBETWEEN '2025-08-13' AND '2025-11-13' GROUP BY month;".

[0031] S13. Execute SQL and obtain results, update session context (new_customers: 500 in August, 620 in September, 480 in October; churned_customers: 80 in August, 95 in September, 70 in October).

[0032] S14. The agent determines that the churn rate needs to be calculated (requires_python=True), calls the calculation tool to execute the code: "df['churn_rate'] = df['churned_customers'] / df['new_customers'] * 100", and obtains the churn rate: 16% in August, 15.3% in September, and 14.6% in October.

[0033] S15. The agent's judgment needs to be visualized (requires_fig=True). Call the plotting tool to generate a dual-axis trend chart and save it in the path "images / telecom_churn_20251113.png".

[0034] S16. The agent integrates the results and returns a Markdown response containing text analysis ("The number of new customers in the past three months has shown a trend of first increasing and then decreasing, and the churn rate has continued to decline") and image paths.

[0035] S17. Front-end rendering of content, displaying text and trend charts.

[0036] Test results: The system took 45 seconds from receiving the request to returning the result. The query process was fully automated, and the accuracy of the results was consistent with that of manual SQL queries.

[0037] Example 2: Analysis of the Top 10 Daily Sales Volume Products in the E-commerce Industry Experimental objective: To verify the system's ability to perform complex queries and sorting in a cloud data warehouse scenario.

[0038] Test conditions: The data source is Alibaba Cloud MaxCompute data warehouse (including the orders table: order ID, product ID, order time, order amount; products table: product ID, product name, category); the query date is 2025-11-12.

[0039] Experimental steps: S21. The user inputs the question "Top 10 best-selling products and sales revenue on November 12, 2025", and the front end sends a request to the intelligent agent.

[0040] S22. The agent resolves the intent (requires_sql=True), calls the data query tool to generate MaxComputeSQL, and returns product sales and sales data after execution.

[0041] S23. Use the calculation and analysis tool to sort the data in descending order by sales volume and retrieve the top 10 data entries.

[0042] S24. Use the drawing tool to generate a horizontal bar chart (product name on the horizontal axis and sales volume on the vertical axis), and save it to "images / ecommerce_top10_20251112.png".

[0043] S25. Return an answer that includes a list and chart of the top 10 products.

[0044] Test results: The system took 58 seconds to process the data, the sales ranking accuracy was 100%, and the generated charts met user requirements.

[0045] The above are merely preferred embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A smart questioning method based on an agent architecture, characterized in that, include: Users send natural language question requests to the intelligent agent module through the front-end client; The intelligent agent module receives the user's natural language question request and, in conjunction with the conversation context, parses it to obtain the intent containing the tool requirement; The intelligent agent module calls the corresponding tools according to the intent and priority strategy. It first executes the data query tool to obtain basic data, and then triggers the data extraction, calculation and analysis or plot generation tools as needed. The tool execution results are updated to the session context in real time. The intelligent agent module aggregates the execution results of various tools, generates a response that includes text analysis, structured data, or image resource paths, and pushes it to the front-end client through the streaming interaction module.

2. The intelligent questioning method as described in claim 1, characterized in that, Also includes: If the tool execution fails, the error backtracking module categorizes the exception, generates alternative solutions or readable prompts, and re-triggers the tool call process based on the session checkpoint.

3. The intelligent questioning method as described in claim 1, characterized in that, Also includes: Before parsing the intent, the intelligent agent module first verifies the session identifier in the natural language query request through the API security proxy module; If the verification passes, the intent containing the tool requirement is parsed by combining the session context.

4. An intelligent questioning system based on an agent architecture, used to implement the intelligent questioning method as described in any one of claims 1 to 3, characterized in that, include: The front-end client is used for users to input natural language questions and requests; The intelligent agent module is used to receive users' natural language question requests and, in conjunction with the conversation context, parse out the intent containing the tool requirement; The toolset component includes a data query tool, a data extraction tool, a computational analysis tool, and a secure drawing tool, which are used by the agent module for invocation. Specifically, the agent module invokes the corresponding tool according to the intent and priority strategy, prioritizing the execution of the data query tool to obtain basic data, and then triggering the data extraction tool, computational analysis tool, or drawing generation tool as needed. The tool execution results are updated to the session context in real time. The streaming interaction module is used to push the generated answer containing text analysis, structured data, or image resource paths to the front-end client after the agent module summarizes the execution results of various tools and generates an answer containing text analysis, structured data, or image resource paths.

5. The intelligent questioning system as described in claim 4, characterized in that, Also includes: The error backtracking module is used to classify exceptions, generate alternative solutions or readable prompts when tool execution encounters an error, and re-trigger the tool call flow based on session checkpoints.

6. The intelligent questioning system as described in claim 4, characterized in that, Also includes: The API security proxy module is used to verify the session identifier in natural language query requests; If the verification is successful, the intelligent agent module will receive the user's natural language question request and, in conjunction with the conversation context, parse out the intent containing the tool requirement.

7. The intelligent questioning system as described in claim 4, characterized in that, The agent module is the ReAct agent, which is built on a large language model. Its core functions include intent recognition, tool selection, and context management.

8. The intelligent questioning system as described in claim 4, characterized in that, A data query tool that adapts to multiple data sources, generates query statements that conform to the data source syntax, and returns paginated / sampled structured results after execution; Data extraction tools are used to convert query results or data source schemas into a common DataFrame format and cache them in session storage; A computational analysis tool that receives a DataFrame and operation instructions, performs statistical calculations using Python code, and returns the analysis results. A secure drawing tool used to verify drawing code. After execution, it saves the image to object storage and returns the resource path accessible to the front-end client.