Reference trajectory optimization method, task processing method, intelligent agent and electronic device

CN122946530APending Publication Date: 2026-10-20UC MOBILE CHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610845873.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2026-04-01
Filing Date
2026-06-11
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

然而,在构建面向长周期、多步骤、高复杂度现实问题的LLM智能体时,传统技术仍存在以下显著缺陷:其一,成本与效率失衡

Benefits of technology

[0021]根据本公开的第四方面,还提供了一种电子设备,其特征在于,包括存储器和处理器,存储器用于存储计算机程序,处理器用于在计算机程序的控制下,执行根据本公开的第一方面或者第二方面所述的方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This disclosure relates to a reference trajectory optimization method, a task processing method, an intelligent agent, and an electronic device. The method includes: obtaining the execution trajectory corresponding to the target task; calling a preset trajectory quality quantification model to measure the execution quality of the execution trajectory and obtain a quality metric value of the execution trajectory; matching the target reference trajectory associated with the target task category in the intelligent agent's reference trajectory library; the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory serves as an execution reference for the intelligent agent to execute tasks under the associated task category; when a target reference trajectory is matched and the quality metric value of the execution trajectory is greater than the quality metric value of the target reference trajectory, the execution trajectory is used as a reference trajectory for the target task category and saved in the reference trajectory library.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims domestic priority from the following earlier application: filed on April 1, 2026; application number 202610427863.X; invention title: Reference Trajectory Optimization Method, Task Processing Method, Intelligent Agent and Electronic Device. Technical Field

[0002] This disclosure relates to the field of artificial intelligence technology, and more specifically, to a reference trajectory optimization method and electronic device. Background Technology

[0003] In recent years, large-scale language models (LLMs) based on the Transformer architecture have made groundbreaking progress and have been widely used in complex cognitive tasks such as code generation and data analysis. However, when building LLM agents for long-cycle, multi-step, and highly complex real-world problems, traditional technologies still have the following significant drawbacks: First, there is an imbalance between cost and efficiency. Existing architectures generally adopt a "single flagship model for all" strategy, calling high-cost models even for simple tasks, resulting in wasted computing power. Although there are model routing attempts such as RouteLLM, they are mostly based on static text features or binary selection, lacking dynamic comprehensive assessment of task risk, logical depth, and tool dependence, making it difficult to achieve cost optimization while ensuring reliability. Second, the physical limitations of the context window lead to the omission of key information. Even when the window is expanded to the level of millions of tokens, the problem of attention diversion becomes prominent. Solutions such as MemGPT use pagination management, but the information retrieval strategy is coarse, lacking fine-grained budget control of information value, and RAG systems are prone to losing logical reference paths, and excessive loading of tool definitions also causes "context pollution." Third, experience cannot be persisted. Current systems are mostly stateless, and successful paths and lessons learned from failures are lost when the session ends. There is a lack of mechanisms to extract negative constraints in real time and dynamically inject them into subsequent tasks, which leads to the recurrence of similar errors. Summary of the Invention

[0004] One objective of this disclosure is to provide a new technical solution for the self-evolution of an intelligent agent system.

[0005] According to a first aspect of this disclosure, a reference trajectory optimization method is provided, characterized in that it is applied to an intelligent agent, the method comprising: Obtain the execution trajectory corresponding to the target task; The preset trajectory quality quantization model is invoked to measure the execution quality of the execution trajectory and obtain the quality metric value of the execution trajectory. In the reference trajectory library of the intelligent agent, the target reference trajectory associated with the target task category to which the target task belongs is matched; wherein, the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory serves as the execution reference for the intelligent agent to execute tasks under the associated task category; If a target reference trajectory is matched and the quality metric of the execution trajectory is greater than that of the target reference trajectory, the execution trajectory will be used as the reference trajectory for the target task category and saved in the reference trajectory library.

[0006] Optionally, the trajectory quality quantification model includes a first type of metric for quantifying the degree of completion of the execution trajectory with respect to the target task, and a second type of metric for quantifying the execution efficiency of the execution trajectory.

[0007] Optionally, the second type of metrics includes at least some of the time efficiency metrics, resource efficiency metrics, and path efficiency metrics; Among them, the time efficiency index is used to quantify the time cost of the execution trajectory, the resource efficiency index is used to quantify the computational resource consumption of the execution trajectory, and the path efficiency index is used to quantify the closeness of the trajectory length of the execution trajectory to the baseline trajectory length of the target task category.

[0008] Optionally, the second type of metric includes path efficiency metrics, and the method further includes: Based on the execution trajectory, the target task is explored to obtain multiple executable trajectories corresponding to the target task; Based on the trajectory lengths of multiple executable trajectories, the baseline trajectory length for the target task category is obtained.

[0009] Optionally, the second type of metric includes path efficiency metrics, and the method further includes: When the first type of metric value of the execution trajectory is at its maximum value and the trajectory length of the execution trajectory is less than the baseline trajectory length, the baseline trajectory length of the target task category is updated by weighting the trajectory length of the execution trajectory with the baseline trajectory length. The weighting of the trajectory length of the execution trajectory is determined based on the set evolution rate.

[0010] Optionally, in the agent's reference trajectory library, a target reference trajectory belonging to the task category of the target task is matched, including: Based on the semantic similarity between the execution trajectory and each reference trajectory in the reference trajectory library, the target reference trajectory of the task category to which the target task belongs is obtained.

[0011] Optionally, the above method further includes: If no target reference trajectory is found and the reference trajectory library is full, low-value reference trajectories in the reference trajectory library are filtered out based on the quality metric value and call frequency of each reference trajectory in the library. Remove low-value reference tracks from the reference track library and create a target task category in the reference track library; The execution trajectory is used as a reference trajectory for the target task category and saved in the reference trajectory library.

[0012] Optionally, if the quality metric of the execution trajectory is less than a preset metric threshold, the method further includes: Feature extraction is performed on the execution trajectory to obtain an error feature set of the execution trajectory; wherein, the error feature set includes at least one type of information from the error information and logical dead loop point information of the execution trajectory; The set of error features of the execution trajectory is converted into natural language to obtain the negative constraints corresponding to the execution trajectory; The negative constraints corresponding to the execution trajectory are used as execution constraints for the target task category and stored in the constraint rule base of the agent.

[0013] Optionally, before obtaining the execution trajectory corresponding to the target task, the method further includes: The complexity of the target task is classified into levels to determine the complexity level of the target task; Determine the target model for handling the target task based on its complexity level. The target model is invoked to execute the target task, and the execution trajectory corresponding to the target task is obtained.

