Agent-based data processing method, system, device and program product
Through dynamic task planning by intelligent agents and execution by collaborative intelligent agents, the problem of inefficient data processing caused by manual operations is solved, and efficient data processing and risk reduction are achieved.
Patent Information
- Application Number
- CN202510072396.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-01-17
AI Technical Summary
Existing data observation and analysis technologies rely on manual operations, resulting in inefficient data processing and difficulty in uncovering potential risks behind the data.
An agent-based data processing method is adopted to perform dynamic task planning through planning agents, select collaborative agents to implement subtasks, and iterate until the task end conditions are met to generate the final result.
It achieves efficient data processing without manual operation, improves data processing efficiency, enables insight into the value behind the data, and reduces potential risks.
Smart Images

Figure CN119494361B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an agent-based data processing method, system, device, and program product. Background Art
[0002] Currently, data observation and analysis technologies are primarily implemented manually or semi-automatically. These methods involve manual data extraction, manual or model-based analysis of data extracted from data platforms, and then entering the results into specified templates to generate reports. This traditional approach relies on extensive manual labor, a long overall process, and multiple inputs. Intermediary steps rely on operator experience and are unable to identify potential risks within the data, resulting in high data processing difficulty and low efficiency. Summary of the Invention
[0003] In view of this, the embodiments of the present application provide a data processing method, system, device and program product based on an intelligent agent, which does not rely on manual operation. The user only needs to give an instruction to complete autonomous task planning through the intelligent agent, effectively reducing the difficulty of operation and improving data processing efficiency.
[0004] A first aspect of an embodiment of the present application provides an agent-based data processing method, comprising:
[0005] Get the task description information of the specified task;
[0006] Performing dynamic task planning on the task description information through a planning agent to generate subtasks;
[0007] Selecting a designated collaborative agent that is adapted to the subtask from a plurality of collaborative agents, and implementing the subtask through the designated collaborative agent to obtain a subtask result;
[0008] New task description information is determined based on the subtask result, the dynamic task planning is iteratively executed until it is confirmed that the designated task meets the end condition, and the task result of the designated task is output.
[0009] In an implementation of the first aspect, performing dynamic task planning on the task description information by a planning agent to generate subtasks includes:
[0010] Performing intention recognition on the task description information by a planning agent to obtain a recognition result;
[0011] Based on the recognition result, generating a subtask to be executed;
[0012] The task content of the subtask includes thinking, action and action input; the thinking is used to describe the task information of the subtask, the action indicates the data processing operation required for the subtask, and the action input indicates the data required to execute the action.
[0013] In an implementation of the first aspect, the step of implementing the subtask by the designated collaborative agent to obtain a subtask result includes:
[0014] Extracting a prompt word template adapted to the subtask from a prompt word template library through the designated collaborative agent;
[0015] rewriting the prompt word based on the task description information, the prompt word template, and the action input of the subtask to obtain the specified template content;
[0016] Based on the specified template content, the subtask is implemented to obtain a subtask result.
[0017] In an implementation of the first aspect, rewriting the prompt word based on the task description information, the prompt word template, and the action input of the subtask to obtain the specified template content includes:
[0018] Obtaining the position to be filled in the prompt word template;
[0019] Determining filling content based on the task description information and the action input of the subtask;
[0020] Fill the filling content into the position to be filled to obtain the specified template content.
[0021] In an implementation of the first aspect, performing the subtask based on the specified template content to obtain the subtask result includes:
[0022] Identifying the execution type of the action of the subtask;
[0023] If the execution type is indirect execution, the specified tool is called to execute the subtask and obtain the subtask result;
[0024] If the execution type is direct execution, the subtask is directly executed to obtain the subtask result.
[0025] In an implementation of the first aspect, the method further includes:
[0026] For the first round of dynamic task planning, the input information for the specified task is determined as task description information;
[0027] For non-first-round dynamic task planning, task description information is determined based on input information for a specified task and task history information, where the task history information is stored in a memory.
[0028] In an implementation of the first aspect, the plurality of collaborative agents include a data analysis agent, a data retrieval agent, and a report generation agent.
[0029] The data retrieval agent is used to perform database retrieval or real-time data retrieval according to the data retrieval task instructions generated by the planning agent to obtain retrieval results;
[0030] The data analysis agent is used to analyze the data analysis instructions generated by the planning agent using the search results of the search agent to obtain analysis results;
[0031] The report generation agent is used to generate task instructions based on the report generated by the planning agent, and generate a multi-dimensional report in a preset format in combination with the analysis results of the data analysis agent.
[0032] A second aspect of an embodiment of the present application provides an agent-based data processing device, comprising:
[0033] The acquisition module is used to obtain the task description information of the specified task;
[0034] A dynamic planning module, configured to perform dynamic task planning on the task description information through a planning agent to generate subtasks;
[0035] An implementation module is used to select a designated collaborative agent adapted to the subtask from a plurality of collaborative agents, and implement the subtask through the designated collaborative agent to obtain a subtask result;
[0036] The iteration module is used to determine new task description information based on the subtask result, iteratively execute the dynamic task planning until it is confirmed that the designated task meets the end condition, and output the task result of the designated task.
[0037] A third aspect of the embodiments of the present application provides an agent-based data processing system, the data processing system comprising a planning agent and a plurality of collaborative agents;
[0038] The planning agent is used to perform dynamic task planning on the task description information of the specified task, generate subtasks, and select a specified collaborative agent adapted to the subtask from at least two collaborative agents;
[0039] The designated collaborative agent is used to implement the subtask and obtain the subtask result;
[0040] The planning agent is further used to determine new task description information based on the subtask results, iteratively execute the dynamic task planning until it is confirmed that the designated task meets the end conditions, and output the task results of the designated task.
[0041] A fourth aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the computer device implements the method described in the first aspect above.
[0042] A fifth aspect of the embodiments of the present application provides a computer program product, including a computer program, which, when executed, executes the method described in the first aspect above.
[0043] A sixth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect above is implemented.
[0044] The first aspect of this application embodiment does not require fixed orchestration. Different agents are called according to task requirements. At the same time, combined with the task feedback of collaborative agents, the required collaborative agents are dynamically planned and adjusted to handle different tasks. At the same time, by combining data with large models for analysis, the value behind the data can be understood, effectively improving data processing efficiency.
[0045] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0047] Figure 1 is a system structure diagram of an agent-based data processing system provided in an embodiment of the present application;
[0048] Figure 2 This is a flowchart of an implementation of an agent-based data processing method provided in an embodiment of the present application;
[0049] Figure 3 This is a flowchart of the implementation method of the subtask provided in the embodiment of the present application;
[0050] Figure 4This is a flowchart of a method for determining the content of a specified template provided in an embodiment of the present application;
[0051] Figure 5 This is a flowchart of different implementation methods of subtasks provided in the embodiments of the present application;
[0052] Figure 6 This is an example diagram of the agent-based data processing method provided in an embodiment of the present application;
[0053] Figure 7 is another example diagram of the agent-based data processing method provided in an embodiment of the present application;
[0054] Figure 8 is a schematic diagram of an agent-based data processing device provided in an embodiment of the present application;
[0055] Figure 9 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0057] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0058] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0059] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0060] In one embodiment, Figure 1 As shown, a system structure of an agent-based data processing system is provided. The data processing system is a multi-agent system, which is a system composed of multiple interacting agents. These agents can be software programs, robots, sensors or any entities that can perceive the environment and make decisions. In a multi-agent system, each agent has its own goals and capabilities, and they can communicate and collaborate with each other to solve complex problems or complete specific tasks. In the embodiment of the present application, the agent-based data processing system includes a planning agent and multiple collaborative agents. Among them, the planning agent is responsible for dynamic task planning, calling each collaborative agent in the collaborative agent pool, and dynamically planning the next task based on the result feedback of each collaborative agent processing the corresponding task. The collaborative agent is an agent that completes the specific implementation task. The task processing functions implemented by different collaborative agents are different. The number of collaborative agents is related to the actual processing requirements. The embodiment of the present application does not limit the number of collaborative agents and the functions they implement.
[0061] In applications, for a complete data processing (analysis or detection) process, the collaborative agent pool includes at least a search agent, a data analysis agent, and a report generation agent. For more complex data processing processes, the collaborative agent pool may also include sentiment analysis agents, chart agents, intent recognition agents, entity recognition agents, and more.
[0062] The retrieval agent (Agent Retrieval) is used for data retrieval, relying on two data sources: relational data, structured data, time series data, and other data stored in data centers, as well as non-real-time data stored in databases; and real-time data collected at the edge or in the cloud. The data analysis agent (Agent Data-Analysis) is used for data analysis, utilizing the data provided by the retrieval agent and combining it with data analysis task instructions. The report generation agent (AgentReporter) is responsible for generating intelligent reports, producing multi-dimensional reports containing text, tables, charts, and other information based on the data analysis results.
[0063] In one embodiment, Figure 2 As shown, an agent-based data processing method is provided, which is described by taking the method applied to a computer device as an example, and includes the following steps S101 to S104:
[0064] Step S101: Obtain task description information of a specified task.
[0065] In the application, a specified task is to use Figure 1 The agent-based data processing system shown performs data processing tasks, and the specified task is usually composed of multiple subtasks. The execution order between subtasks can be determined by dynamic planning through the planning agent. The task description information describes the data processing requirements of the specified task. For example, the task description information of the specified task is "whether there are security anomalies from 1:01 to 13:00 on September 3, 24". After analysis, it can be determined that the subtasks included in the specified task can be at least data analysis subtasks, data retrieval subtasks and report generation subtasks. The data analysis subtask can analyze the intention of the specified task to determine whether there are security anomalies within a specific range. The data retrieval subtask is to query the data from "1:01 to 13:00 on September 3, 24".
[0066] In one embodiment, if the current round of dynamic task planning is the first round, the task description information is entered using the visual interface. If the current round of dynamic task planning is not the first round, the task description information is determined by reading the task history information from the memory. A given task typically consists of at least two sequentially executed subtasks. Memory is a cache space used to store data after different agents execute, such as execution results, execution status, observations, and historical interaction information.
[0067] Step S102: Dynamically plan the task description information through a planning agent to generate subtasks.
[0068] In applications, a subtask is the process of implementing a specified task, and dynamic task planning refers to the process of determining the next task. For multiple subtasks within a given task, the execution order is determined by a planning agent through dynamic task planning based on the actual requirements of the specified task. An agent-based data processing system consists of only one planning agent, which performs at least one round of dynamic task planning on the task description to generate subtasks. Subtasks include a thought, an action type, and an action input.
[0069] The action input is the execution result of the previous action. If the current dynamic task planning is the first round, the action input is the task description information entered by the user.
[0070] Step S103: Select a designated collaborative agent that is adapted to the subtask from at least two collaborative agents, and execute the action to be executed by the designated collaborative agent to obtain an action execution result.
[0071] In the application, the planning agent determines the task type of the subtask based on the action type (Action). Based on the matching relationship between the preset task type and the collaborative agent, it selects a designated collaborative agent for the current subtask from at least two collaborative agents. This designated collaborative agent is called to implement the subtask, obtaining a subtask result. The essence of implementing a subtask is executing the subtask action (Action). The subtask result is essentially the result of executing the subtask action. For example, the subtask result of a data retrieval subtask is the data retrieved from different data sources.
[0072] Exemplarily, the task content of the subtask is in the following format: {Thought: “×××” Action: analyzing_query, Action input: {“query”: “×××”}}, it can be determined that the task type of the subtask is the data analysis subtask analyzing_query, and the collaborative agent associated with the preset setting “analyzing_query” is the data analysis agent, then the data analysis agent can be determined as the designated collaborative agent for implementing the subtask.
[0073] Step 104 : Determine new task description information based on the subtask results, iterate and execute dynamic task planning until it is confirmed that the designated task meets the termination condition, and output the task result of the designated task.
[0074] In the application, after a subtask of the specified task is completed and the subtask result is obtained, if the specified task has not reached the end condition, new task description information for the next round of dynamic task planning is determined based on the subtask result. The subtask result is the task result of the previous subtask of the next subtask to be executed, and belongs to historical task information relative to the next subtask to be executed. The planning agent executes dynamic task planning again according to the new task description information to generate the next subtask to be executed. The dynamic task planning process is iterated until the specified task reaches the end condition. The end condition of the specified task can be determined by the identification information of the collaborative agent. If the collaborative agent that implements the subtask carries an end identifier, the subtask is the last subtask of the specified task. After the last subtask is executed, the specified task is completed and the task result of the specified task is output.
[0075] This embodiment eliminates the need for fixed orchestration. Instead, different agents are deployed based on task requirements. In combination with feedback from collaborative agents, dynamic planning and adjustment of the required collaborative agents are performed to handle different tasks. Furthermore, data analysis combined with large models provides insights into the value behind the data.
[0076] In one embodiment, the implementation process of step S102 is as follows: the planning agent performs intent recognition on the task description information to obtain a recognition result; based on the recognition result, a subtask to be executed is generated; wherein the task content of the subtask includes thinking, action and action input; thinking is used to describe the task information of the subtask, the action indicates the data processing operation required for the subtask, and the action input indicates the data required to perform the action.
[0077] In applications, the planning agent first performs intent recognition on the task description information, generating a recognition result that represents the intent of the specified task. This recognition result is typically presented in a pre-set format. The planning agent then parses the recognition result and, according to the subtask content format, populates the three elements of the subtask: thought, action, and action input. It should be noted that for the first round of dynamic task planning, the action input is the task description information. For non-first round dynamic task planning, the action input is determined based on the task description information and historical task information.
[0078] In this embodiment, the planning agent identifies the intent of the task description and generates subtasks based on this intent, including thoughts, actions, and action inputs. This effectively improves the accuracy and efficiency of task processing. This approach not only helps clarify the specific requirements of the task but also ensures that every step in the data processing process is accurate, thereby improving the automation level and reliability of the overall workflow.
[0079] In one embodiment, Figure 3As shown, the implementation process of step S104 includes the following steps S201 to S203:
[0080] Step S201 : extracting a prompt word template adapted to the subtask from a prompt word template library by specifying a collaborative agent.
[0081] In the application, the prompt template library includes multiple different types of prompt templates, providing different prompt templates for different subtasks. The designated collaborative agent responsible for implementing the subtask can search the prompt template library for the appropriate subtask. A prompt template includes at least one fill-in position. The prompt template format can be customized based on task requirements and the tool library.
[0082] Step S202: rewrite the prompt word based on the task description information, the prompt word template and the action input of the subtask to obtain the specified template content.
[0083] In the application, fill-in content is selected from the task description and the action input of the pending action (i.e., the action execution result of the current action). Based on the correspondence between the fill-in content and the fill-in position, the fill-in content is filled into the to-be-filled position to perform a prompt word rewrite operation, thereby obtaining the specified template content. For example, the data analysis agent extracts the corresponding analysis prompt word template from the prompt word management module and rewrites the prompt word template by combining the question and action input provided by the planning agent with the corresponding prompt word template. The search agent extracts the corresponding search prompt word template from the prompt word management module and rewrites the prompt word template by combining the question and action input provided by the planning agent with the corresponding prompt word template. The data analysis agent extracts the corresponding data analysis prompt word template from the prompt word management module and rewrites the prompt word template by combining the question and action input provided by the planning agent with the corresponding prompt word template. The report generation agent extracts the corresponding report prompt word template from the report generation prompt word management module and rewrites the prompt word template by combining the question and action input provided by the planning agent with the corresponding report generation, thereby obtaining the specified template content. For example, as shown in Table 1,
[0084] Table 1
[0085]
[0086] In Table 1, {question} and {context} are the filling positions to be filled, "Are there any security anomalies from 1:01 to 13:00 on September 3, 24?" and "*****" are the filling contents. By filling the filling contents into the filling positions in the prompt word template, the prompt word rewriting operation for the prompt word template can be implemented to obtain the rewritten template, that is, the specified template content.
[0087] Step S203: Implement the subtask based on the specified template content and obtain the subtask result.
[0088] In the application, the specified collaborative agent and the specified template content are called to execute the corresponding pending actions and obtain the action execution results.
[0089] In this embodiment, by extracting an adapted prompt word template from the prompt word template library, and rewriting the prompt word based on the task description information, prompt word template and subtask action input, the subtask is finally implemented and the result is obtained according to the specified template content, which effectively improves the flexibility and accuracy of task execution. It not only optimizes the task processing flow and ensures the consistency and standardization of task execution, but also reduces human errors through intelligent means, thereby improving work efficiency and quality.
[0090] In one embodiment, Figure 4 As shown, the implementation process of step S202 includes the following steps S301 to S303:
[0091] Step S301: obtaining the position to be filled in the prompt word template.
[0092] In the application, the prompt word template adapted to each collaborative agent has preset positions to be filled in. When rewriting the prompt word template, the positions to be filled in the prompt word template are first obtained.
[0093] Step S302: Determine the filling content based on the task description information and the action input of the subtask.
[0094] In the application, filter and fill content from the task description information and the action input of the action to be performed.
[0095] Step S303: Fill the filling content into the position to be filled to obtain the specified template content.
[0096] In the application, the obtained filling content is filled into the position to be filled to obtain the specified template content.
[0097] In this embodiment, by obtaining the unfilled positions in the prompt word template, combining the task description information and the subtask action input to determine the fill-in content, and then filling this content into the unfilled positions to generate the specified template content, this process significantly enhances the personalization and precision of task execution. Not only does it ensure the clarity and specificity of task instructions, but it also improves the efficiency and success rate of task processing by automatically generating prompt words suitable for specific task requirements.
[0098] In one embodiment, Figure 5 As shown, the implementation process of step S103 includes the following steps S401 to S403:
[0099] Step S401: Identify the execution type of the action of the subtask.
[0100] In applications, the planning agent generates subtasks through dynamic planning. The execution types of actions for these subtasks are categorized into two types: indirect and direct. Indirect execution requires the use of a specific tool in the tool library to assist in executing the action. Direct execution refers to actions that can be executed directly without relying on the tool library. For example, a report can be generated directly based on the results (Observations) of the previous action. The tool library includes a variety of callable tools, such as slot extraction tools, data retrieval tools, result analysis tools, sentiment analysis tools, chart generation tools, and code parsing tools.
[0101] It should be noted that whether it is necessary to call the tools in the tool library when executing the action to be executed needs to be determined in combination with the specific business, and the embodiments of the present application do not limit this.
[0102] Step S402: If the execution type is indirect execution, a designated tool is called to execute the subtask and obtain a subtask result.
[0103] In an application, if the execution type is indirect, the tool adapted to the action type is called to execute the action and obtain the result of the action execution. The tools in the tool library are composed of callable programs. In terms of tool calling methods, they can be divided into local deployment calling and online deployment calling. In terms of tool functionality, tools can be built according to business needs, such as slot extraction tools, intent recognition tools, and sentence component multi-round completion tools. If data extraction is required, the retrieval agent calls the data extraction tool to extract data; if problem analysis is required, the data analysis agent calls the problem analysis tool (analyzing_query) to analyze the specific problem; if image generation is required, the report generation agent calls the chart generation tool to generate the corresponding chart. There is a corresponding relationship between the specified tool and the collaborative agent that performs the subtask.
[0104] Step S403: If the execution type is direct execution, the subtask is directly executed to obtain the subtask result.
[0105] In the application, if the execution type of the subtask action is direct execution, the designated collaborative agent can directly execute the subtask action and obtain the subtask result.
[0106] In this embodiment, subtasks are implemented based on the content of a specified template. The execution method is determined by identifying the execution type of the subtask action: if it is indirect execution, the specified tool is called to complete the task; if it is direct execution, the task is processed directly. This not only improves the flexibility and adaptability of task execution, but also ensures that different types of tasks can be completed efficiently and accurately, thereby optimizing the entire task management process.
[0107] In one embodiment, the multiple collaborative agents in the agent-based data processing system include a data analysis agent, a data retrieval agent, and a report generation agent, wherein the data retrieval agent is used to perform database retrieval or real-time data retrieval according to the data retrieval task instructions generated by the planning agent to obtain retrieval results; the data analysis agent is used to perform analysis using the retrieval results of the retrieval agent according to the data analysis instructions generated by the planning agent to obtain analysis results; the report generation agent is used to generate a multidimensional report in a preset format according to the report generation task instructions generated by the planning agent and the analysis results of the data analysis agent.
[0108] In the application, when a user makes a request, the planning agent decomposes the request into tasks and plans the specific tasks to be performed. Different collaborative agents are responsible for executing different tasks.
[0109] In applications, when data needs to be retrieved, the task instructions are rewritten using prompt word templates and given to the retrieval agent. The retrieval agent then performs non-real-time data queries from the database or real-time data queries from the edge and cloud. The retrieved data is saved to memory, and the memory module provides the retrieval results to the planning agent.
[0110] The planning agent combines the task content with the data in its memory to re-plan the task. For example, if the retrieved data already meets the current task requirements, the data and task instructions are rewritten with prompts in the prompt function module and then input into the data analysis agent for data analysis. The analysis results are saved in the memory module, which then provides them to the planning agent.
[0111] The planning agent combines the task content with the data in its memory to dynamically replan the task. For example, if the analysis results meet the current task requirements, the analysis results and task instructions are rewritten with prompts by the prompt function module and then given to the report generation agent for report generation and output.
[0112] For example, Figure 6 As shown, taking the collaborative agent including the intention analysis agent, the retrieval agent, the data analysis agent and the reporting agent as an example, the process of combining the planning agent with the collaborative agent to realize data processing is explained.
[0113] The task description information of the specified task received from the user is "Are there any security anomalies between 1:01 and 1:00 on September 3, 2024?" The data processing process for this task description information is as follows:
[0114] First, a planning agent is used to perform dynamic task planning on the task description information to generate subtask A to be executed.
[0115] The thought for subtask A is, "Since the question asks whether there are security anomalies within a specific timeframe, I should first try to understand the intent of the question and confirm that it's about checking the security of a specific vault. Then, I might need to retrieve relevant entity information from the Milvus database and use this information to check the security status of the vault." The action for subtask A is "analyzing_query," and the input is {"query":"Were there any security anomalies between 01:01 and 13:00 on September 3, 2024?"}.
[0116] First, the planning agent calls the intention analysis agent from the collaborative agent pool and issues the intention analysis instruction for the current subtask A to the intention analysis agent.
[0117] Next, the intent analysis agent extracts the corresponding analysis prompt template from the prompt template library. It then rewrites the corresponding prompt template based on the question and action input provided by the planning agent. This rewritten template serves as input to the designated tool (the called tool) (analyzing_query). The intent analysis agent's subtask results are stored in memory and used as input for the planning agent's next dynamic task planning.
[0118] Next, the planning agent performs dynamic planning again, generating the next subtask, B. Subtask B's thinking is, "Now that I have the time range and other relevant information required for the query, the next step is to retrieve security-related data from the Milvus database during this time." Subtask B's action is "data_retrieval," and its action input is the subtask result of subtask A. The retrieval agent is called from the collaborative agent pool and issued a data retrieval instruction. The retrieval agent extracts the corresponding retrieval prompt template from the prompt template library, rewrites the question and action input (Action input) provided by the planning agent, and uses the corresponding retrieval prompt template to rewrite the rewritten template. This rewritten template serves as the input for the called tool (data_retrieval). The retrieval agent stores the retrieval results in the memory module, which serves as input for the planning agent's next dynamic planning.
[0119] Next, the planning agent performs dynamic planning again to generate the next task C. The thinking behind task C is "According to the data retrieved from the Milwus database, the status of most login records is normal, but some records are abnormal. These records need further inspection to determine whether there are indeed security issues." The action of subtask C is "data_analysis", and the action input of subtask C is the subtask result of subtask B. The data analysis agent is called from the collaborative agent pool, and data analysis instructions are issued to the data analysis agent. The analysis agent extracts the corresponding data analysis prompt word template from the prompt word template library, rewrites the questions and action input (Action input) given by the planning agent in combination with the corresponding prompt word template, and uses the rewritten template as the input of the called tool (data_analysis). The execution results of the data analysis agent will be saved in the memory module as the input for the next dynamic planning of the planning agent.
[0120] Next, the planning agent performs dynamic task planning again, generating the next subtask, D. The consideration for subtask D is, "Based on the results of the security inspection, multiple security anomalies exist within a specified time period, including the need to compile these results into a report." The action for subtask D is "report_generation," and its action input is the subtask result of subtask C. The report generation agent is called from the collaborative agent pool and issued a report generation instruction. The report generation agent extracts an appropriate report prompt template from the report generation prompt template library, rewrites the question and action input (Action input) provided by the planning agent, and combines it with the corresponding report generation prompt template. This rewritten template serves as the input for the called tool (report_generation). The report generation agent's execution results are stored in the memory module and serve as input for the planning agent's next dynamic planning round.
[0121] In one embodiment, in order to further illustrate that the number of collaborative agents is related to actual business, the customer satisfaction data analysis is used as an example. Figure 7 As shown in the figure, the task information is described as "Analyze the visitor satisfaction of scenic spot A in March 2024 and present it in the form of a pie chart." The corresponding multi-agent system includes a planning agent, and the collaborative agents include an intent analysis agent, a retrieval agent, a sentiment analysis agent, a drawing agent, and a reporting agent. The agent-based data processing process is as follows:
[0122] The planning agent generates subtask a based on the task description information. The thought of subtask a is "The user needs to analyze the tourist satisfaction of attraction A within a specific time range. I should first try to understand the intention of the question and confirm that this is a problem related to the satisfaction of attraction A. It may be necessary to obtain relevant information from the Milwus database and use this information to judge the tourist satisfaction." The action of subtask a is "analyzing_query", and the action input of subtask a is {"query": "Analyze the tourist satisfaction of attraction A in March 2024 and present it in the form of a pie chart."}. The intention analysis agent is called to perform the intent analysis processing adapted to subtask a, and the tool (running process) adapted to subtask a is called to generate the intent analysis result Observation1 in a preset format, and the subtask a and the action execution result Observation1 of subtask a are saved to the memory.
[0123] The planning agent performs dynamic planning again based on the action execution result Observation1 of subtask a to obtain subtask b. The action Action of subtask b is "data_retrieval", and the action input of subtask b is {data in Observation1}. Subtask b is a retrieval task. The collaborative agent adapted to subtask b - the retrieval agent is called to perform the data retrieval operation adapted to subtask b. The retrieval agent calls the retrieval tool to retrieve the required data from different data sources, generates the dynamic subtask result of subtask b (that is, the action execution result of subtask b) Observation2, and saves it to the memory.
[0124] Next, the planning agent performs dynamic task planning again based on the subtask result Observation2 of subtask b to generate subtask c. The thought of subtask c is "Based on the tourist evaluation data of scenic spots retrieved from the Milvus database, it is necessary to further analyze the emotional state of the evaluation." The action of subtask c is "emotion-analysis", and the action input of subtask c is {data in Observation2}. Subtask c is an emotion analysis task. The collaborative agent adapted to subtask c - the emotion analysis agent is called to perform the emotion analysis operation adapted to subtask c. The emotion analysis agent calls the emotion analysis tool (emotion-analysis) to generate the subtask result Observation3 of subtask c and save it to the memory.
[0125] The planning agent performs dynamic task planning again based on the subtask result Observation3 of subtask c to generate subtask d. The thought of subtask d is "According to the results of sentiment analysis, there are three different situations in the evaluation of tourists within the specified time period, including satisfaction, dissatisfaction, and general. Now we need to generate a pie chart based on these evaluations, and we need to call a mapping tool." The action of subtask d is "chart_generation", and the action input of subtask d is {data in Observation3}. Subtask d is a drawing task, and the collaborative agent adapted to subtask d - the drawing agent is called to perform the drawing operation adapted to subtask d. The drawing agent calls the chart generation tool (chart-generation) to generate the action execution result Observation4 of task d and save it to the memory.
[0126] The planning agent performs dynamic planning again, generating the next subtask e. The thought process for subtask e is, "We've completed the pie chart. Now we need to generate a report using the pie chart and visitor review data." The action for subtask e is "report_generation," and the action input for subtask e is {data from Observation 4}. The report generation agent is called from the collaborative agent pool and issued a report generation instruction. The called report generation agent extracts the appropriate report prompt template from the report generation prompt management module, rewrites the template based on the planning agent's question and action input, and uses the rewritten template as input for the called tool (report_generation). The report generation agent's execution results are stored in the memory module and serve as input for the planning agent's next dynamic planning round.
[0127] Finally, the planning agent determines that the task has been completed and ends the dynamic planning.
[0128] This embodiment relies on no manual intervention; a single user instruction is all it takes for the agent to complete autonomous task planning. Depending on the task, the planning agent calls upon different collaborative agents in the collaborative agent pool to observe and analyze data and generate a final report. This approach effectively reduces operational complexity and, leveraging the world knowledge held by the large model, enables deeper insights during data analysis, unlocking its value and mitigating potential risks.
[0129] The present application also provides an agent-based data processing device for executing the steps in the above-mentioned agent-based data processing method embodiment. Figure 8 As shown, the agent-based data processing device 800 provided in this embodiment of the present application includes:
[0130] The acquisition module 810 is used to acquire task description information of a specified task.
[0131] The dynamic planning module 820 is used to perform dynamic task planning on the task description information through a planning agent to generate subtasks.
[0132] The selection module 830 is used to select a designated collaborative agent that is suitable for the subtask from multiple collaborative agents.
[0133] The implementation module 840 is used to implement subtasks by specifying collaborative agents and obtain subtask results.
[0134] The iteration module 850 is used to determine new task description information based on the subtask results, iteratively execute the dynamic task planning, and output the task result of the specified task until it is confirmed that the specified task has met the end condition.
[0135] In one embodiment, the dynamic planning module is further used to perform intent recognition on the task description information through a planning agent to obtain a recognition result; based on the recognition result, a subtask to be executed is generated; wherein the task content of the subtask includes thinking, action and action input; the thinking is used to describe the task information of the subtask, the action indicates the data processing operation required for the subtask, and the action input indicates the data required to execute the action.
[0136] In one embodiment, the dynamic programming module is further used to extract a prompt word template adapted to the subtask from a prompt word template library; rewrite the prompt word based on the task description information, the prompt word template and the action input of the subtask to obtain the specified template content; and implement the subtask based on the specified template content to obtain the subtask result.
[0137] In one embodiment, the dynamic planning module is further used to obtain a position to be filled in the prompt word template; determine the filling content based on the task description information and the action input of the subtask; and fill the filling content into the position to be filled to obtain the specified template content.
[0138] In one embodiment, the implementation module is also used to identify the execution type of the subtask action; if the execution type is indirect execution, the specified tool is called to execute the subtask and obtain the subtask result; if the execution type is direct execution, the subtask is directly executed to obtain the subtask result.
[0139] In one embodiment, the acquisition module is also used to determine the input information for the specified task as task description information for the first round of dynamic task planning; for non-first round dynamic task planning, determine the task description information based on the input information for the specified task and task history information, and the task history information is stored in the memory.
[0140] In one embodiment, multiple collaborative agents include a data analysis agent, a data retrieval agent, and a report generation agent. The data retrieval agent is used to perform database retrieval or real-time data retrieval according to the data retrieval task instructions generated by the planning agent to obtain retrieval results; the data analysis agent is used to perform analysis using the retrieval results of the retrieval agent according to the data analysis instructions generated by the planning agent to obtain analysis results; the report generation agent is used to generate a multidimensional report in a preset format according to the report generation task instructions generated by the planning agent and the analysis results of the data analysis agent.
[0141] In applications, each module in the agent-based data processing device may be a software program module, or may be implemented through different logic circuits integrated in a processor, or may be implemented through multiple distributed processors.
[0142] Figure 9 This is a schematic diagram of the structure of a computer device for an agent-based data processing method provided in one embodiment of the present application. Figure 9 As shown, the computer device 900 of this embodiment includes: at least one processor 910 ( Figure 9 Only one is shown in the figure) a processor, a memory 920, and a computer program 930 stored in the memory 920 and executable on the at least one processor 910. When the processor 910 executes the computer program 930, the steps of any of the above-mentioned exception handling method embodiments are implemented.
[0143] The computer device 900 may be a desktop computer, a notebook computer, a PDA, a cloud server, or other computing devices. The computer device 900 may include, but is not limited to, a processor 910 and a memory 920. Those skilled in the art will appreciate that Figure 9 This is merely an example of the computer device 900 and does not constitute a limitation on the computer device 900 . The computer device 900 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device 900 may also include input and output devices, network access devices, etc.
[0144] The processor 910 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0145] In some embodiments, the memory 920 may be an internal storage unit of the computer device 900, such as a hard drive or memory of the computer device 900. In other embodiments, the memory 920 may also be an external storage device of the computer device 900, such as a plug-in hard drive, a SmartMedia Card (SMC), a Secure Digital (SD) card, a flash memory card, etc. equipped on the computer device 900. Furthermore, the memory 920 may include both an internal storage unit of the computer device 900 and an external storage device. The computer device 900 is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of the computer program. The memory 920 may also be used to temporarily store data that has been output or is about to be output.
[0146] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here.
[0147] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0148] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0149] An embodiment of the present application provides a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned various method embodiments when executing the computer program product.
[0150] If the integrated unit is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process steps in the above-mentioned method embodiments by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / terminal equipment, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, removable hard drives, magnetic disks, or optical disks. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunication signals.
[0151] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0152] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0153] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0154] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0155] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A data processing method based on an agent, characterized in that: Methods include: Get the task description information of the specified task; Performing dynamic task planning on the task description information through a planning agent to generate subtasks; Selecting a designated collaborative agent that is adapted to the subtask from a plurality of collaborative agents, and implementing the subtask through the designated collaborative agent to obtain a subtask result; Determining new task description information based on the subtask result, iteratively executing the dynamic task planning until it is confirmed that the designated task has met the termination condition, and outputting the task result of the designated task; wherein, for non-first-round dynamic task planning, the task description information is determined based on input information and task history information for the designated task, and the task history information is stored in a memory; The step of implementing the subtask by the designated collaborative agent and obtaining the subtask result includes: The designated collaborative agent extracts a prompt word template adapted to the subtask from a prompt word template library; wherein the prompt word template library includes a plurality of different types of prompt word templates, providing different prompt word templates for different subtasks; Based on the task description information, the prompt word template and the action input of the subtask, the prompt word is rewritten to obtain the specified template content; wherein the task description information describes the data processing requirements of the specified task; the action input of the subtask is the action execution result of the current action; Based on the specified template content, the subtask is implemented to obtain a subtask result.
2. The agent-based data processing method according to claim 1, wherein: The planning agent performs dynamic task planning on the task description information to generate subtasks, including: Performing intention recognition on the task description information by a planning agent to obtain a recognition result; Based on the recognition result, generating a subtask to be executed; The task content of the subtask includes thinking, action and action input; the thinking is used to describe the task information of the subtask, the action indicates the data processing operation required for the subtask, and the action input indicates the data required to execute the action.
3. The agent-based data processing method according to claim 1, wherein: The prompt word is rewritten based on the task description information, the prompt word template and the action input of the subtask to obtain the specified template content, including: Obtaining the position to be filled in the prompt word template; Determining filling content based on the task description information and the action input of the subtask; Fill the filling content into the position to be filled to obtain the specified template content.
4. The agent-based data processing method according to claim 1, wherein: The step of implementing the subtask based on the specified template content and obtaining the subtask result includes: Identifying the execution type of the action of the subtask; If the execution type is indirect execution, the specified tool is called to execute the subtask and obtain the subtask result; If the execution type is direct execution, the subtask is directly executed to obtain the subtask result.
5. The agent-based data processing method according to claim 1, wherein: The method further comprises: For the first round of dynamic task planning, input information for a specified task is determined as task description information.
6. The agent-based data processing method according to claim 1, wherein: The multiple collaborative agents include a data analysis agent, a data retrieval agent, and a report generation agent. The data retrieval agent is used to perform database retrieval or real-time data retrieval according to the data retrieval task instructions generated by the planning agent to obtain retrieval results; The data analysis agent is used to analyze the data analysis instructions generated by the planning agent using the search results of the search agent to obtain analysis results; The report generation agent is used to generate task instructions based on the report generated by the planning agent, and generate a multi-dimensional report in a preset format in combination with the analysis results of the data analysis agent.
7. An agent-based data processing system, characterized in that: The system includes a planning agent and multiple collaborative agents; The planning agent is used to perform dynamic task planning on the task description information of the specified task, generate subtasks, and select a specified collaborative agent adapted to the subtask from at least two collaborative agents; The designated collaborative agent is used to implement the subtask and obtain the subtask result; The planning agent is further configured to determine new task description information based on the subtask results, iteratively execute the dynamic task planning until it is determined that the designated task has met the termination conditions, and output the task result of the designated task; wherein, for non-first-round dynamic task planning, the task description information is determined based on input information for the designated task and task history information, and the task history information is stored in a memory; The designated collaborative agent is specifically used to: The designated collaborative agent extracts a prompt word template adapted to the subtask from a prompt word template library; wherein the prompt word template library includes a plurality of different types of prompt word templates, providing different prompt word templates for different subtasks; Based on the task description information, the prompt word template and the action input of the subtask, the prompt word is rewritten to obtain the specified template content; wherein the task description information describes the data processing requirements of the specified task; the action input of the subtask is the action execution result of the current action; Based on the specified template content, the subtask is implemented to obtain a subtask result.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the computer device is caused to implement the method according to any one of claims 1 to 6.
9. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method according to any one of claims 1 to 6 to be performed.
Citation Information
Patent Citations
Personalized traffic report dynamic generation method and device based on AI intelligent agent and medium
CN117785965A
Information interaction method and device based on large language model and electronic equipment
CN118093801A