An agent-based task processing method and electronic device
By generating initial plans for parallel subtasks and updating multidimensional scores through an intelligent agent, the problems of low execution efficiency and high computational overhead in the serial model are solved, achieving efficient and low-cost task execution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZHUOSHI HORONG INFORMATION TECH CO LTD
- Filing Date
- 2025-10-28
- Publication Date
- 2026-06-26
Smart Images

Figure CN121501438B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more specifically to a task processing method and electronic device based on intelligent agents. Background Technology
[0002] With the rapid development of large language model technology, intelligent agents have shown great potential in the field of complex task processing. At present, the mainstream task planning method in the industry is the real-time decomposition strategy based on large language models: the large language model dynamically generates a task sequence according to the user's goal, and then executes the tasks one by one in strict order. During the execution of the tasks, the system feeds back the execution results to the large language model, and the large language model dynamically plans the remaining tasks based on the latest context.
[0003] However, this approach, with its strict seriality model, fails to identify and utilize the parallel potential between tasks, resulting in reduced execution efficiency. Furthermore, the full replanning required when updating tasks significantly increases computational overhead. Therefore, there is an urgent need for a more efficient and cost-effective task execution method. Summary of the Invention
[0004] To address the aforementioned problems, embodiments of the present invention provide a task processing method and electronic settings based on intelligent agents, which can improve task execution efficiency while reducing task execution costs.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0006] On one hand, embodiments of the present invention provide a task processing method based on an intelligent agent, the method comprising:
[0007] An initial plan is generated based on the task objective of the task to be processed. The initial plan includes multiple parent tasks that are executed in execution order, and sub-tasks that are executed in parallel under each parent task.
[0008] For each subtask, a quality inspection or failure handling process is performed on the subtask based on its execution status to determine candidate subtasks.
[0009] The candidate subtasks are scored according to multiple preset dimensions to obtain a multidimensional score for each candidate subtask.
[0010] For each abnormal parent task, the initial plan is updated based on the multidimensional scores of all candidate subtasks under the abnormal parent task, where the abnormal parent task is the parent task with candidate subtasks.
[0011] The tasks to be processed will be executed according to the updated initial plan.
[0012] On the other hand, embodiments of the present invention also provide a task processing device based on an intelligent agent, the device comprising:
[0013] The plan generation module is used to generate an initial plan based on the task objectives of the task to be processed. The initial plan includes multiple parent tasks that are executed in sequence, and sub-tasks that are executed in parallel under each parent task.
[0014] The candidate determination module is used to perform quality inspection or failure processing on each subtask based on its execution status, so as to determine candidate subtasks.
[0015] The scoring module is used to score the candidate subtasks according to multiple preset dimensions to obtain a multi-dimensional score for each candidate subtask.
[0016] The plan update module is used to update the initial plan for each abnormal parent task based on the multidimensional scores of all candidate subtasks under the abnormal parent task, wherein the abnormal parent task is a parent task with candidate subtasks.
[0017] The processing module is used to execute the tasks to be processed according to the updated initial plan.
[0018] On the other hand, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute steps in any of the agent-based task processing methods provided in embodiments of the present invention.
[0019] On the other hand, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the agent-based task processing methods provided in embodiments of the present invention.
[0020] On the other hand, embodiments of the present invention also provide a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps in any of the agent-based task processing methods provided in the embodiments of the present invention.
[0021] The beneficial effects of the technical solution provided by this invention include at least the following:
[0022] In this embodiment of the invention, an initial plan is generated using the task objective of the task to be processed. The initial plan includes parent tasks to be executed sequentially, and each parent task contains sub-tasks to be executed in parallel, maximizing the parallel potential between tasks and effectively improving execution efficiency. During task execution, candidate sub-tasks with execution problems can be selected based on their execution status, and a multi-dimensional score for each candidate sub-task is calculated according to preset dimensions. Taking into account the multi-dimensional scores of the candidate sub-tasks, an appropriate method is selected to update the initial plan, reducing computational overhead. Finally, the task continues to be executed according to the updated initial plan, ensuring efficient task execution at a low cost. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram illustrating an application scenario of the agent-based task processing method provided in an embodiment of the present invention.
[0025] Figure 2 This is a flowchart illustrating the agent-based task processing method provided in an embodiment of the present invention.
[0026] Figure 3 This is a flowchart illustrating the process of determining candidate subtasks provided in an embodiment of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of the agent-based task processing device provided in an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0029] 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, and 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.
[0030] It is understood that in specific embodiments of the present invention, data involving user information and related data requires user permission or consent, and the collection, use and processing of such data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0031] See also Figure 1 This diagram illustrates an application scenario for an agent-based task processing method. The application scenario may include a terminal 101 and a server 102, which can exchange data via a network. The terminal 101 may have relevant applications installed. The terminal 101 can be a mobile phone, tablet, smart Bluetooth device, computer, robot, large screen, or other similar device. The server 102 can be a single server or a server cluster consisting of multiple servers.
[0032] Users can send the task objectives of pending tasks to server 102 via terminal 101. Server 102 can then generate an initial plan based on the task objectives. This initial plan includes multiple parent tasks executed in sequence, and child tasks executed in parallel under each parent task. For each child task, quality checks or failure handling are performed based on its execution status to identify candidate child tasks. These candidate child tasks are then scored according to multiple preset dimensions to obtain a multi-dimensional score for each candidate child task. For each abnormal parent task, the initial plan is updated based on the multi-dimensional scores of all candidate child tasks under that abnormal parent task, where the abnormal parent task is the parent task with candidate child tasks. Finally, the pending task is executed according to the updated initial plan.
[0033] After successfully executing the task to be processed, server 102 can send the execution result of the task to terminal 101 so that the execution result can be displayed to the user through terminal 101.
[0034] In this embodiment, a task processing method based on an intelligent agent is provided, such as... Figure 2 As shown, the specific process of this agent-based task processing method can be as follows:
[0035] S110. Generate an initial plan based on the task objectives of the task to be processed.
[0036] The pending task is the task that the agent needs to process, and the task objective is the goal to be achieved by executing the pending task. The initial plan is the plan that the agent needs to follow when executing the pending task. The initial plan may include multiple parent tasks, which need to be executed sequentially in order. For each parent task, there are multiple subtasks under that parent task. These subtasks do not have an execution order requirement and can be executed in parallel to improve execution efficiency.
[0037] As one implementation method, when generating an initial plan based on the task objectives of the task to be processed, the agent can analyze and process the task objectives, break them down into multiple sub-objectives, generate corresponding task steps for each sub-objective, and divide the parent and child tasks according to the dependency relationship to form an initial plan.
[0038] As one implementation method, when generating an initial plan based on the task objective of the task to be processed, the deliverables of the task to be processed can be analyzed based on the task objective; for each deliverable, the preceding data on which the deliverable depends is generated in a chain-like reverse process until the preceding data is the original data source, thus obtaining a data dependency chain; for each data in the data dependency chain, it is converted into an intermediate task for obtaining the data; based on the data dependencies in the data dependency chain and the intermediate tasks, multiple parent tasks to be executed in execution order, and multiple sub-tasks under each parent task are generated to obtain the initial plan.
[0039] Based on the task objectives of the pending task, the deliverables upon completion of the task can be analyzed, and these deliverables can serve as identifiers of task completion. For example, if the task objectives are: analyze the market competition between Company A and Company B, generate a detailed PDF report containing data charts, and prepare a 5-page PowerPoint presentation for senior management, the deliverables would be the detailed report and the PowerPoint presentation.
[0040] In other words, as long as the agent can output detailed reports and PPT presentations, the task to be processed can be considered successfully completed. For each deliverable of the task to be processed, reverse reasoning can be performed to find the prerequisite data necessary to generate the deliverable, the prerequisite data necessary to generate the prerequisite data, and so on, until the inferred prerequisite data is the original data source, thus obtaining the data dependency chain.
[0041] In this context, the original data source refers to data such as web pages, APIs, and databases that can be directly obtained without further processing. This data dependency chain encompasses all data from the deliverables to the original data sources. For example, if the deliverables are detailed reports and PowerPoint presentations, the necessary prerequisite data for generating a detailed report are data charts and formatted text content; the necessary prerequisite data for generating data charts and formatted text content is the analyzed competitor data; the necessary prerequisite data for generating a PowerPoint presentation is the key conclusions and data charts, and so on, until all original data sources are traced back, thus forming a data dependency chain.
[0042] For each piece of data in the data dependency chain, an intermediate task can be created with the goal of retrieving that data. For example, for Company A's financial report, the intermediate task generated would be: call the API to retrieve Company A's financial report; another example is the competitive data between Company A and Company B, which would generate the intermediate task: compare and analyze the competitive data between A and B.
[0043] This method yields intermediate tasks corresponding to each data point in the data dependency chain. Since the data points in the chain have certain data dependencies, a dependency exists between two intermediate tasks when the input of one task contains the output of another. For example, if the input of intermediate task 1 contains the output of intermediate task 2, then task 1 depends on task 2. Then, for intermediate tasks without dependencies, they are integrated into a parent task, which contains intermediate tasks without dependencies, also known as subtasks. These subtasks can be processed in parallel. Furthermore, based on the dependencies between intermediate tasks, parent tasks are summarized sequentially, and corresponding parallel-executable intermediate tasks are set under each parent task as subtasks, thus forming the initial plan.
[0044] In other words, in the initial plan, parent tasks have a certain execution order, while multiple subtasks under a parent task do not have an execution order requirement and can be processed in parallel. For example, for a task whose objective is to "analyze the market competition between Company A and Company B, generate a detailed PDF report containing data charts, and prepare a 5-page PPT presentation for senior management," the initial plan could be:
[0045] {"id": "P1",
[0046] "description": "Collecting financial reports and news data from companies A and B",
[0047] "subtasks": [{ "id": "1", "description": "Calling the API to retrieve Company A's financial report"},
[0048] { "id": "2", "description": "Scrape and analyze news sentiment about Company A"},
[0049] { "id": "3", "description": "Using the API to retrieve Company B's financial report"},
[0050] { "id": "4", "description": "Scrape and analyze news sentiment about Company B"}]
[0051] },
[0052] {"id": "P2",
[0053] "description": "Integrates financial reports and news data from companies A and B respectively",
[0054] "subtasks": [{ "id": "5", "description": "Integrate Company A's financial reports and news data"},
[0055] { "id": "6", "description": "Integrating Company B's financial statements and news data"}]
[0056] },
[0057] {"id": "P3",
[0058] "description": "Comprehensive comparative analysis of data from companies A and B",
[0059] "subtasks": [{ "id": "7", "description": "Based on a comprehensive comparative analysis of the integrated data from A and B, conclusions are drawn regarding the competitive landscape"}]
[0060] },
[0061] {"id": "P4",
[0062] "description": "Generate data visualization charts",
[0063] "subtasks": [{ "id": "8", "description": "Generate key data visualization charts based on analysis conclusions"}]
[0064] },
[0065] {"id": "P5",
[0066] "description": "Generate analysis reports and presentation PPTs",
[0067] "subtasks": [{ "id": "9", "description": "Compile a detailed PDF analysis report including charts"},
[0068] { "id": "10", "description": "Extract key conclusions and charts to create a high-level presentation PPT"}]
[0069] }
[0070] S120. For each subtask, perform quality inspection or failure processing on the subtask according to its execution status to determine candidate subtasks.
[0071] The agent initiates parent tasks sequentially according to the execution order. After a parent task starts, all its subtasks are executed in parallel. For each subtask, quality checks or failure handling can be performed based on its execution status to identify candidate subtasks. Candidate subtasks are those with execution defects and need to be filtered out for subsequent processing. See [link to relevant documentation] for details. Figure 3 The diagram illustrates the process of determining candidate subtasks.
[0072] Optionally, when determining candidate subtasks by performing quality checks or failure handling on subtasks based on their execution status, the execution status of each subtask under the parent task can be obtained during the execution of the parent task. The execution status of the subtask includes successful execution and failed execution. If the execution status of the subtask is successful, quality checks are performed on the subtask to determine candidate subtasks; if the execution status of the subtask is failed, failure handling is performed on the subtask to determine candidate subtasks.
[0073] The execution status of a subtask can include two types: successful execution and failed execution. Successful execution means that the subtask executes without errors and produces output; failed execution means that the subtask encounters an exception during execution, such as a tool error, an abnormal return code, or no output. In other words, if a subtask produces an error or no output, its execution status can be determined as failed execution.
[0074] For subtasks whose execution status is "execution failed", there has been a problem in their execution process. Failure handling can be used to try to fix the error and ensure that they can execute normally. If the execution still fails after trying to fix it, it can be identified as a candidate subtask.
[0075] As one implementation method, when handling failures of subtasks to determine candidate subtasks, the following steps can be taken: for each subtask, obtain the tool call data in the execution of the subtask; if there is abnormal data in the tool call data, repair the abnormal data and then retry; if the subtask retry is successful, perform quality inspection on the subtask to determine candidate subtasks; if the subtask retry fails or there is no abnormal data in the tool call data, the subtask is determined as a candidate subtask.
[0076] For each failed subtask, the tool call data in the task can be retrieved first to analyze whether the failure is related to tool exceptions. Tool exceptions include tool runtime exceptions and call parameter exceptions; tool runtime exceptions include tool timeouts, crashes, no response, and interface error codes; call parameter exceptions include missing parameters, incorrect formatting, and parameters exceeding tool limits.
[0077] If the analysis tool determines whether the execution failure was caused by the tool itself, abnormal data in the tool's call data can be located, and the abnormal data can be repaired before retrying. For example, in cases of abnormal call parameters, the parameters can be automatically validated, completed, and corrected, triggering a re-execution of the subtask by the tool. The number of retries can be set according to actual needs, such as 1 time, 2 times, etc. If the subtask still fails after reaching the retries limit, it can be further checked whether other tools with the same function exist. If other tools exist, switch to one and execute it again. If it still fails after switching tools or no other tools exist, the subtask can be directly identified as a candidate subtask.
[0078] If the subtask executes successfully after retrying or after switching tools, a quality check can be performed on the subtask to identify candidate subtasks.
[0079] If the failure of a subtask is unrelated to tool malfunction, the subtask can be considered unrepairable and can be directly identified as a candidate subtask.
[0080] For subtasks whose execution status is successful, although there are no errors and there is output, the quality of the output cannot be guaranteed. Therefore, quality detection processing can be performed on these subtasks, and subtasks that fail the quality detection processing can be identified as candidate subtasks.
[0081] As one implementation method, when performing quality inspection on subtasks to determine candidate subtasks, the following steps can be taken: for each subtask, obtain the execution output of the subtask; compare and analyze the execution output with the expected output of the subtask to determine the output integrity of the subtask; perform compliance inspection on the execution output according to a preset compliance dimension to determine the output compliance of the subtask; and determine candidate subtasks based on the output integrity and the output compliance.
[0082] For subtasks that have been successfully executed, their corresponding execution output can be obtained, and this output can be subjected to quality inspection. This quality inspection includes two dimensions: first, output integrity inspection, which checks whether the execution output meets the expected output; and second, output compliance inspection, which checks whether the execution output is compliant.
[0083] In the output integrity check, the task objective of the subtask can be obtained first as the expected output. The expected output and the executed output are compared to analyze whether the quantity of output content matches the expected output. For example, if the expected output is to extract 10 customer information entries, the check will determine whether the executed output extracts 10 customer information entries and whether there are any missing entries. Of course, it is also necessary to check for calculation errors, information confusion, and other issues in the executed output. The integrity check process can be guided by pre-setting prompts and introducing data such as the task objective and initial plan of the task to be processed as context, leading the large language model to determine the output integrity of the executed output.
[0084] When conducting compliance checks, preset compliance dimensions can be established. These dimensions can include format, content, and logic. Compliance checks are then performed according to these preset dimensions. Format checks verify whether the output is generated as required and whether the format is correct. Content checks check whether the output contains any non-compliant content, such as infringing content or sensitive words. Logic checks check whether the conclusions and arguments in the output contradict each other and whether the process complies with business rules. If the output is generated as required and has a correct format, it is considered format compliant. If the output does not contain any non-compliant content, it is considered content compliant. If the output does not contain any contradictions and the process complies with business rules, it is considered logically compliant. The output is considered compliant only if it is compliant in format, content, and logic. Similarly, the compliance check process can be achieved by pre-setting prompts and incorporating relevant context into a large language model, which then determines the compliance of the output.
[0085] If the output of a subtask is incomplete or non-compliant, it can be determined that the subtask has failed the quality check and can be identified as a candidate subtask. If a subtask passes the quality check, it can be further determined whether other subtasks under its parent task have also passed the quality check; if so, the next parent task of that parent task can be executed in the order of execution.
[0086] S130. The candidate subtasks are scored according to multiple preset dimensions to obtain a multi-dimensional score for each candidate subtask.
[0087] For the candidate subtasks identified in the aforementioned steps, they can be scored according to multiple preset dimensions to obtain a multi-dimensional score for each candidate subtask. Candidate subtasks can be considered as subtasks with execution defects. For each candidate subtask, the scope of impact caused by its execution failure can be determined from multiple dimensions, thereby determining the subsequent update strategy for the initial plan to ensure that the tasks to be processed can be executed normally.
[0088] Optionally, when calculating the multidimensional score of each candidate subtask, a first score may be calculated based on the execution output of the candidate subtask and the expected output of the candidate subtask; a second score may be calculated based on the severity of the failure type of the candidate subtask; a third score may be calculated based on the contribution of the candidate subtask to its parent task and the task objectives of the task to be processed; and the first score, the second score, and the third score may be fused according to a preset weight to obtain the multidimensional score of the candidate subtask.
[0089] As described in the aforementioned process for determining candidate subtasks, candidate subtasks include not only those that fail to produce an error or no output, but also those that execute successfully but whose output fails the quality check. Therefore, for each candidate subtask, the quantity of its output can be obtained as the output quantity, which can be measured by the number of characters or the number of output lines. The expected output quantity refers to the expected number of outputs for the candidate subtask. Similarly, if the output quantity is the number of characters, the expected output quantity is also the number of characters; if the output quantity is the number of output lines, the expected output quantity is also the number of output lines, and the measurement standards for both remain consistent.
[0090] The first score characterizes the proportion of missing output for the candidate subtask. Specifically, it is calculated by dividing the difference between the expected and executed output by a preset output value. The more content missing from the expected output compared to the executed output, the higher the first score and the greater the impact on the entire task. It should be noted that if the candidate subtask has no executed output, the executed output value is 0.
[0091] The second score can be used to characterize the severity of the failure type of a candidate subtask. Specifically, the second score can be calculated based on the first score of the candidate subtask and its execution output. For example, determining whether the candidate subtask has execution output: if the candidate subtask has no execution output, it indicates that the failure type is an abnormal crash, causing it to be unable to output content, and the impact of the failure is relatively large. If the candidate subtask has execution output, the impact of the failure can be directly determined based on the first score. If the first score is greater than a specified threshold, it can be considered that the missing content is not large, indicating that the failure type is partial completion, and the impact of the failure is moderate; if the first score is less than the specified threshold, it can be considered that the missing content is very small, indicating that the failure type is a minor error, and the impact of the failure is low. For each level of failure impact, a preset score can be set in advance. For example, the preset score corresponding to a large failure impact is 1, the preset score corresponding to a medium failure impact is 0.5, and the preset score corresponding to a small failure impact is 0.2. The second score can be determined according to this mapping relationship; that is, the higher the value of the second score, the greater the impact of the failure.
[0092] The third score can be used to characterize the contribution of the candidate subtask to its parent task and the task to be processed. Optionally, it can be used to analyze whether the candidate subtask is a core action in its parent task, and whether the failure of the candidate subtask will affect the task objective of the task to be processed, thereby determining its contribution. Specifically, it can be analyzed and reasoned through a large language model and given a third score. The higher the contribution, the higher the third score, and the greater the influence.
[0093] A first weight, a second weight, and a third weight are pre-set, each corresponding to one of the three scores. The specific values of the three weights can be set according to actual needs, and the sum of the three weights is 1. Multiplying the first weight by the first score yields the first product, multiplying the second weight by the second score yields the second product, and multiplying the third weight by the third score yields the third product. Summing the first product, the second product, and the third product yields the multidimensional score of the candidate subtask.
[0094] S140. For each abnormal parent task, update the initial plan based on the multidimensional scores of all candidate subtasks under the abnormal parent task.
[0095] After initiating a parent task, the agent begins executing its subtasks. When a subtask encounters an anomaly, it is identified as a candidate subtask. A parent task with candidate subtasks is called an anomalous parent task. Because of the presence of candidate subtasks, the anomalous parent task cannot execute normally, causing the entire pending task to fail. To ensure the normal execution of the pending task, an update strategy for the initial plan can be determined based on the multidimensional scores of all candidate subtasks under the anomalous parent task. The initial plan is then updated according to this strategy to ensure the normal execution of the pending task.
[0096] As one implementation method, when updating the initial plan based on the multidimensional scores of all candidate subtasks under the abnormal parent task, the abnormal score of the abnormal parent task can be calculated based on the multidimensional scores of the candidate subtasks under the abnormal parent task and the total number of subtasks under the abnormal parent task; an update strategy is determined based on the relationship between the abnormal score and a first threshold and a second threshold, wherein the first threshold is calculated based on the hierarchy of each parent task, the second threshold is calculated based on the number of subtasks under each parent task, and the first threshold is less than the second threshold; the initial plan is then updated according to the update strategy.
[0097] The anomalous score of the abnormal parent task can be calculated using the multidimensional scores of all candidate subtasks under the abnormal parent task. Optionally, the anomalous score can be obtained by summing the multidimensional scores of all candidate subtasks under the abnormal parent task and dividing the intermediate score by the total number of subtasks under the abnormal parent task.
[0098] A first threshold and a second threshold are preset, wherein the first threshold is less than the second threshold. The first and second thresholds can be designed based on practical experience or calculated according to predefined calculation rules. In this embodiment of the invention, the first and second thresholds are calculated using predefined calculation rules. Specifically, the first threshold can be calculated based on the hierarchy of each parent task, and the second threshold can be calculated based on the number of child tasks under each parent task.
[0099] The parent task level refers to the level of the parent task in the current initial plan. The first parent task has a level of 0, the second parent task has a level of 1, and so on, so that the levels of all parent tasks can be obtained. The average level, denoted as AvgDepth, can be calculated by dividing the sum of the levels of all parent tasks by the number of parent tasks.
[0100] The level of the last parent task reflects the total length of the serial flow, denoted as MaxDepth. The first threshold can be calculated using the following formula: 0.2 + AvgDepth MaxDepth 0.1. Among them, the closer AvgDepth is to MaxDepth, the lower the first threshold.
[0101] For each parent task in the initial plan, the number of child tasks under each parent task can be obtained. The maximum value among these child task counts is selected to reflect the parallel complexity, denoted as BranchFactor. The second threshold can be calculated using the following formula: 0.6 + log(BranchFactor). 0.05. The larger the BranchFactor, the more parallel branches there are, and the higher the value of the second threshold.
[0102] After determining the first and second thresholds, the anomaly score can be compared with the first and second thresholds to determine their relative magnitudes. If the anomaly score is less than the first threshold, it indicates a low impact of the anomaly, and the update strategy can be determined as a sub-task-level update. If the anomaly score is greater than or equal to the first threshold and less than the second threshold, it indicates a moderate impact of the anomaly, and the update strategy can be determined as a parent-task-level update. If the anomaly score is greater than or equal to the second threshold, it indicates a significant impact of the anomaly, and the update strategy can be determined as a global update.
[0103] Once the corresponding update strategy is determined, the agent can update the initial plan according to the update strategy. Each update strategy will be explained in detail below.
[0104] If the update strategy is a subtask-level update, when updating the initial plan according to the update strategy, the compensation target of the candidate subtask can be determined based on the defect data of the candidate subtask; a compensation task for the candidate subtask can be generated based on the compensation target of the candidate subtask; and a new initial plan can be obtained by adding the compensation task to all subtasks of a specified parent task, where the specified parent task is the abnormal parent task to which the candidate subtask belongs.
[0105] When the update strategy is at the subtask level, each candidate subtask can be analyzed to identify its defects and summarize the defect data. For example, if a candidate subtask has a first score of 0.3, indicating missing content, a deep analysis can be performed to compare the execution output of this candidate subtask with the expected output, identifying the specific missing data and treating it as defect data. Similarly, if the execution output of a candidate subtask uses the unit "ten thousand yuan," which is inconsistent with its parent task's requirement of "hundred million yuan," this can also be directly considered defect data. This step can utilize a corresponding large language model for analysis and reasoning.
[0106] For each candidate subtask, after analyzing its defective data, a compensation subtask that can compensate for the defective data can be generated. For example, for defective data with missing data, the generated compensation subtask could be to fill in the missing data; as another example, for defective data with incorrect data units, the generated compensation subtask could be to batch convert the data units to "hundred million yuan" without modifying the data itself.
[0107] In this process, a corresponding compensation subtask is generated for each candidate subtask to avoid omissions or confusion in compensation. For ease of description, the abnormal parent task to which the candidate subtask belongs is designated as the specified parent task. The compensation subtask is then added to all subtasks of this specified parent task to obtain a new initial plan.
[0108] For example, if the parent task is designated as P1, which contains 1-4 subtasks, a compensation subtask 1.1 is generated for subtask 1, and a corresponding compensation subtask 1.3 is generated for subtask 3. The following only shows the content after updating the designated parent task P1; the other parent tasks remain the same as in the previous example.
[0109] {
[0110] "id": "P1",
[0111] "description": "Collecting financial reports and news data from companies A and B",
[0112] "subtasks": [
[0113] { "id": "1", "description": "Using API to retrieve Company A's financial report (missing 2023Q4 data)"},
[0114] { "id": "2", "description": "Scraping and analyzing news sentiment about Company A (achieved)"},
[0115] { "id": "3", "description": "Using API to retrieve Company B's financial report (incorrect unit)"},
[0116] { "id": "4", "description": "Scraping and analyzing news sentiment about Company B (achieved)"},
[0117] { "id": "1.1", "description": "Supplementing Company A's 2023Q4 Revenue Data (Compensation T1)"}, / / Exclusive Compensation T1
[0118] { "id": "3.1", "description": "Convert Company B's financial statement data to RMB 100 million (Compensation T3)"} / / Exclusive Compensation T3 ]
[0120] }
[0121] Optionally, after generating the compensation subtask, the updated parent task can be restarted, the compensation subtask executed, and the execution output of the compensation subtask subjected to quality checks to ensure that the generated compensation subtask can fix the problem and that the parent task can execute normally.
[0122] If the update strategy is a parent task-level update, when updating the initial plan according to the update strategy, it can be done as follows: for each abnormal parent task, obtain the completed subtasks in the abnormal parent task as the first task; obtain the input data required by the next parent task of the abnormal parent task as the requirement data; combine the first task and the requirement data to generate a compensation parent task; insert the compensation parent task between the abnormal parent task and the next parent task to obtain a new initial plan.
[0123] When the update strategy is a parent task-level update, compensation needs to be performed at the parent task level. This compensation must strictly adhere to the principle of minimizing compensation and not expanding the functional scope. For each abnormal parent task, the completed subtasks within the abnormal parent task can be obtained. Completed subtasks refer to those that have passed quality inspection; these are designated as the first task. In the initial plan, parent tasks are executed sequentially according to their execution order, obtaining the input data required for the next parent task of the abnormal parent task, which serves as the requirement data. Combining the first task and the requirement data, a compensation parent task is generated. In this embodiment, one compensation parent task is generated first; in complex scenarios, two compensation parent tasks can be generated to avoid a lengthy process.
[0124] Optionally, when generating a compensation parent task, the requirement data of the first task that has been completed and subsequent parent tasks can be relied upon to analyze whether the first task can generate all the requirement data, and a new parent task can be generated based on the requirement data that cannot be generated by the first task, as a compensation parent task.
[0125] The generated compensation parent task can be directly inserted between the abnormal parent task and the next parent task to obtain a new initial plan. For example, if the execution order in the original initial plan is p1-p2-p3-p4, where p2 is the abnormal parent task and p3 is the next parent task, then the execution order in the updated initial plan is p1-p2-p_Repair-p3-p4.
[0126] If the update strategy is a global update, when updating the initial plan according to the update strategy, it can be done by taking all incomplete subtasks in a specified parent task as unprocessed subtasks, where the specified parent task is the abnormal parent task to which the candidate subtask belongs; taking all parent tasks after the specified parent task as unprocessed parent tasks; obtaining the outputs of all parent tasks before the specified parent task and the outputs of completed subtasks in the specified parent task to obtain unprocessed output data; generating a compensation plan using the unprocessed output data and the failure data of the candidate subtasks; and replacing the unprocessed subtasks and unprocessed parent tasks in the initial plan with the compensation plan to obtain a new initial plan.
[0127] When the update strategy is a global update, significant changes to the initial plan are required. For each candidate subtask, the abnormal parent task to which the candidate subtask belongs is obtained and designated as the specified parent task. All incomplete subtasks within the specified parent task are designated as pending subtasks. In other words, pending tasks are the subtasks within the specified parent task that have not yet been executed, have not been completed, or are candidate subtasks. Since parent tasks are executed sequentially, if an abnormality occurs in the specified parent task, all parent tasks following it cannot be executed; therefore, such parent tasks can be designated as pending parent tasks.
[0128] If the parent task before the specified parent task has been completed, and some subtasks in the specified parent task have also been successfully executed and completed, the output of such parent tasks and the output of the completed subtasks can be treated as output data to be processed. This part of the content can be retained as the basis for subsequent replanning.
[0129] A compensation plan is generated using the output data to be processed and the failure data of candidate subtasks. The output data clarifies the currently available resources, while the failure data of candidate subtasks identifies the targets that need adjustment. The agent can then use this information to invoke the task planning module to generate a new task sequence, i.e., the compensation plan. Based on the initial plan, the subtasks and auxiliary tasks to be processed can be pruned and incorporated into the generated compensation plan to obtain a new initial plan.
[0130] S150. Execute the pending tasks according to the updated initial plan.
[0131] After updating the initial plan according to the update strategy, an updated initial plan is obtained. The agent can continue to execute the pending tasks according to the updated initial plan. It should be noted that if an exception occurs when executing a task according to the updated initial plan, it can still be handled in the aforementioned manner until the pending tasks are completed and the deliverables of the pending tasks are output.
[0132] The agent-based task processing solution provided in this invention can be applied to various scenarios. For example, taking an intelligent office assistant within an enterprise as an example, when executing tasks, the intelligent office assistant plans tasks according to the format of serial parent tasks and parallel sub-tasks, executes sub-tasks in parallel to improve execution efficiency, and when encountering anomalies during execution, it can intelligently locate the problem and dynamically remedy it in the least costly way, reducing update overhead and redundant calculations while ensuring efficient task execution.
[0133] The method provided by this invention can reverse-engineer the data required for task execution and automatically identify independent subtasks, forming an initial plan for a parent task to be executed serially and subtasks to be executed in parallel. During task execution, quality checks or failure handling are performed based on the execution status of the subtasks to identify candidate subtasks. After evaluating the candidate subtasks according to preset dimensions to obtain multi-dimensional scores, an appropriate strategy is selected from multi-level update strategies at the subtask level, parent task level, and global update level based on the multi-dimensional scores to update the initial plan, reducing update overhead and ensuring efficient task execution.
[0134] To better implement the above methods, embodiments of the present invention also provide an agent-based task processing device, which can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0135] For example, in this embodiment, the method of the present invention will be described in detail by taking the integration of an agent-based task processing device into a server as an example.
[0136] For example, such as Figure 4 As shown, the agent-based task processing device 200 may include a plan generation module 210, a candidate determination module 220, a scoring module 230, a plan update module 240, and a processing module 250.
[0137] The plan generation module 210 is used to generate an initial plan based on the task objective of the task to be processed. The initial plan includes multiple parent tasks that are executed in sequence, and sub-tasks that are executed in parallel under each parent task.
[0138] The candidate determination module 220 is used to perform quality detection or failure processing on each subtask based on the execution status of the subtask in order to determine candidate subtasks.
[0139] The scoring module 230 is used to score the candidate sub-tasks according to multiple preset dimensions to obtain a multi-dimensional score for each candidate sub-task.
[0140] The plan update module 240 is used to update the initial plan for each abnormal parent task based on the multidimensional scores of all candidate subtasks under the abnormal parent task, wherein the abnormal parent task is a parent task with candidate subtasks.
[0141] Processing module 250 is used to execute the task to be processed according to the updated initial plan.
[0142] In some embodiments, the candidate determination module 220 is specifically used for:
[0143] When executing the parent task, obtain the execution status of each child task under the parent task, including execution success and execution failure;
[0144] If the execution status of the subtask is successful, perform quality detection processing on the subtask to determine candidate subtasks;
[0145] If the execution status of the subtask is execution failure, the subtask is processed to determine the candidate subtask.
[0146] In some embodiments, the candidate determination module 220 is specifically used for:
[0147] For each of the subtasks, obtain the tool call data for executing the subtask;
[0148] If there is abnormal data in the data called by the tool, the abnormal data is repaired and then the process is retried.
[0149] If the retry of the subtask is successful, a quality check is performed on the subtask to determine candidate subtasks;
[0150] If the subtask retry fails or there is no abnormal data in the tool call data, the subtask will be identified as a candidate subtask.
[0151] In some embodiments, the candidate determination module 220 is specifically used for:
[0152] For each of the subtasks, obtain the execution output of the subtask;
[0153] The execution output is compared and analyzed with the expected output of the subtask to determine the completeness of the subtask's output;
[0154] The execution output is subjected to compliance checks according to preset compliance dimensions to determine the compliance of the subtask's output.
[0155] Candidate subtasks are determined based on the output integrity and output compliance.
[0156] In some embodiments, the scoring module 230 is specifically used for:
[0157] Calculate the first score based on the execution output of the candidate subtask and the expected output of the candidate subtask;
[0158] Calculate the second score based on the degree of impact of the failure of the candidate sub-tasks;
[0159] The third score is calculated based on the contribution of the candidate subtasks to their parent tasks and the tasks to be processed.
[0160] The first score, the second score, and the third score are fused according to preset weights to obtain the multidimensional score of the candidate subtask.
[0161] In some embodiments, the planning update module 240 is specifically used for:
[0162] The abnormal score of the abnormal parent task is calculated based on the multidimensional scores of the candidate subtasks under the abnormal parent task and the total number of subtasks under the abnormal parent task.
[0163] An update strategy is determined based on the relationship between the anomaly score and the first and second thresholds. The first threshold is calculated based on the hierarchy of each parent task, and the second threshold is calculated based on the number of child tasks under each parent task. The first threshold is less than the second threshold.
[0164] The initial plan is updated according to the update strategy.
[0165] In some embodiments, the update strategy includes subtask-level updates, and the planned update module 240 is specifically used for:
[0166] By comparing the execution output of the candidate subtasks with the expected output, the defect data of the candidate subtasks are determined.
[0167] Based on the defect data of the candidate sub-tasks, generate compensation sub-tasks to make up for the defect data;
[0168] After adding the compensation subtask to all subtasks of the designated parent task, a new initial plan is obtained, where the designated parent task is the abnormal parent task to which the candidate subtask belongs.
[0169] In some embodiments, the update strategy includes a parent task-level update, and the planned update module 240 is specifically used for:
[0170] For each abnormal parent task, obtain the completed subtasks in the abnormal subtask and use them as the first task;
[0171] Obtain the input data required for the next parent task of the abnormal parent task, as the requirement data;
[0172] A compensation parent task is generated by combining the first task and the required data.
[0173] The compensation parent task is inserted between the abnormal parent task and the next parent task to obtain a new initial plan.
[0174] In some embodiments, the update strategy includes a global update, and the planned update module 240 is specifically used for:
[0175] All unfinished subtasks in the specified parent task are treated as unprocessed subtasks, where the specified parent task is the abnormal parent task to which the candidate subtask belongs.
[0176] Treat all parent tasks following the specified parent task as parent tasks to be processed.
[0177] Obtain the outputs of all parent tasks preceding the specified parent task and the outputs of completed subtasks within the specified parent task to obtain the output data to be processed;
[0178] A compensation plan is generated based on the output data to be processed and the failure data of the candidate subtasks;
[0179] The new initial plan is obtained by replacing the pending sub-tasks and pending parent tasks in the initial plan with the compensation plan.
[0180] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.
[0181] As can be seen from the above, the agent-based task processing device of this embodiment can generate an initial plan using the task objective of the task to be processed. The initial plan includes parent tasks to be executed sequentially, and sub-tasks to be executed in parallel under the parent tasks, maximizing the parallel potential between tasks and effectively improving execution efficiency. When executing a task, candidate sub-tasks with execution problems can be screened based on the execution status of the sub-tasks, and a multi-dimensional score for each candidate sub-task can be calculated according to preset dimensions. Taking into account the multi-dimensional scores of the candidate sub-tasks, an appropriate method is selected to update the initial plan, reducing computational overhead. Finally, the task continues to be executed according to the updated initial plan, which can ensure efficient task execution and low cost.
[0182] This invention also provides an electronic device, which can be a terminal, a server, or other similar devices. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0183] In some embodiments, the agent-based task processing device can also be integrated into multiple electronic devices, such as multiple servers, whereby the agent-based task processing method of the present invention is implemented by multiple servers.
[0184] In this embodiment, a server will be used as an example for detailed description. For example, ... Figure 5 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:
[0185] The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will understand that... Figure 5The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0186] The processor 310 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 320, and by calling data stored in the memory 320. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 310.
[0187] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.
[0188] The electronic device also includes a power supply 330 that supplies power to the various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 330 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0189] The electronic device may also include an input module 340, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0190] The electronic device may also include a communication module 350. In some embodiments, the communication module 350 may include a wireless module, through which the electronic device can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 350 can be used to help users send and receive emails, browse web pages, and access streaming media.
[0191] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 310 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 320 according to the following instructions, and the processor 310 runs the applications stored in the memory 320, thereby implementing the steps in the methods of the various embodiments of the present invention.
[0192] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0193] As can be seen from the above, the electronic device provided in this embodiment of the invention can generate an initial plan based on the task objective of the task to be processed. The initial plan includes parent tasks that are executed sequentially, and sub-tasks that are executed in parallel under the parent tasks, maximizing the parallel potential between tasks and effectively improving execution efficiency. When executing a task, candidate sub-tasks with execution problems can be screened based on the execution status of the sub-tasks, and a multi-dimensional score for each candidate sub-task can be calculated according to preset dimensions. Taking into account the multi-dimensional scores of the candidate sub-tasks, an appropriate method is selected to update the initial plan, reducing computational overhead. Finally, the task continues to be executed according to the updated initial plan, which can ensure efficient execution of the task at a low cost.
[0194] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0195] To this end, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions which can be loaded by a processor to execute steps in any of the agent-based task execution methods provided in embodiments of the present invention.
[0196] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0197] According to one aspect of the present invention, a computer program product or computer program is provided, comprising a computer program / instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instructions from the computer-readable storage medium and executes the computer program / instructions, causing the electronic device to perform the methods provided in various alternative implementations of the agent-based task processing aspects described in the above embodiments.
[0198] Since the instructions stored in the storage medium can execute the steps of any of the agent-based task processing methods provided in the embodiments of the present invention, the beneficial effects that any of the agent-based task processing methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0199] The above provides a detailed description of a task execution method and electronic device based on an intelligent agent provided by the embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A task processing method based on intelligent agents, characterized in that, The method includes: An initial plan is generated based on the task objective of the task to be processed. The initial plan includes multiple parent tasks that are executed in execution order, and sub-tasks that are executed in parallel under each parent task. For each subtask, a quality inspection or failure handling process is performed on the subtask based on its execution status to determine candidate subtasks. The candidate subtasks are scored according to multiple preset dimensions to obtain a multidimensional score for each candidate subtask. For each abnormal parent task, the initial plan is updated based on the multidimensional scores of all candidate subtasks under the abnormal parent task, where the abnormal parent task is the parent task with candidate subtasks. Execute the pending tasks according to the updated initial plan; The step of updating the initial plan based on the multidimensional scores of all candidate subtasks under the abnormal parent task includes: The abnormal score of the abnormal parent task is calculated based on the multidimensional scores of the candidate subtasks under the abnormal parent task and the total number of subtasks under the abnormal parent task. If the anomaly score is less than the first threshold, the update strategy is determined to be a subtask-level update, where the first threshold is calculated based on the hierarchy of each parent task. If the abnormal score is greater than or equal to the first threshold and less than the second threshold, the update strategy is determined to be parent task-level update, and the second threshold is calculated based on the number of child tasks under each parent task. If the abnormal score is greater than or equal to the second threshold, the update strategy is determined to be a global update; The initial plan is updated according to the update strategy.
2. The method according to claim 1, characterized in that, The step of performing quality inspection or failure handling on the subtasks based on their execution status to determine candidate subtasks includes: When executing the parent task, the execution status of each subtask under the parent task is obtained, and the execution status of the subtask includes execution success and execution failure. If the execution status of the subtask is successful, perform quality detection processing on the subtask to determine candidate subtasks; If the execution status of the subtask is execution failure, the subtask is processed to determine the candidate subtask.
3. The method according to claim 2, characterized in that, The failure handling of the subtask to determine candidate subtasks includes: For each of the subtasks, obtain the tool call data for executing the subtask; If there is abnormal data in the data called by the tool, the abnormal data is repaired and then the process is retried. If the retry of the subtask is successful, a quality check is performed on the subtask to determine candidate subtasks; If the subtask retry fails or there is no abnormal data in the tool call data, the subtask will be identified as a candidate subtask.
4. The method according to claim 2 or 3, characterized in that, The process of performing quality inspection on the subtasks to determine candidate subtasks includes: For each of the subtasks, obtain the execution output of the subtask; The execution output is compared and analyzed with the expected output of the subtask to determine the completeness of the subtask's output; The execution output is subjected to compliance checks according to preset compliance dimensions to determine the compliance of the subtask's output. Candidate subtasks are determined based on the output integrity and output compliance.
5. The method according to claim 1, characterized in that, The process of scoring the candidate subtasks according to multiple preset dimensions yields a multidimensional score for each candidate subtask, including: Calculate the first score based on the execution output of the candidate subtask and the expected output of the candidate subtask; Calculate the second score based on the degree of impact of the failure of the candidate sub-tasks; The third score is calculated based on the contribution of the candidate subtasks to their parent tasks and the tasks to be processed. The first score, the second score, and the third score are fused according to preset weights to obtain the multidimensional score of the candidate subtask.
6. The method according to claim 1, characterized in that, The update strategy includes sub-task level updates, and the update process for the initial plan according to the update strategy includes: By comparing the execution output of the candidate subtasks with the expected output, the defect data of the candidate subtasks are determined. Based on the defect data of the candidate sub-tasks, generate compensation sub-tasks to make up for the defect data; After adding the compensation subtask to all subtasks of the designated parent task, a new initial plan is obtained, where the designated parent task is the abnormal parent task to which the candidate subtask belongs.
7. The method according to claim 1, characterized in that, The update strategy includes parent task-level updates, and the update process for the initial plan according to the update strategy includes: For each abnormal parent task, obtain the completed subtasks in the abnormal parent task and use them as the first task; Obtain the input data required for the next parent task of the abnormal parent task, as the requirement data; A compensation parent task is generated by combining the first task and the required data. The compensation parent task is inserted between the abnormal parent task and the next parent task to obtain a new initial plan.
8. The method according to claim 1, characterized in that, The update strategy includes a global update, and the update process for the initial plan according to the update strategy includes: All unfinished subtasks in the specified parent task are designated as unprocessed subtasks, where the specified parent task is the abnormal parent task to which the candidate subtask belongs. Treat all parent tasks following the specified parent task as parent tasks to be processed. Obtain the outputs of all parent tasks preceding the specified parent task and the outputs of completed subtasks within the specified parent task to obtain the output data to be processed; A compensation plan is generated based on the output data to be processed and the failure data of the candidate subtasks; The new initial plan is obtained by replacing the pending sub-tasks and pending parent tasks in the initial plan with the compensation plan.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to execute the steps in the agent-based task processing method as described in any one of claims 1 to 8.