[0014] Optionally, the complexity of the target task is graded to determine its complexity level, including: The task complexity metric model is invoked to measure the execution complexity of the target task and obtain the complexity metric value of the target task. The task complexity metric model includes at least some of the following metrics: logical complexity metric, risk coefficient metric, and output length metric. Based on the pre-defined mapping relationship between complexity metric ranges and complexity levels, and the complexity metric of the target task, the complexity level of the target task is determined.

[0015] Optionally, the target model is invoked to perform the target task, including: Semantic analysis of the target task yields multiple skill keywords corresponding to the target task; Tool retrieval is performed based on multiple skill keywords to obtain toolkits corresponding to those keywords; these toolkits are dynamically injected into system prompts during the target model's processing of the target task. The target model is invoked, and the target task is executed based on the dynamically injected toolkit.

[0016] Optionally, invoking the target model to perform the target task includes: Perform load monitoring on the context window of the target model; If the load on the context window exceeds a preset security threshold, the current messages in the context window are filtered to obtain the target message block; among them, the message block to be replaced is the part of the context window that has been unused for the longest time or has the least relevance to the current processing node. The target message block is compressed to obtain an indexed summary entry corresponding to the target message block, which is then stored in the long-term cache of the context window. Move the target message block to the preset persistent storage area.

[0017] Optionally, the above method further includes: If missing information is detected during context processing of the target task, the summary entry corresponding to the missing information is matched; wherein, the missing information includes at least a portion of message blocks in a preset persistent storage area; Based on the index carried by the summary entry, load the message block corresponding to the missing information from the preset persistent storage area into the context window.

[0018] Optionally, the target model is invoked to perform the target task, including: Based on the storage occupancy rate of the reference trajectory library, the trajectory exploration index value is determined; whereby the trajectory exploration index value characterizes the intensity of trajectory exploration that the target model should perform in order to process the target task. The target model is invoked, and the target task is executed guided by the trajectory exploration index value.

[0019] According to a second aspect of this disclosure, a task processing method is also provided, applied to an intelligent agent, the method comprising: In response to a user's task request, extract the current task carried in the task request; Determine the target model for performing the current task; Based on the task category to which the current task belongs, the reference trajectory associated with the task category to which the current task belongs is matched from the reference trajectory library; wherein, the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory serves as an execution reference for the agent to execute tasks under the associated task category, and the reference trajectory library is updated by using the historical tasks executed by the agent as the target task and executing the method described in accordance with the first aspect of this disclosure; Based on the current reference trajectory, the target model is invoked to execute the current task.

[0020] According to a third aspect of this disclosure, an intelligent agent is also provided, comprising: The trajectory acquisition module is used to acquire the execution trajectory corresponding to the target task; The quality measurement module is used to call a preset trajectory quality quantification model to measure the execution quality of the execution trajectory and obtain the quality measurement value of the execution trajectory. A reference trajectory library is used to store reference trajectories associated with multiple task categories. The reference trajectories serve as execution references for the intelligent agent when executing tasks under the associated task categories. The trajectory matching module is used to match the target reference trajectory associated with the target task category to which the target task belongs in the reference trajectory library; and, The trajectory update module is used to save the execution trajectory as a reference trajectory for the target task category in the reference trajectory library when the target reference trajectory is matched and the quality metric value of the execution trajectory is greater than that of the target reference trajectory.

[0021] According to a fourth aspect of this disclosure, an electronic device is also provided, characterized in that it includes a memory and a processor, the memory being used to store a computer program, and the processor being used to execute, under the control of the computer program, the method described according to the first or second aspect of this disclosure.

[0022] One beneficial effect of this embodiment is that, based on the execution trajectory of the target task, the quality metric value of the execution trajectory is measured by quantifying the completion degree and execution efficiency of the target task. The target reference trajectory is matched with the target reference trajectory associated with the target task category from the agent's reference trajectory library. The reference trajectory of the target task category is updated based on the comparison result between the quality metric value of the execution trajectory and the quality metric value of the target reference trajectory. This method quantifies the execution quality of the agent's task processing trajectory from multiple dimensions, and updates the agent's reference trajectory library based on the quality metric value, thereby optimizing the reference trajectory of the agent's task processing and achieving self-evolution of the agent's processing capabilities. This improves the agent's efficiency and accuracy in handling long-cycle, multi-step, and highly complex real-world problems.

[0023] The features and advantages of the embodiments of this specification will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of this specification and, together with their description, serve to explain the principles of these embodiments.

[0025] Figure 1 A schematic diagram of the structure for implementing an intelligent agent system according to some embodiments is shown; Figure 2 A flowchart illustrating the reference trajectory optimization method according to the first embodiment is shown; Figure 3 A flowchart illustrating the reference trajectory optimization method according to the second embodiment is shown; Figure 4 A flowchart illustrating the execution of the target task and the optimization of the corresponding reference trajectory based on the reference trajectory is shown. Figure 5A flowchart illustrating the reference trajectory optimization method according to the third embodiment is shown; Figure 6 A flowchart illustrating the task processing method according to the fourth embodiment is shown; Figure 7 A schematic diagram of the structure of the intelligent agent according to the fifth embodiment is shown; Figure 8 A schematic diagram of the hardware structure of an electronic device according to some embodiments is shown. Detailed Implementation

[0026] Various exemplary embodiments of this specification will now be described in detail with reference to the accompanying drawings.

[0027] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the embodiments of this specification or their application or use.

[0028] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0029] It should be noted that all actions involving the acquisition of signals, information, or data in this embodiment are carried out in compliance with the relevant data protection laws and regulations of the country where the location is situated, and with authorization from the owner of the relevant equipment.

[0030] This disclosure relates to a technical solution for a self-optimizing reference trajectory library for intelligent agent systems, such as those used for processing user natural language tasks, providing an effective reference for optimizing the processing capabilities of intelligent agent systems for user natural language tasks under unsupervised conditions. The technical solutions provided in this disclosure are applicable to systems based on natural language models, as well as other systems based on non-natural language models, such as image-language models and decision models.

[0031] Because agent systems often employ stateless designs when optimizing their ability to process user natural language tasks under unsupervised conditions, successful paths are lost upon the end of the session. There is a lack of mechanisms to extract successful paths in real-time and update the reference path library based on task categories. This leads to low efficiency in processing similar tasks or an inability to adapt to differences in actual tasks. Therefore, the inventors propose an agent reference path optimization method based on a self-updating reference path library. This method not only improves the agent's task execution efficiency by self-updating the reference path library, but also further enhances task execution quality when the agent processes tasks of the associated task categories by measuring the execution quality of the trajectory during optimization using quality metrics calculated based on task completion and execution efficiency.

[0032] Figure 1 An intelligent agent system to which the methods of embodiments of this disclosure can be applied is shown, such as Figure 1 As shown, the terminal device 1100 may include a processor 1101, a memory 1102, an interface device 1103, a communication device 1104, an output device 1105, an input device 1106, etc. Figure 1 The hardware configuration shown is illustrative only and is not intended to limit this disclosure, its application, or its use.

[0033] The processor 1101 executes computer programs, which can be written using instruction sets of architectures such as x86, Arm, RISC, MIPS, and SSE. The memory 1102 includes, for example, ROM (Read-Only Memory), RAM (Random Access Memory), and non-volatile memory such as a hard disk. The interface device 1103 includes, for example, a USB interface, a network cable interface, and a headphone jack. The communication device 1104 is capable of wired or wireless communication. The communication device 1104 may include at least one short-range communication module, such as any module for short-range wireless communication based on short-range wireless communication protocols such as Hilink, WiFi (IEEE 802.11), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, and LiFi. The communication device 1104 may also include a long-range communication module, such as any module for WLAN, GPRS, or 2G / 3G / 4G / 5G long-range communication. The output device 1105 may include, for example, an LCD screen or touch screen, and a speaker. Input device 1106 may include, for example, a touch screen, a keyboard, a microphone, various sensors, etc.

[0034] In this embodiment, the memory 1102 of the terminal device 1100 is used to store a computer program that controls the processor 1101 to perform reference trajectory optimization method steps executed by the terminal device according to any embodiment of this disclosure.

[0035] like Figure 1 As shown, the server 1200 may include a processor 1201, a memory 1202, an interface device 1203, a communication device 1204, an output device 1205, an input device 1206, etc. Figure 1 The hardware configuration shown is illustrative only and is not intended to limit this disclosure, its application, or its use.

[0036] The processor 1201 executes computer programs, which can be written using instruction sets of architectures such as x86, Arm, RISC, MIPS, and SSE. The memory 1202 includes, for example, ROM (Read-Only Memory), RAM (Random Access Memory), and non-volatile memory such as a hard disk. The interface device 1203 includes, for example, a USB interface, a network cable interface, and a headphone jack. The communication device 1204 is capable of wired or wireless communication. The communication device 1204 may include at least one short-range communication module, such as any module for short-range wireless communication based on short-range wireless communication protocols such as Hilink, WiFi (IEEE 802.12), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, and LiFi. The communication device 1204 may also include a long-range communication module, such as any module for WLAN, GPRS, or 2G / 3G / 4G / 5G long-range communication. The output device 1205 may include, for example, an LCD screen or touch screen, and a speaker. Input device 1206 may include, for example, a touch screen, a keyboard, a microphone, various sensors, etc.

[0037] In this embodiment, the memory 1202 of the server 1200 is used to store a computer program that controls the processor 1201 to operate in order to execute the reference trajectory optimization method steps executed by the server according to any embodiment of the present disclosure.

[0038] Server 1200 can be any server, and this disclosure does not limit it.

[0039] Terminal device 1100 and server 1200 exchange data via a communication network, which can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network can include any one or more of the following: the Internet, intranet, wide area network (WAN), local area network (LAN), wireless network, digital subscriber line (DSL) network, frame relay network, asynchronous transfer mode (ATM) network, virtual private network (VPN), and / or any other suitable communication network. Terminal device 1100 and server 1200 can be connected to the communication network via one or more communication links. The communication link can be any communication link suitable for transmitting data between terminal device 1100 and server 1200, such as a network link, dial-up link, wireless link, hardwired link, any other suitable communication link, or any suitable combination of such links.

[0040] The following is combined Figure 1 The system shown illustrates the reference trajectory optimization method provided in the embodiments of this disclosure. It should be noted that... Figure 1 This is merely one application scenario of the reference trajectory optimization method provided in this disclosure embodiment, and does not mean that the reference trajectory optimization method can only be applied to... Figure 1 The application scenarios shown.

[0041] <First Embodiment> Figure 2 A flowchart illustrating a reference trajectory optimization method for an intelligent agent according to some embodiments is shown. The reference trajectory optimization method may include the following steps S210 to S240: Step S210: Obtain the execution trajectory corresponding to the target task.

[0042] This disclosure uses the Large Language Model (LLM) model used by the agent as an example to explain the reference trajectory optimization method.

[0043] In step S210, execution information of the target model performing the target task can be obtained. This execution information may include each processing step and tool used during the execution of the target task by the target model, as well as the corresponding processing results. It may also include error information and / or logical dead loop information of the target model during the execution of the target task. An execution trajectory corresponding to the execution of the target task by the target model is generated from this execution information. The execution trajectory can describe the execution process of the target model in a tree structure or in an execution flow; neither is limited here.

[0044] Understandably, the execution information during a task execution process can also be formed based on a four-tuple chain of user query, thought, action, and result. The user's query can include the task instructions or goals input by the user, and contextual information. Thought includes process information such as parsing and recognizing the user's intent, task planning, and tool selection. Action includes information such as tool invocation, function execution, intermediate states, or outputs. The result includes the raw or processed results returned by the intelligent agent, the task's status, or error information.

[0045] Step S220: Call the preset trajectory quality quantization model to measure the execution quality of the execution trajectory and obtain the quality metric value of the execution trajectory.

[0046] The preset trajectory quality quantification model is used to measure the execution quality of the execution trajectory. This trajectory quality quantification model mainly considers two types of measurement indicators: the completion degree of the execution trajectory with respect to the target task and the execution efficiency, and measures the execution quality of the execution trajectory from multiple dimensions.

[0047] In some examples, the trajectory quality quantification model includes a first type of metric for quantifying the degree to which the execution trajectory completes the target task, and a second type of metric for quantifying the execution efficiency of the execution trajectory.

[0048] In this example, the first type of metric ( This metric is used to quantify the degree to which the execution trajectory completes the target task or the proportion of correct execution in the processing of the execution trajectory. This metric can be obtained directly from the execution results of the target model or determined through environmental feedback. Environmental feedback can be derived from the execution results by working backward from the code level, comparing the differences between the code corresponding to the execution trajectory and the reverse-derived code, thereby reflecting the degree to which the execution trajectory completes the target task or the proportion of correct execution.

[0049] The second type of metric is used to quantify the execution efficiency of the execution trajectory. This metric can include at least some of the time efficiency, resource efficiency, and path efficiency metrics.

[0050] Quality metrics of the target task The weighted sum of the individual indicator values ​​for each metric can be used to determine the metrics. For example, the second type of metric includes the aforementioned time efficiency, resource efficiency, and path efficiency metrics, with weights of 1, 2, 3, and 4 respectively. The weight of the first type of metric is Quality metrics of the target task It can be represented as:

[0051] Time efficiency indicators This is used to quantify the time cost of executing a trajectory. Taking a conversational agent as an example, the time consumed in executing a user-initiated target task should be within the user's acceptable time range. Therefore, in measuring the execution quality of a trajectory, the time efficiency index can be used as a quality penalty to suppress the latency of subsequent trajectories entering the reference trajectory library.

[0052] Resource efficiency indicators This metric is used to quantify the computational resource consumption of the execution trajectory. It primarily represents the amount of tokens consumed by the target model during the processing of the target task. In measuring the execution quality of the execution trajectory, the resource efficiency metric can serve as a resource consumption penalty, encouraging the target model to streamline text and reduce token consumption during subsequent processing of the target task.

[0053] Path efficiency metrics Trajectory length used for quantizing execution trajectory Length of the baseline trajectory for the target task category The degree of proximity. Path efficiency metrics can be determined by the execution trajectory length and the baseline trajectory length. The execution trajectory length is the total number of steps in the execution trajectory processing flow, while the baseline trajectory length is the shortest trajectory length for the inferred target model to execute the target task.

[0054] In these examples, for the baseline trajectory length, the target task can be explored based on the execution trajectory to obtain multiple executable trajectories corresponding to the target task; based on the trajectory lengths of the multiple executable trajectories, the baseline trajectory length of the target task category can be obtained.

[0055] For the execution trajectory, the agent asynchronously calls the flagship large language model to examine the trajectory. Based on the execution trajectory, it explores more feasible trajectories for executing the target task, reconstructing the shortest trajectory, and using the length of this trajectory as the baseline trajectory length. Trajectory exploration involves matching multiple processing methods as processing points at each processing layer during task processing. The next processing step corresponding to different processing methods may be in the next processing layer or may span multiple processing layers. The baseline trajectory length is based on the trajectory found after trajectory exploration, which traverses the fewest processing layers. The number of processing layers traversed by this trajectory, i.e., the number of processing steps, is used as the baseline trajectory length.

[0056] The asynchronous call to the flagship large language model for trajectory exploration can be used for low-intensity, simple task trajectory exploration online, prioritizing immediacy and avoiding excessive exploration. Alternatively, it can be used offline for high-intensity, complex task trajectory exploration, emphasizing comprehensiveness and detailed exploration, resulting in higher confidence and accuracy of the exploration results.

[0057] In other examples, for the baseline trajectory length, if the first type of metric value of the execution trajectory is at its maximum value and the trajectory length of the execution trajectory is less than the baseline trajectory length, the baseline trajectory length of the target task category can be updated by weighting the trajectory length of the execution trajectory with the baseline trajectory length. The weighting of the trajectory length of the execution trajectory is determined based on a set evolution rate.

[0058] In this example, a smoothing algorithm is provided. When the first type of metric value of the execution trajectory is at its maximum value and the trajectory length of the execution trajectory is less than the baseline trajectory length, it indicates that the execution trajectory is more efficient than the baseline trajectory length. However, in order to prevent the baseline trajectory length from evolving too quickly due to occasional special tasks, this embodiment presets an evolution rate factor, which can be 0.1 to 0.3. Based on this evolution rate factor, a weighted operation is performed on the trajectory length of the execution trajectory and the baseline trajectory length, and the obtained weighted result is used to update the baseline trajectory length of the target task category.

[0059] Except when the first type of metric value of the execution trajectory is at its maximum value and the trajectory length of the execution trajectory is less than the baseline trajectory length, the baseline trajectory length of the updated target task category is the same as before the update.

[0060] In some examples, the baseline trajectory length for the target task category is updated after the path efficiency metric is calculated. The updated baseline trajectory length for the target task category is used as the baseline trajectory length when the agent executes the task for that target task category again. In other words, the baseline trajectory length used in the measurement of the trajectory quality of the target task's execution trajectory is obtained through a smoothing algorithm when the agent previously executed the task for that target task category.

[0061] In other examples, the baseline trajectory length for the target task category is updated before calculating the path efficiency metric. This is achieved by updating the baseline trajectory length of the target task category from the previous update, and then using the updated baseline trajectory length as the baseline trajectory length for calculating the target task's path efficiency metric.

[0062] Step S230: In the reference trajectory library of the agent, match the target reference trajectory associated with the target task category to which the target task belongs; wherein, the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory is the execution reference for the agent to execute tasks under the associated task category.

[0063] After calculating the quality metric of the execution trajectory, it is necessary to match the target reference trajectory of the same task category as the target task from the agent's reference trajectory library, so as to use it as the benchmark for updating the reference trajectory of the target task category.

[0064] In some examples, the matching of target reference trajectories to the target task category is based on the semantic similarity between the execution trajectory and each reference trajectory in the reference trajectory library.

[0065] Since the execution trajectory and the target reference trajectory belong to the same task category, and the agent may also call the reference trajectory of the target task category from the reference trajectory library as an execution reference when processing the target task, it is feasible to match the execution trajectory with the target reference trajectory through semantic similarity.

[0066] For example, a reference trajectory with a similarity greater than a preset similarity threshold can be matched in the semantic vector space of the reference trajectory library as the target reference trajectory.

[0067] Step S240: If a target reference trajectory is matched and the quality metric value of the execution trajectory is greater than that of the target reference trajectory, the execution trajectory is used as a reference trajectory for the target task category and saved in the reference trajectory library.

[0068] The update of the reference trajectory library for the agent adopts the logic of selecting the best option. When the quality metric value of the execution trajectory is greater than that of the target reference trajectory, the execution trajectory replaces the target reference trajectory as the reference trajectory for the target task category.

[0069] In some examples, when no target reference trajectory is matched and the reference trajectory library is full, low-value reference trajectories in the reference trajectory library are filtered out based on the quality metric value and call frequency of each reference trajectory in the reference trajectory library; the low-value reference trajectories are removed from the reference trajectory library, and a target task category is created in the reference trajectory library; the execution trajectory is used as the reference trajectory for the target task category and saved in the reference trajectory library.

[0070] The agent's reference trajectory library may not contain reference trajectories belonging to the same task category as the target task. In this case, semantic similarity matching between the execution trajectory and the reference trajectories in the library will fail to find a target reference trajectory whose semantic similarity exceeds a preset similarity threshold. In the early stages of the agent's self-evolution, the reference trajectory library is not yet full. When encountering such an execution trajectory, the agent can directly create a target task category corresponding to the target task in the library and save the execution trajectory as a reference trajectory for that target task category. However, in the middle and later stages of the agent's self-evolution, the reference trajectory library may become full. In this case, the agent needs to calculate the retention value of each reference trajectory in the library based on dimensions such as trajectory quality and frequency of invocation. The reference trajectory with the lowest retention value is designated as a low-value reference trajectory, and it and its corresponding task category are removed from the library. The execution trajectory and the target task category are then saved into the reference trajectory library.

[0071] In some examples, the execution trajectory needs to be purified before it is stored in the reference trajectory library. This involves removing redundant trial steps, invalid thinking steps, and intermediate errors from the execution trajectory, keeping only the main body of the execution trajectory, and then using a large language model to replace specific parameters (such as specific file names, IP addresses, etc.) in the execution trajectory with placeholders, thus converting the execution trajectory into a template-style trajectory, i.e., the reference trajectory.

[0072] In other examples, when the quality metric of the execution trajectory is less than a preset metric threshold, feature extraction is performed on the execution trajectory to obtain an error feature set of the execution trajectory. The error feature set includes at least one type of information, namely, error information and logical dead loop point information of the execution trajectory. The error feature set of the execution trajectory is converted into natural language to obtain the negative constraints corresponding to the execution trajectory. The negative constraints corresponding to the execution trajectory are used as execution constraints of the target task category and stored in the constraint rule base of the agent.

[0073] When the quality metric of the execution trajectory is less than a preset threshold, the execution result of the target task corresponding to the execution trajectory is considered a failure. In this case, the agent calls a large language model to perform attribution analysis, extracts error features (such as error messages, logical dead loops, etc.) from the execution trajectory, and generates a natural language rule based on the extracted set of error features. This rule, which is the negative constraint corresponding to the execution trajectory, is then stored in the constraint rule base under the task category corresponding to the target task.

[0074] For example, if the target task fails to execute because the non-existent library pandas.tslib (which is deprecated) was used, the agent generates a natural language rule "When processing time series, the use of pandas.tslib is prohibited, and pandas / tseries should be used instead" as a negative constraint for the target task category and stores it in the constraint rule library. When the agent encounters a similar task to the target task again, it will call this negative constraint from the constraint rule library.

[0075] This disclosure provides a reference trajectory optimization method. Based on the execution trajectory of a target task, it measures the quality metric of the execution trajectory by quantifying the completion degree and execution efficiency of the target task. It then matches the target reference trajectory associated with the target task category from the agent's reference trajectory library. The method updates the reference trajectory of the target task category based on the comparison between the quality metric of the execution trajectory and the quality metric of the target reference trajectory. This method quantifies the execution quality of the agent's task processing trajectory from multiple dimensions and updates the agent's reference trajectory library based on the quality metric, thereby optimizing the reference trajectory of the agent's task processing. This enables the self-evolution of the agent's processing capabilities and improves the agent's efficiency and accuracy in handling long-cycle, multi-step, and highly complex real-world problems.

[0076] <Second Embodiment> Figure 3 A flowchart illustrating the steps of a method for obtaining the execution trajectory of a target task according to some embodiments is shown. Figure 4 A schematic diagram of the structure of an intelligent agent system according to some embodiments is shown. Figure 4 This schematically illustrates the entire process from the agent parsing the target task to the agent optimizing the reference trajectory library based on the execution trajectory of the target task. Figure 4 The "Target Task Analysis" section in the text is related to... Figure 3 The steps shown correspond to the steps described. Figure 4 The "reference trajectory optimization" section corresponds to the method steps provided in the first embodiment.

[0077] In this embodiment, after receiving the target task input by the user, the agent selects the corresponding language model as the target model by classifying the complexity, and retrieves the corresponding toolkit by predicting the intent of the target task, and provides it to the target model in a delayed dynamic injection manner.

[0078] like Figure 3 As shown, the intelligent agent analyzes the target task to obtain its execution trajectory, which may include the following steps S310 and S330: Step S310: Classify the complexity of the target task to determine its complexity level.

[0079] Corresponding to Figure 4 The complexity classification in the algorithm involves classifying the complexity of the target task after the agent receives the user's input. This is done using a lightweight feature extraction network or a rule-based heuristic algorithm to facilitate the classified processing of the target task.

[0080] In some examples, a preset task complexity metric model is invoked to measure the task execution complexity of the target task and obtain the complexity metric value of the target task. The task complexity metric model includes at least some of the following metrics: logical complexity metric, risk coefficient metric, and output length metric. Based on the preset mapping relationship between the complexity metric value range and the complexity level and the complexity metric value of the target task, the complexity level of the target task is determined.

[0081] In this example, the complexity metric of the target task The weighted summation of each indicator's value for the target task can be used to determine the weights. For example, the preset indicator set includes the aforementioned logical complexity indicator, risk coefficient indicator, and output length indicator, with weights of 1, 2, 3, and 4 respectively. , And the grading threshold function is H, which is the complexity metric of the target task. It can be represented as:

[0082] In the pre-defined task complexity metric model, the logical complexity index It is calculated by analyzing the syntactic depth of the text input by the user for the target task and the complexity of the domain terminology involved; risk coefficient index This indicates the risk level of the task. Instructions involving financial transactions, medical advice, system-level deletion operations, and API key processing are assigned high-risk values. For tasks with high-risk values, the agent will use a high-order model with strong safety alignment when assigning the target model to ensure compliance and security; output length indicator. This refers to the expected output length and contextual dependence. For example, the output length metric for generating a long report is higher than the output length metric for answering true / false questions.

[0083] In addition to the aforementioned logical complexity, risk coefficient, and output length metrics, the task complexity metric model also includes adjustable weight coefficients. Each metric has a corresponding weight coefficient, which can be configured according to the application scenario.

[0084] And a hierarchical threshold function, used to map continuous complexity metrics to discrete model levels, so as to obtain the complexity level corresponding to the complexity metric interval in which the complexity metric of the target task is located.

[0085] Step S320: Determine the target model for processing the target task based on the complexity level of the target task.

[0086] Corresponding to Figure 4 The system uses n language models categorized by complexity. For tasks of different complexity levels, the agent calls upon models or groups of models with varying strengths or capabilities to handle them. For example, the complexity can be divided into three levels: simple, medium, and hard. The simple level can use a small language model, the hard level can use a flagship large language model, and the medium level can use a combination of small and flagship large language models in a collaborative manner. That is, the small language model is responsible for quickly generating drafts, while the flagship large language model is responsible for validating the drafts and rewriting them if they are not up to standard.

[0087] Step S330: Call the target model to execute the target task and obtain the execution trajectory corresponding to the target task.

[0088] The system executes the target task based on the target model corresponding to the complexity level of the target task, obtains the execution result of the target task, feeds it back to the user, and provides data for updating the reference trajectory library and constraint rule library.

[0089] In some examples, the execution of a target task may include performing semantic analysis on the target task to obtain multiple skill keywords corresponding to the target task; performing tool retrieval based on the multiple skill keywords to obtain toolkits corresponding to the multiple skill keywords; wherein, the toolkits are dynamically injected into the system prompts during the target model's processing of the target task; and the target model is invoked to execute the target task based on the dynamically injected toolkits.

[0090] The target model needs to use multiple toolkits of different skills to process the context differently during the execution of the target task. Corresponding to Figure 4In intent prediction, after receiving the target task, the target model first performs semantic analysis on the natural language input by the user in the target task. The main purpose of this semantic analysis is to analyze the user's intent and provide skill keywords or categories of tools that may be needed based on the obtained user intent.

[0091] For example, if a user inputs "Help me check my AWS bill from last week and list more than 100 services", the semantic analysis of the target model will yield the skill keywords ["cloud_billing_query", "data_filtering", "aws_cost_explorer"].

[0092] Corresponding to Figure 4 The tool retrieval function transforms the skill keywords output by the target model into high-dimensional skill vectors. The agent maintains a private skill vector database (corresponding to...). Figure 4 The tool database (in the context of the database) stores toolkits for various available tools and vector indexes describing the functions of these tools. Based on the high-order skill vectors corresponding to skill keywords, the definitions of the top n tools, ranked by relevance, are retrieved from the skill vector database. n can be set to 3, and this disclosure does not impose any limitation. This process supports cross-task retrieval and hybrid retrieval to ensure that even when users use non-standard terminology, they can still find the correct tools through semantic similarity.

[0093] Corresponding to Figure 4 The tool is injected late, and the retrieved complete toolkit (JSON Schema) is injected into the system prompt in the context window of the current session during the execution of the target task by the target model. That is, the complete toolkit of a tool is only given to the target model when the target model needs to use a certain tool.

[0094] In this embodiment, providing a toolkit for the target model can save the number of tokens occupied by tools in the context, and can also avoid the interference of too many tools on the accuracy of the target model's use of tools. In addition, for the invocation of sensitive tools such as database write operations, permission control can be added in the tool retrieval stage to restrict the invocation of sensitive tools according to the user's usage permissions.

[0095] <Third Embodiment> Figure 5 A flowchart illustrating a reference trajectory optimization method according to some embodiments is shown. Unlike the first embodiment described above, the reference trajectory optimization method provided in this embodiment is aimed at the process of the target model performing a target task. For example... Figure 5 As shown, the reference trajectory optimization method of this embodiment may include the following steps S510 and S540: Step S510: Perform load monitoring on the context window of the target model.

[0096] When the target model processes the context corresponding to the target task, the target model splits the context into multiple parts through the context window for processing, and the load of the context window is monitored during the target model's processing.

[0097] Step S520: If the load on the context window exceeds a preset security threshold, the current messages in the context window are filtered to obtain target message blocks; among them, the message blocks to be replaced are the messages in the context window that have been unused for the longest time or have the least correlation with the current processing node.

[0098] A preset safety threshold is used to limit the load on the context window, preventing excessive load from causing a decrease in processing efficiency and accuracy. When the load on the context window exceeds the preset safety threshold, the messages currently in the context window are filtered, and the messages that have been unused for the longest time or have the least relevance are selected as the target message blocks for compression.

[0099] Step S530: Compress the target message block to obtain an indexed summary entry corresponding to the target message block, and store it in the long-term cache of the context window.

[0100] The context window has a pre-defined long-term cache for caching the summary entries and indexes of swapped-out message blocks. The storage space of this long-term cache is pre-defined, and all summary entries and indexes must be stored in this long-term cache, regardless of the length of the historical dialogue, so that the summary model responsible for text compression can perform deeper semantic extraction.

[0101] By using a summarization model to semantically extract the target message block, the summarization model is trained to focus on identifying high-value information (such as user preferences, key decision conclusions, code snippet IDs, error messages, etc.) and assign higher spatial weights to high-value information and lower spatial weights to redundant information.

[0102] To prevent the summary model from fabricating information during text compression, each summary entry must carry an index pointing to the corresponding message block.

[0103] Step S540: Transfer the target message block to the preset persistent storage area.

[0104] After the summary model completes text compression, the target message block is removed from the context window and saved to a pre-defined persistent storage area outside the context window for future retrieval. This persistent storage area contains the original slices and knowledge of all historical dialogues.

[0105] In some examples, during the execution of the target task by the target model, if information is missing during the context processing corresponding to the target task, the summary entry corresponding to the missing information is matched; wherein, the missing information includes at least a portion of the message blocks in the preset persistent storage area; and the message block corresponding to the missing information is loaded from the preset persistent storage area into the context window according to the index carried by the summary entry.

[0106] When the target model analyzes the problem in the current context window, if it finds insufficient or missing information, it will interrupt processing and generate a memory retrieval intent. This memory retrieval intent can be used to retrieve summary facet entries from the long-term cache and load the message blocks corresponding to the missing information from the preset persistent storage area into the context window based on the index carried by the summary entries. Alternatively, it can be used to call retrieval tools to directly search for corresponding historical information or knowledge from the preset persistent storage area and load the found historical information or knowledge as message blocks into the context window. After loading the required message blocks, the target model resumes processing the target task.

[0107] In other examples, to prevent the system from getting stuck in local optima or over-relying on a certain reference trajectory, thus hindering the self-evolution of the agent, before each target model processes the target task, a trajectory exploration index value is determined based on the storage occupancy of the reference trajectory library; wherein, the trajectory exploration index value characterizes the intensity of trajectory exploration that the target model should perform in order to process the target task; then the target model is invoked, and the target task is executed guided by the trajectory exploration index value.

[0108] In this embodiment, the trajectory exploration index values ​​were sampled using a Boltzmann distribution, as shown in the following formula:

[0109] Where P(τi) is the trajectory exploration index value, S(τ i ), S(τ) j ) represents the quality metric of the trajectory, and T represents the temperature, which can be used to characterize the update frequency of the agent's reference trajectory library.

[0110] In other words, when the task is in its early stages or when there are few reference trajectories in the reference trajectory library, the temperature is high, encouraging the target model to try diverse trajectory exploration. As the number of reference trajectories in the reference trajectory library gradually increases, the temperature begins to decrease until the agent's reference trajectory library is full and the update frequency is low, at which point it converges to the task execution mode of directly using reference trajectories to process the task.

[0111] <Fourth Embodiment> This disclosure provides a task processing method applied to an intelligent agent. For example... Figure 6As shown, the method includes the following steps S610 to S640: Step S610: In response to the user's task request, extract the current task carried in the task request.

[0112] Step S620: Determine the target model to perform the current task.

[0113] Step S630: Based on the task category to which the current task belongs, match the current reference trajectory associated with the task category to which the current task belongs from the reference trajectory library.

[0114] This reference trajectory library stores reference trajectories associated with multiple task categories. These reference trajectories serve as a guide for the agent when executing tasks within their respective task categories. The reference trajectory library is updated based on the execution trajectories used by the agent when performing historical tasks.

[0115] In this embodiment, historical tasks can be used as target tasks in the first embodiment. The reference trajectories in the reference trajectory library are optimized according to the reference trajectory optimization method provided in the first embodiment in order to update the reference trajectory library.

[0116] Step S640: Based on the current reference trajectory, call the target model to execute the current task.

[0117] In this embodiment, after the agent extracts the current task from the task request and determines the target model to be used to execute the current task, the agent searches for the current reference trajectory as the execution reference from the reference trajectory library according to the task category to which the current task belongs. If the current reference trajectory exists, the agent executes the current task with reference to the current reference trajectory.

[0118] Furthermore, after step S640, the agent can further update the reference trajectory library by executing the current task based on the target model, which will not be elaborated here.

[0119] The task processing method provided in this embodiment uses the reference trajectory in the continuously updated reference trajectory library as the execution reference to execute the current task, which can improve the processing speed of the agent for task requests and improve the stability of the agent's task processing.

[0120] <Fifth Embodiment> Figure 7 A schematic diagram of the structure of an intelligent agent according to some embodiments is shown. For example... Figure 7As shown, the agent 700 may include a trajectory acquisition module 710, a quality measurement module 720, a reference trajectory library 730, a trajectory matching module 740, and a trajectory update module 750. The trajectory acquisition module 710 acquires the execution trajectory corresponding to the target task. The quality measurement module 720 calls a preset trajectory quality quantification model to measure the execution quality of the execution trajectory and obtain its quality measurement value. The reference trajectory library 730 stores reference trajectories associated with multiple task categories, serving as a reference for the agent to execute tasks within the associated task categories. The trajectory matching module 740 matches the target reference trajectory associated with the target task category to which the target task belongs in the reference trajectory library. The trajectory update module 750, when a target reference trajectory is matched and the quality measurement value of the execution trajectory is greater than that of the target reference trajectory, saves the execution trajectory as a reference trajectory for the target task category in the reference trajectory library.

[0121] The intelligent agent 700 may also include a task execution module, which is used to parse the target task and execute the target task according to a determined execution trajectory. The task processing module can be configured to trigger a reference trajectory optimization process after the target task is completed, and output the execution trajectory of the target task to the trajectory acquisition module 710.

[0122] While saving the reference trajectory to the reference trajectory library 730, the intelligent agent 700 can also save the quality metric value of the reference trajectory. The trajectory matching module 740 searches for the corresponding target reference trajectory in the reference trajectory library 730 based on the task category to which the target task belongs. If the corresponding target reference trajectory is found, the quality metric value of the target reference trajectory is obtained and compared with the quality metric value of the execution trajectory corresponding to the target task.

[0123] If the quality metric of the executed trajectory is greater than the quality metric of the target reference trajectory, that is, if the quality of the executed trajectory is better than the reference trajectory currently associated with the task category to which the target task belongs in the reference trajectory library 730, the agent calls the trajectory update module 750 to convert the executed trajectory into a reference trajectory and replaces the reference trajectory associated with the category to which the target task belongs in the reference database 730, so as to achieve the optimization and update of the reference database 730.

[0124] In this embodiment, the agent 700 can update its own reference trajectory library 730 based on the execution trajectory of the task after task processing, thereby achieving self-learning and improving the processing speed and accuracy of the agent 700 for similar tasks.

[0125] <Sixth Embodiment> Figure 8 A schematic diagram of the hardware structure of an electronic device according to some embodiments is shown. For example... Figure 8As shown, the electronic device 800 includes a processor 810 and a memory 820. The memory 820 stores a computer program that controls the processor 810 to operate in order to control the electronic device 800 to execute a reference trajectory optimization method according to any embodiment of the present disclosure.

[0126] The electronic device 800 can be Figure 1 The server 1000 in the text can be any other device; no restrictions are placed here.

[0127] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a reference trajectory optimization method according to any embodiment of this disclosure.

[0128] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0129] This disclosure may be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement any of the methods in the foregoing embodiments of this disclosure.

[0130] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media may include, for example, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), compact disc-read-only memory (CD-ROM), digital versatile disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any combination thereof. The computer-readable storage medium used herein is not to be interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0131] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include one or more of copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to computer-readable storage media in the respective computing / processing device.

[0132] The computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source or object programs written in any combination of one or more programming languages, including object-oriented programming languages ​​(such as Smalltalk, C++, etc.) and conventional procedural programming languages ​​(such as the "C" language or similar programming languages). The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network (e.g., a local area network or a wide area network), or it may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays, or programmable logic arrays, can execute computer-readable program instructions to implement various aspects of the embodiments of this disclosure by utilizing state information from the computer-readable program instructions.

[0133] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0134] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0135] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It should be noted that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are all equivalent.

[0137] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of this disclosure is defined by the appended claims.

Claims

1. A reference trajectory optimization method, characterized in that, Applied to intelligent agents, the method includes: Obtain the execution trajectory corresponding to the target task; A preset trajectory quality quantization model is invoked to measure the execution quality of the execution trajectory, thereby obtaining the quality metric value of the execution trajectory; In the reference trajectory library of the intelligent agent, the target reference trajectory associated with the target task category to which the target task belongs is matched; wherein, the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory serves as the execution reference for the intelligent agent to execute tasks under the associated task category; If the target reference trajectory is matched and the quality metric value of the execution trajectory is greater than that of the target reference trajectory, the execution trajectory is used as the reference trajectory for the target task category and saved in the reference trajectory library.

2. The method according to claim 1, characterized in that, The trajectory quality quantification model includes a first type of metric for quantifying the degree of completion of the execution trajectory for the target task, and a second type of metric for quantifying the execution efficiency of the execution trajectory.

3. The method according to claim 2, characterized in that, The second category of metrics includes at least some of the time efficiency metrics, resource efficiency metrics, and path efficiency metrics; The time efficiency index is used to quantify the time cost of the execution trajectory, the resource efficiency index is used to quantify the computational resource consumption of the execution trajectory, and the path efficiency index is used to quantify the degree of similarity between the trajectory length of the execution trajectory and the baseline trajectory length of the target task category.

4. The method according to claim 3, characterized in that, The second type of metric includes the path efficiency metric, and the method further includes: Based on the execution trajectory, the target task is explored to obtain multiple executable trajectories corresponding to the target task; The baseline trajectory length of the target task category is obtained based on the trajectory lengths of the multiple executable trajectories.

5. The method according to claim 3, characterized in that, The second type of metric includes the path efficiency metric, and the method further includes: If the first type of metric value of the execution trajectory is at its maximum value and the trajectory length of the execution trajectory is less than the baseline trajectory length, the baseline trajectory length of the target task category is updated by weighting the trajectory length of the execution trajectory with the baseline trajectory length. The weighting of the trajectory length of the execution trajectory is determined based on a set evolution rate.

6. The method according to claim 1, characterized in that, The step of matching the target reference trajectory of the target task to its category in the reference trajectory library of the intelligent agent includes: Based on the semantic similarity between the execution trajectory and each reference trajectory in the reference trajectory library, a target reference trajectory of the task category to which the target task belongs is obtained.

7. The method according to claim 1, characterized in that, The method further includes: If no target reference trajectory is matched and the reference trajectory library is full, low-value reference trajectories in the reference trajectory library are filtered out based on the quality metric value and call frequency of each reference trajectory in the reference trajectory library. Remove the low-value reference trajectory from the reference trajectory library, and create the target task category in the reference trajectory library; The execution trajectory is used as a reference trajectory for the target task category and stored in the reference trajectory library.

8. The method according to claim 1, characterized in that, If the quality metric value of the execution trajectory is less than the preset metric value threshold, the method further includes: Feature extraction is performed on the execution trajectory to obtain an error feature set of the execution trajectory; wherein, the error feature set includes at least one type of information from the error information and logical dead loop point information of the execution trajectory; The set of error features of the execution trajectory is converted into natural language to obtain the negative constraints corresponding to the execution trajectory; The negative constraints corresponding to the execution trajectory are used as execution constraints for the target task category and stored in the constraint rule base of the agent.

9. The method according to claim 1, characterized in that, Before obtaining the execution trajectory corresponding to the target task, the method further includes: The complexity of the target task is classified to determine its complexity level. Based on the complexity level of the target task, determine the target model for processing the target task; The target model is invoked to execute the target task, and the execution trajectory corresponding to the target task is obtained.

10. The method according to claim 9, characterized in that, The process of classifying the complexity of the target task to determine its complexity level includes: A preset task complexity metric model is invoked to measure the task execution complexity of the target task, thereby obtaining a complexity metric value for the target task; wherein, the task complexity metric model includes at least some of the following metrics: logical complexity metric, risk coefficient metric, and output length metric. The complexity level of the target task is determined based on the preset mapping relationship between the complexity metric range and the complexity level, and the complexity metric of the target task.

11. The method according to claim 9, characterized in that, The step of invoking the target model to execute the target task includes: Semantic analysis is performed on the target task to obtain multiple skill keywords corresponding to the target task; Based on the multiple skill keywords, a tool retrieval is performed to obtain the toolkits corresponding to the multiple skill keywords; wherein, the toolkits are dynamically injected into the system prompts during the process of the target model processing the target task; The target model is invoked, and the target task is executed based on the dynamically injected toolkit.

12. The method according to claim 9, characterized in that, The step of invoking the target model to execute the target task includes: Load monitoring is performed on the context window of the target model; If the load on the context window exceeds a preset security threshold, the current messages in the context window are filtered to obtain target message blocks; wherein, the message blocks to be replaced are the messages in the context window that have been unused for the longest time or have the least relevance to the current processing node. The target message block is compressed to obtain an indexed summary entry corresponding to the target message block, which is then stored in the long-term cache of the context window. The target message block is transferred to a preset persistent storage area.

13. The method according to claim 12, characterized in that, The method also includes: If missing information is detected during context processing of the target task, a summary entry corresponding to the missing information is matched; wherein, the missing information includes at least a portion of message blocks in the preset persistent storage area; Based on the index carried by the summary entry, the message block corresponding to the missing information is loaded from the preset persistent storage area into the context window.

14. The method according to claim 9, characterized in that, The step of invoking the target model to execute the target task includes: Based on the storage occupancy rate of the reference trajectory library, a trajectory exploration index value is determined; wherein, the trajectory exploration index value characterizes the trajectory exploration intensity that the target model should perform in order to process the target task; The target model is invoked, and the target task is executed guided by the trajectory exploration index value.

15. A task processing method, characterized in that, Applied to intelligent agents, the method includes: In response to a user's task request, extract the current task carried in the task request; Determine the target model for performing the current task; Based on the task category to which the current task belongs, the reference trajectory associated with the task category to which the current task belongs is matched from the reference trajectory library; wherein, the reference trajectory library stores reference trajectories associated with multiple task categories, and the reference trajectory serves as an execution reference for the agent to execute tasks under the associated task category, and the reference trajectory library is updated by using the historical tasks executed by the agent as the target task and executing the method of any one of claims 1 to 14; Based on the current reference trajectory, the target model is invoked to execute the current task.

16. An intelligent agent, characterized in that, include: The trajectory acquisition module is used to acquire the execution trajectory corresponding to the target task; The quality measurement module is used to call a preset trajectory quality quantification model to measure the execution quality of the execution trajectory and obtain the quality measurement value of the execution trajectory. A reference trajectory library is used to store reference trajectories associated with multiple task categories. The reference trajectories serve as execution references for the intelligent agent when executing tasks under the associated task categories. The trajectory matching module is used to match the target reference trajectory associated with the target task category to which the target task belongs in the reference trajectory library; as well as, The trajectory update module is used to save the execution trajectory as a reference trajectory for the target task category in the reference trajectory library when the target reference trajectory is matched and the quality metric value of the execution trajectory is greater than that of the target reference trajectory.

17. An electronic device, characterized in that, It includes a memory and a processor, the memory being used to store a computer program, and the processor being used, under the control of the computer program, to execute the reference trajectory optimization method according to any one of claims 1 to 15.