Processing method and device
By constructing macro instruction tools and defining the execution order and data dependencies of target tools, the problems of task delay and high cost caused by multiple inferences and tool calls by intelligent agents are solved, and efficient and reliable task execution is achieved.
Patent Information
- Application Number
- CN202512001600.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-03-17
AI Technical Summary
When intelligent agents perform tasks, they need to perform multiple model inferences and tool calls, resulting in excessively high task execution latency, slow response speed, frequent network interactions, and high token consumption, which affects task reliability and cost.
By acquiring historical execution data from the inference process of the target model, identifying the target tool call sequence, and constructing macro instruction tools, the execution order and data dependencies of the target tools are defined, reducing the number of inference attempts and network interactions.
It simplifies the decision-making process, reduces the number of network interactions and token consumption, improves task execution efficiency and reliability, and reduces costs, especially when dealing with large-scale tasks.
Smart Images

Figure CN121680860A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a processing method and apparatus. Background Technology
[0002] Currently, when an intelligent agent performs a task, it usually needs to perform multiple model inferences and tool calls, resulting in excessively high task execution latency and slow response speed. Summary of the Invention
[0003] The technical solution provided in this application is as follows:
[0004] The first aspect of this application provides a processing method, including:
[0005] Obtain historical execution data from the reasoning process of the target model;
[0006] From the historical execution data, a target tool call sequence is identified; the target tool call sequence contains multiple target tools called consecutively in chronological order; each target tool is used to perform a single target task related to the inference of the target model.
[0007] Based on the target tool call sequence, a macro instruction tool is constructed; the macro instruction tool is used to define the execution order and data dependencies of multiple target tools.
[0008] In one possible implementation, the historical execution data includes: multiple call operation chains and tool identifiers corresponding to each call operation in the call operation chain; the call operation is used to invoke a tool;
[0009] The step of identifying the target tool call sequence from the historical execution data includes:
[0010] According to the execution order of each call operation in the call operation chain, the tool identifiers corresponding to each call operation in the call operation chain are arranged to obtain the first candidate tool call sequence corresponding to the call operation chain;
[0011] From the first candidate tool call sequence corresponding to each of the call operation chains, identify the second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window, and determine the second candidate tool call sequence as the target tool call sequence.
[0012] In one possible implementation, the historical execution data includes: multiple call operation chains and the tool identifier corresponding to each call operation in the call operation chain, as well as the input parameters and output results of each call operation;
[0013] The step of identifying the target tool call sequence from the historical execution data includes:
[0014] According to the execution order of each call operation in the call operation chain, the tool identifiers corresponding to each call operation in the call operation chain are arranged to obtain the first candidate tool call sequence corresponding to the call operation chain;
[0015] Extract all tool pairs from the first candidate tool invocation sequence; each tool pair contains an adjacent preceding tool and a following tool.
[0016] Extract the output of the preceding tool and the input parameters of the following tool from the input parameters and output results of each of the aforementioned invocation operations;
[0017] If a dependency is found between the output of the preceding tool and the input parameters of the following tool in each tool pair, the first candidate tool call sequence is determined as the target tool call sequence.
[0018] In one possible implementation, constructing the macro instruction tool based on the target tool call sequence includes:
[0019] Obtain the input parameters and output results of each target tool in the target tool call sequence;
[0020] Based on the input parameters and output results of each of the target tools, the macro instruction input parameters are determined;
[0021] Based on the output results of each of the target tools, determine the macro instruction output parameters;
[0022] A macro instruction tool is constructed based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence.
[0023] In one possible implementation, determining the macro instruction input parameters based on the input parameters and output results of each of the target tools includes:
[0024] Extract the input parameters of the first target tool from the input parameters of each of the target tools;
[0025] Based on the output results of each target tool, free parameters are extracted from the input parameters of each target tool; the values of the free parameters come from external input or preset values.
[0026] The input parameters of the first target tool and the free parameters are determined as macro instruction input parameters.
[0027] In one possible implementation, the macro instruction output parameters are determined based on the output results of each of the target tools, including:
[0028] Based on the output results of each of the target tools, a first output parameter and / or a second output parameter are determined, and the first output parameter and / or the second output parameter are determined as macro instruction output parameters; the first output parameter corresponds to the last target tool among the target tools; the second output parameter corresponds to the intermediate tool specified among the target tools.
[0029] In one possible implementation, constructing the macro instruction tool based on the macro instruction input parameters, the macro instruction output parameters, and the target tool invocation sequence includes:
[0030] Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, an interface file and a tool description are generated; the interface file is used to define the parameter requirements and output format when the macro instruction tool is called; the tool description is used to describe the overall functionality of the macro instruction tool.
[0031] Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, executable code is generated; the executable code encodes the execution order, data dependencies, and data processing logic of each target tool in the target tool call sequence;
[0032] The interface file, the tool description, and the executable code are combined to form a macro instruction tool.
[0033] In one possible implementation, the tool description includes:
[0034] The macro command tool includes a functional description and prompts; the prompts are used to suggest the target model, and when the function of the macro command tool matches the user's needs, the macro command tool is selected for execution first.
[0035] In one possible implementation, the processing method further includes:
[0036] The macro instruction tool is registered to a first tool library; the first tool library is independent of the second tool library; the second tool library contains multiple tools; the multiple tools include the multiple target tools;
[0037] In response to input data, the target macro instruction tool is searched in the first tool library based on the target model;
[0038] If found, the input data is processed based on the target macro instruction tool to obtain the inference result;
[0039] If not found, search for the target tool in the second tool library based on the target model.
[0040] In another aspect, this application provides a processing apparatus, comprising:
[0041] The acquisition module is used to obtain historical execution data from the inference process of the target model;
[0042] An identification module is used to identify a target tool call sequence from the historical execution data; the target tool call sequence contains multiple target tools called consecutively in chronological order; the target tool is used to perform a single target task related to the inference of the target model;
[0043] A construction module is used to construct a macro instruction tool based on the target tool call sequence; the macro instruction tool is used to define the execution order and data dependencies of multiple target tools. Attached Figure Description
[0044] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0045] Figure 1 A flowchart illustrating a processing method provided in Embodiment 1 of this application;
[0046] Figure 2 This is a flowchart illustrating a processing method provided in Embodiment 2 of this application;
[0047] Figure 3 This is a flowchart illustrating a processing method provided in Embodiment 3 of this application;
[0048] Figure 4 This is a flowchart illustrating a processing method provided in Embodiment 4 of this application;
[0049] Figure 5 This is a flowchart illustrating a processing method provided in Embodiment 5 of this application;
[0050] Figure 6 This is a flowchart illustrating a processing method provided in Embodiment 6 of this application;
[0051] Figure 7 This is a flowchart illustrating a processing method provided in Embodiment 7 of this application;
[0052] Figure 8 A flowchart illustrating a processing method provided in Embodiment 9 of this application;
[0053] Figure 9 This is a schematic diagram of a system architecture provided in this application. Detailed Implementation
[0054] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0055] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0056] The terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0057] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] Reference Figure 1 This is a flowchart illustrating a processing method provided in Embodiment 1 of this application, as shown below. Figure 1 As shown, the method may include, but is not limited to, the following steps:
[0059] Step S101: Obtain historical execution data from the reasoning process of the target model.
[0060] Operation records during the inference process of the target model can be stored in a log file. The log file can include the complete trajectory of the target model in past processing tasks, including but not limited to user instructions, input parameters, output results involved in inference, as well as the names and order of tools called during inference.
[0061] Historical execution data can be extracted from its log files.
[0062] For example, in a scenario where an agent processes a user instruction to "generate a product sales trend analysis report for the past 3 days and send it to the operations manager" using a target model, the target model will generate a series of operation records during the inference process in response to the user instruction. These records can be stored in a log file.
[0063] Specifically, this includes user commands, input parameters (such as the specified time range "last 3 days", product category, etc., used to query sales data), output results (generated sales trend analysis report and feedback information for successfully sent emails), and the names of the tools called during the inference process (sales data query tool, trend calculation tool, report generation tool, email sending tool), call time (the specific time points when each tool is called and when it is called), and call order (the sales data query tool is called first, followed by the trend calculation, report generation, and email sending tools in sequence).
[0064] Step S102: Identify the target tool call sequence from the historical execution data; the target tool call sequence contains multiple target tools called consecutively in chronological order; each target tool is used to perform a single target task related to the inference of the target model.
[0065] The logs clearly record the order in which each tool is invoked in the task flow. This order reflects the dependencies between tools and the logical flow of task execution. For example, the sales data query tool must be invoked to obtain sales data before the trend calculation tool can be invoked to analyze that data. Therefore, the sales data query tool must be invoked before the trend calculation tool.
[0066] In this embodiment, the target tools can be arranged according to the calling order to obtain the target tool calling sequence.
[0067] In this target tool call sequence, after the previous tool completes its predetermined single target task and outputs the corresponding result, it may trigger the call of the next tool. This sequential calling in chronological order ensures the logical coherence of the entire task flow and guarantees data accuracy. Each tool works based on the accurate data output by the previous tool, avoiding subsequent analysis biases caused by data errors or inconsistencies.
[0068] For example, suppose the user request received by the agent is "generate a product sales trend analysis report for the past 3 days and send it to the operations manager." From historical execution data, the sequence of target tool calls identified could include: sales data query tool → trend calculation tool → report generation tool → email sending tool.
[0069] Sales Data Query Tool: This tool is the starting point of the entire task process. It is used to accurately query relevant sales data from a database or other data storage system according to specified time ranges (last 3 days) and product categories (i.e., an implementation method for a single-objective task). This sales data forms the basis for subsequent analysis and may include key information such as product sales quantity, sales revenue, and sales time.
[0070] Trend calculation tools: After acquiring sales data, trend calculation tools can use various statistical methods and algorithms, such as moving averages and exponential smoothing, to calculate the trend of product sales volume or sales revenue over time (i.e., an implementation method for a single objective task). Through trend calculation, it is clear whether the product shows an upward trend, a downward trend, or a stable trend over the past 3 days.
[0071] Report Generation Tool: Based on the results from trend calculation tools, this tool can organize the data and analysis conclusions into a complete sales trend analysis report (i.e., an implementation method for a single objective task) in an intuitive and easy-to-understand way. The report typically includes a title, summary, data charts (such as line charts and bar charts to display sales trends), detailed analysis explanations, and conclusions and recommendations. A high-quality report helps operations managers quickly understand product sales, identify problems, and propose targeted solutions.
[0072] Email Sending Tool: As the final step in the task flow, this tool's function is to send the generated sales trend analysis report to the designated operations manager via email (i.e., a single-objective task implementation method). The email sending tool can automatically fill in the recipient's email address, email subject, and body (briefly explaining the report's main content and purpose), and add the report as an attachment to the email. Sending the report via email ensures that the operations manager receives the report promptly and stays informed about product sales dynamics.
[0073] Step S103: Based on the target tool call sequence, construct a macro instruction tool; the macro instruction tool is used to define the execution order and data dependency relationship of multiple target tools.
[0074] In this embodiment, the intelligent agent can input data according to a serial loop pattern of "Think-Act-Observe".
[0075] In this context, "Think" can be understood as the initial stage of the agent's task processing. At this stage, the target model can conduct a comprehensive and in-depth analysis and judgment of the received task requirements, understand the essence of the problem, clarify the task objectives, and plan a general direction for resolution. For example, when the agent receives the task of "generating a market research report on a certain product," the target model will consider what aspects of data need to be obtained (such as market size, competitor information, consumer feedback, etc.), what tools to use to obtain this data (such as web crawlers, questionnaires, etc.), and how to subsequently organize and analyze this data.
[0076] After completing the task planning in the thinking phase, the agent enters the action (Act) phase. Based on the plan developed in the thinking phase, the agent can invoke appropriate tools or perform specific operations to obtain the necessary information or complete parts of the task. Continuing with the example of generating a market research report, in the action phase, the agent might use web crawling tools to collect sales data and user reviews of relevant products in the market, or use survey tools to distribute questionnaires to the target consumer group to obtain their feedback.
[0077] After the action phase is completed, the agent enters the observation phase. The agent observes and analyzes the results obtained in the action phase to determine whether these results meet the task requirements and achieve the expected goals. If the results are satisfactory, the task may be completed; if the results are unsatisfactory or further information is needed, the agent will re-enter the thinking phase based on the observation results, adjust the task plan, and then perform actions and observations again, repeating this cycle until the task is finally completed. For example, in the process of generating a market research report, after collecting data, the agent will observe whether the data is complete, accurate, and sufficient to support the report's writing. If missing or incorrect data is found, the agent will consider how to supplement or correct the data, then act again to obtain more accurate data, and then perform observation and analysis.
[0078] Based on the aforementioned sequential loop pattern of "thinking-action-observation", the target model can first respond to input data to determine the current task during the thinking phase, and then check whether the task matches the functions of the pre-built macro instruction tools during the action phase.
[0079] If the target model determines that the current task cannot match a suitable macro instruction tool, the agent will invoke the target tool (which is different from the macro instruction tool). After the action phase is completed, the observation phase begins. If the expected goal is not achieved, the thinking phase continues until the task is finally completed. In each loop, the model needs to independently think, act, and observe, continuously adjusting subsequent operations based on the results of each step until the task is completed.
[0080] If the target model determines that the current task has successfully matched the corresponding macro instruction tool, then task execution will enter an efficient mode. In this case, after the macro instruction tool is invoked during the action phase, the macro instruction tool will automatically execute multiple related target tools sequentially according to its built-in logic, directly obtaining the final result without the agent needing to perform another inference and loop, i.e., without needing to re-enter the thinking phase.
[0081] For example, taking the task of "generating and sending sales reports for the past 3 days" as an example, if the macro command tool is not successfully matched, the specific process is as follows:
[0082] The first thought-action-observation cycle:
[0083] Thinking Phase: After receiving the user's request for a sales report, the target model begins a comprehensive and in-depth analysis and judgment. The target model understands the essence of the problem as obtaining sales data from the past three days and generating a report for submission. The clear task objective is to complete the report generation and submission, and the general approach is to first obtain the sales data.
[0084] Action Phase: Based on the results of the thinking phase, the sales data query tool is invoked to perform data query operations and obtain sales data for the past 3 days from relevant data sources such as databases.
[0085] Observation Phase: The target model observes and analyzes the sales data returned by the sales data query tool to determine whether the data is complete, accurate, and capable of supporting subsequent tasks. If the data meets the requirements, proceed to the next step; if there are missing or incorrect data, re-enter the thinking phase to consider how to supplement or correct the data, and then take action again to obtain more accurate data for further observation and analysis. Assuming the data is complete and accurate this time, proceed to the second cycle.
[0086] The second cycle of thinking-acting-observing:
[0087] Thinking Phase: The target model uses the acquired sales data as new input to perform a second round of reasoning. After in-depth analysis, the target model determines that trend calculations are needed on this sales data to better represent the sales situation, and therefore decides to call a trend calculation tool. At this point, the target model adjusts its task execution path based on the new data.
[0088] Action phase: Use trend calculation tools to perform trend calculations on sales data and obtain sales trend results.
[0089] Observation Phase: The target model observes and analyzes the trend results returned by the trend calculation tool to determine whether the trend calculation is accurate and meets the conditions for generating a report. If the results meet the requirements, proceed to the next step; if problems exist, re-enter the thinking phase to consider how to adjust the calculation method or supplement data, then perform the calculation again, and conduct further observation and analysis. Assuming the trend calculation results meet the requirements this time, proceed to the third cycle.
[0090] The third cycle of thinking-acting-observing:
[0091] Thinking Phase: After the trend calculation tool returns the trend results, the target model re-enters the inference phase. Based on the trend results, it considers whether the conditions for generating a report have been met. After judgment, it decides to call the report generation tool to further propel the task closer to the final goal.
[0092] Action phase: Invoke the report generation tool, take sales data and trend results as input, and generate a sales report.
[0093] Observation Phase: The target model observes and analyzes the report generated by the report generation tool to determine whether the report content is complete, the format is correct, and it meets user needs. If the report meets the requirements, proceed to the next step; if problems exist, return to the thinking phase to consider how to modify the report content or adjust the format, then generate another report and conduct further observation and analysis. Assuming this report meets the requirements, proceed to the fourth cycle.
[0094] The fourth cycle of thinking-action-observation:
[0095] Thinking Phase: After the report generation tool generates the report, the target model performs its fourth inference based on the report's content. It determines that the report needs to be sent and decides to send it via email, thus calling the email sending tool to complete the final step of the task.
[0096] Action phase: Use the email sending tool to send the report as an attachment to the email address and in the preset format.
[0097] Observation phase: The target model observes whether the email is sent successfully. If it is sent successfully, the task is completed. If it fails to send, it re-enters the thinking phase to consider the reasons for the failure, such as network problems or incorrect email addresses. Then, it takes action again to send the email and conducts further observation and analysis.
[0098] As can be seen from the above process, calling the target tool may have the following problems:
[0099] The entire task involved four inferences, corresponding to decisions made by four different tools. Each inference required significant computational resources from the model and consumed considerable time. As task complexity increases, the number of inferences grows linearly, leading to overall inefficiency.
[0100] Each call to the target tool constitutes an independent interaction, resulting in a total of four network interactions throughout the task. Frequent network interactions not only increase the risk of network latency but also may cause task interruption or failure due to network instability, impacting the task's reliability and stability.
[0101] Each inference step requires inputting the output of the preceding tool and generating the command to invoke the next tool, which consumes a significant amount of tokens. Tokens are a crucial resource for model operation, and excessive consumption increases the cost of use, especially when handling large-scale tasks, where the cost issue becomes even more pronounced.
[0102] If the target model determines that the current task successfully matches the corresponding macro command tool (such as the "Sales Report Generation + Send" macro command tool), then the task execution will enter high-efficiency mode. The specific process is as follows:
[0103] Thinking Phase: After receiving the user's request to "generate and send sales reports for the past 3 days," the model performs a reasoning process. Through comprehensive and in-depth analysis and judgment, the model understands the essence of the problem, clarifies the task objective as completing report generation and sending, and plans a general solution direction. Based on the analysis and judgment, the user's needs match the "sales report generation + sending" macro command tool, and therefore decides to call this macro command tool.
[0104] Action Phase: After the macro command tool is invoked, it automatically executes the sales data query tool, trend calculation tool, report generation tool, and email sending tool sequentially according to its built-in logic. The entire process requires no model intervention, which greatly simplifies the decision-making process and reduces the number of reasoning steps.
[0105] Observation Phase: After the macro command tool completes execution, the model observes and analyzes the final result. Since the macro command tool executes according to preset logic and processes, and the data dependencies between various tools have been handled, if the macro command tool executes successfully, the final result will most likely meet the task requirements. If the result meets the requirements, the task is completed; if there are abnormal situations, the model will then enter the thinking phase to investigate and handle the problems, but this situation is relatively rare.
[0106] By calling the macro command tool, the following effects can be achieved:
[0107] The macro instruction tool invocation mode involves only one network interaction—the single interaction to invoke the macro instruction tool—reducing the number of network interactions and lowering the risk of task failure due to network issues. Simultaneously, requiring only one inference input of the user's original command, without intermediate token consumption, significantly reduces token consumption, saves on usage costs, and improves resource utilization efficiency.
[0108] One reasoning step plus one interaction significantly reduces the time compared to multiple reasoning steps and interactions when calling the target tool, enabling tasks to be completed more promptly and providing strong support for decision-making.
[0109] In this embodiment, the macro instruction tool is used to define the execution order and data dependencies of multiple target tools. When the macro instruction tool is invoked, it automatically executes multiple target tools sequentially, directly obtaining the final result. Unlike invoking a single target tool, there is no need to re-enter the thinking stage for reasoning and decision-making after each step, simplifying the decision-making process, reducing the number of reasoning steps, and thus improving task execution efficiency.
[0110] Calling a macro command tool only requires one network interaction, namely the interaction that calls the macro command tool. Therefore, it can reduce the number of network interactions, reduce the risk of task interruption or failure due to network latency, network instability and other factors, and enhance the reliability and stability of task execution.
[0111] Furthermore, the macro instruction tool requires only one inference step, eliminating the need for token consumption in intermediate steps, which saves on usage costs. This cost advantage is particularly evident when handling large-scale tasks, thus improving resource utilization efficiency.
[0112] As another optional embodiment of this application, refer to Figure 2 This is a flowchart illustrating a processing method provided in Embodiment 2 of this application. This embodiment is mainly an implementation of step S102 in Embodiment 1. In this embodiment, the historical execution data includes: multiple call operation chains and each call operation (Action) in the call operation chain. i The corresponding tool identifier; the invocation operation is used to invoke the tool.
[0113] Each call chain (e.g., Action1 -> Action2 -> … -> Action) n This corresponds to the tool call trajectory of an intelligent agent completing a complete task. Among them, Action... i It can represent an independent tool invocation operation initiated by an intelligent agent, with a one-to-one correspondence with the target tool.
[0114] In each call chain, each Action i Each tool is associated with a unique tool identifier (such as tool name or tool number) to identify the specific target tool for the operation.
[0115] like Figure 2 As shown, step S102 may include, but is not limited to, the following steps:
[0116] Step S1021: Arrange the tool identifiers corresponding to each call operation in the call operation chain according to the execution order of each call operation in the call operation chain to obtain the first candidate tool call sequence corresponding to the call operation chain.
[0117] Traverse each call operation chain in the historical execution data, according to each Action within the chain. i Extract each Action from its actual execution time sequence. i The corresponding tool identifiers are obtained, and these tool identifiers are arranged in order to obtain the first candidate tool call sequence corresponding to the call operation chain.
[0118] For example, suppose the historical execution data contains 3 call operation chains:
[0119] Call operation chain 1: Action1 (query sales data) → Action2 (calculate trends) → Action3 (generate report);
[0120] Call operation chain 2: Action1 (Query sales data) → Action2 (Calculate trend) → Action3 (Generate report) → Action4 (Send email);
[0121] Call operation chain 3: Action1 (query inventory data) → Action2 (generate inventory report).
[0122] After extracting the tool identifiers according to the execution order, three first-candidate tool call sequences are obtained:
[0123] First candidate tool call sequence 1: Sales data query tool → Trend calculation tool → Report generation tool;
[0124] First candidate tool call sequence 2: Sales data query tool → Trend calculation tool → Report generation tool → Email sending tool;
[0125] First candidate tool call sequence 3: Inventory data query tool → Inventory report generation tool.
[0126] Step S1022: From the first candidate tool call sequence corresponding to each of the call operation chains, identify the second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window, and determine the second candidate tool call sequence as the target tool call sequence.
[0127] The time window and frequency threshold can be set according to actual needs, and are not restricted in this application.
[0128] In this embodiment, identifying a second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window from the first candidate tool call sequence corresponding to each call operation chain may include, but is not limited to:
[0129] Step S11: Mine frequent tool sequences (frequent 1-sequences) with a length of 1.
[0130] Iterate through the database S (which contains the sequence of first candidate tool calls within a set time window) for all unique tool identifiers (examples: A, B, C, D, E, F).
[0131] Count the number of times each tool icon appears within a set time window (i.e., its support level):
[0132] A: 2 times (appears in 2 sequences [A,B,C,D]); B: 2 times; C: 2 times; D: 2 times; E: 1 time; F: 1 time;
[0133] Tool identifiers with support > Tfreq (i.e., a set frequency threshold) are selected, and each tool identifier forms a separate sequence of length 1, forming the frequent 1-sequence set L1:
[0134] Since Tfreq=1, L1 = {[A], [B], [C], [D]} (E and F have a support of 1, which does not meet the condition of ">1" and are therefore removed).
[0135] Step S12: Construct a database of corresponding subsequences based on frequent sequences of length 1.
[0136] For each frequent sequence of length 1 in L1 (i.e., a single tool identifier), construct the corresponding subsequence database by performing the following two steps:
[0137] Step 1: Filter out all original sequences from the original database S that start with this tool identifier (to ensure temporal consistency, only keep the sequence that uses this tool as the starting point for execution).
[0138] Step 2: For each original sequence that has been filtered out, remove the first tool identifier and keep only the remaining consecutive tool identifier parts as subsequences;
[0139] All the filtered subsequence combinations constitute the subsequence database corresponding to the frequent sequence of length 1.
[0140] For example, for the frequent 1-sequence [A], filter the original sequence: the sequence in the original database S with A as the first tool is [A,B,C,D] (a total of 2 records);
[0141] After removing the first tool A, the remaining part is [B,C,D];
[0142] Construct a subsequence database: The subsequence database corresponding to [A] = {[B,C,D], [B,C,D]}.
[0143] For example, regarding the frequent 1-sequence [B], the analysis here is not directly based on the original database S, but rather on the subsequence database {[B,C,D], [B,C,D]} corresponding to [A] (because B is a subsequent execution tool of A, and further analysis is needed based on the subsequences filtered by A).
[0144] Filtering subsequences: In the subsequence database corresponding to [A], the sequence with B as the first tool is [B,C,D] (2 in total);
[0145] After removing the first tool B, the remaining part is [C,D];
[0146] Construct a subsequence database: The subsequence database corresponding to [A,B] (A plus subsequent B) = {[C,D], [C,D]}.
[0147] And so on:
[0148] For [C] (based on the subsequence database corresponding to [A,B]), after removing C, we get [D], and the subsequence database corresponding to [A,B,C] is {[D], [D]};
[0149] For [D] (based on the subsequence database corresponding to [A,B,C]), after removing D, there is no remaining part, and the subsequence database corresponding to [A,B,C,D] is empty.
[0150] Step S13: Recursively mine the subsequence database to generate longer, more frequent sequences.
[0151] For the subsequence database constructed in step S12, repeat the recursive process of "statistical support → filtering frequent tool identifiers → splicing to generate longer frequent sequences → constructing a new subsequence database" until no longer frequent sequences can be generated. Specific operations may include:
[0152] For the current subsequence database, perform the operation of step S11: count the support of each instrument identifier in the database within a set time window, and filter out the frequent instrument identifiers with support > Tfreq;
[0153] These frequent tool identifiers are sequentially concatenated with the "tool combinations corresponding to the current subsequence database" (ensuring temporal continuity, with the preceding tool combination first and the newly selected frequent tool identifiers last) to generate frequent sequences with a length increased by 1.
[0154] For example, the tool combination that generates the [B,C,D] subsequence database is [A], the frequently selected tool identifier is [B], and after concatenation, the frequent 2-sequence [A,B] is obtained;
[0155] Using the newly generated longer frequent sequences as the "corresponding tool combinations", repeat step S12 to construct a new subsequence database (remove the starting tool corresponding to the last tool identifier of the sequence and keep the remaining part).
[0156] Recursive termination condition: When the subsequence database corresponding to a certain tool combination is empty, or when it is impossible to filter out frequent tool identifiers that meet the frequency threshold from the subsequence database, the recursive mining of that tool combination will stop.
[0157] For example, based on the subsequence database {[B,C,D], [B,C,D]} corresponding to [A]: the support of B is statistically calculated to be 2 > Tfreq. This is then combined with the tool [A] to generate the frequent 2-sequence [A,B].
[0158] Based on the subsequence database {[C,D], [C,D]} corresponding to [A,B]: the support of C is statistically found to be 2 > Tfreq. Combined with the tool [A,B], frequent 3-sequences [A,B,C] are generated.
[0159] Based on the subsequence database {[D], [D]} corresponding to [A,B,C]: the support of D is statistically found to be 2 > Tfreq. This is combined with the tool [A,B,C] to generate the frequent 4-sequence [A,B,C,D].
[0160] The recursive mining of this tool combination is stopped because the subsequence database corresponding to [A,B,C,D] is empty.
[0161] Repeat the above operation for other tool combinations in L1 ([B], [C], [D]) to mine frequent sequences such as [B,C], [C,D], [A,B,C], and [B,C,D].
[0162] Step S14: The frequent sequences are identified as the second candidate tool call sequences.
[0163] Collect all frequently occurring 1-sequences, frequently occurring 2-sequences, frequently occurring 3-sequences, ..., frequently occurring n-sequences (all sequences that satisfy "support > Tfreq") obtained from mining, and form a complete set of frequent sequences;
[0164] For example, [A], [B], [C], [D], [A,B], [B,C], [C,D], [A,B,C], [B,C,D], [A,B,C,D] are all second candidate tool call sequences.
[0165] In this embodiment, identifying a second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window from the first candidate tool call sequence corresponding to each call operation chain may include, but is not limited to:
[0166] Step S21: Generate frequent 1-sequences (frequent tool sequences of length 1).
[0167] Traverse the database S (the first candidate tool call sequence within the defined time window), extract all unique tool identifiers, and form a sequence of length 1 for each tool identifier, thus creating a candidate 1-sequence set C1:
[0168] For example, C1 = {[A], [B], [C], [D], [E], [F]} (all identifiers come from 3 sequences within the time window, with no external data mixed in).
[0169] Calculate the support (number of occurrences) of each candidate 1-sequence in C1 within a set time window. For example, [A]:2, [B]:2, [C]:2, [D]:2, [E]:1, [F]:1 (only count the number of occurrences within the time window; for example, [A] only appears in 2 sequences [A,B,C,D]).
[0170] Candidate 1-sequences with support greater than a preset frequency threshold Tfreq are selected to form a set of frequent 1-sequences, L1. For example, since Tfreq=1, only sequences with support greater than 1 are retained, and L1 = {[A], [B], [C], [D]} ([E] and [F] have support of 1, which does not meet the condition of ">Tfreq", so they are removed).
[0171] Step S22: Iteratively generate candidate k-sequences and frequent k-sequences (k≥2).
[0172] This step is an iterative process that continues until no new candidate k-sequences can be generated. Each iteration consists of three sub-steps, each strictly adhering to time window constraints and frequency threshold selection criteria. The three sub-steps may include:
[0173] Step S221: Candidate k-sequence generation (join operation, based on existing frequent sequences, with data source within a limited time window)
[0174] Input: The set of frequent (k-1) sequences L(k-1) obtained from the previous iteration (this set already satisfies the condition "within the time window + support > Tfreq");
[0175] Connection rule: Two frequent (k-1)-sequences that satisfy "the first k-2 tool identifiers are completely identical" are concatenated in an ordered manner to generate a candidate k-sequence set Ck of length k (to ensure the temporal consistency of the tool sequence and conform to the actual task execution logic).
[0176] For example, based on L1 = {[A], [B], [C], [D]}, after concatenation, we get C2 = {[A,B], [A,C], [A,D], [B,C], [B,D], [C,D]} (generated only based on valid frequent sequences, with no invalid candidates).
[0177] Step S222: Pruning of candidate k-sequences.
[0178] Pruning rules: Based on the Apriori prior property, Ck is filtered for validity. If any non-empty subset of length k-1 of a candidate k-sequence does not belong to L(k-1) (i.e. the subset is not frequent), then the candidate k-sequence is directly removed.
[0179] For example, in candidate C2 = {[A,B], [A,C], [A,D], [B,C], [B,D], [C,D]}, subsets of length 1 (such as subsets [A] and [B] of [A,B]) are all in L1, so no pruning is needed and C2 remains unchanged.
[0180] If there exists a candidate sequence [A, E], and its subset [E] is not in L1 (does not satisfy the dual conditions), the candidate sequence is directly eliminated.
[0181] Step S223: Frequent k-sequence screening.
[0182] Traverse the database S (containing the first candidate tool call sequences within each set time window) and calculate the support of each candidate k-sequence in Ck.
[0183] Retain candidate k-sequences whose support is greater than the preset frequency threshold Tfreq.
[0184] Step S23: The candidate k-sequences with support greater than the preset frequency threshold Tfreq are identified as the second candidate tool call sequences.
[0185] For example, [A], [B], [C], [D], [A,B], [B,C], [C,D], [A,B,C], [B,C,D], [A,B,C,D] are all second candidate tool call sequences.
[0186] In this embodiment, by arranging the tool identifiers corresponding to each call operation in the call operation chain according to the execution order of each call operation in the call operation chain, the first candidate tool call sequence corresponding to the call operation chain is obtained. This realizes the structured abstraction of the call operation chain, eliminates irregular and scattered operation records, and makes the temporal logic and dependency relationship of tool calls clear, laying a data foundation for subsequent mining of high-frequency effective sequences.
[0187] Furthermore, from the first candidate tool call sequence corresponding to each of the call operation chains, a second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window is identified, and the second candidate tool call sequence is determined as the target tool call sequence. This ensures both the timeliness and reusability of the sequence, effectively filters out accidental and low-frequency invalid tool combinations, avoids including non-general tool call logic in the scope of macro instruction tool construction, and ensures that the execution order and data dependency relationship of the macro instruction tool definition conform to the actual task execution rules. This can improve the task execution efficiency of the agent and reduce the number of inferences and resource consumption.
[0188] As another optional embodiment of this application, refer to Figure 3 This is a flowchart illustrating a processing method provided in Embodiment 3 of this application. This embodiment is mainly an implementation of step S102 in Embodiment 1. In this embodiment, the historical execution data includes: multiple call operation chains and tool identifiers corresponding to each call operation in the call operation chains, as well as the input parameters and output results of each call operation.
[0189] For a description of the call operation chain and the tool identifiers corresponding to each call operation in the call operation chain, please refer to Embodiment 2, which will not be repeated here.
[0190] In this embodiment, in each call operation chain, each Actioni is associated with a unique tool identifier (such as tool name, tool number), input parameters, and output results.
[0191] Input parameters can be understood as the necessary data required for the tool to execute (such as the input for a sales data query tool being "last 3 days" and "product A").
[0192] The output can be understood as the valid data generated after the tool is executed (e.g., the output of the sales data query tool is "Product A's sales revenue in the last 3 days is 100,000 yuan").
[0193] like Figure 3 As shown, step S102 may include, but is not limited to, the following steps:
[0194] Step S1023: Arrange the tool identifiers corresponding to each call operation in the call operation chain according to the execution order of each call operation in the call operation chain to obtain the first candidate tool call sequence corresponding to the call operation chain.
[0195] For a detailed description of step S1023, please refer to the relevant description of step S1021 in Example 2, which will not be repeated here.
[0196] Step S1024: Extract all tool pairs from the first candidate tool call sequence; the tool pair includes adjacent preceding and following tools.
[0197] In this embodiment, all adjacent tools in the first candidate tool call sequence can be traversed to generate pairs of tools, with each pair clearly distinguishing between the preceding and following tools.
[0198] For example, for the above first candidate tool call sequence [A, B, C] (A = sales data query tool, B = trend calculation tool, C = report generation tool), the extracted tool pairs are: tool pair 1: (A, B) (preceding tool A, subsequent tool B) and tool pair 2: (B, C) (preceding tool B, subsequent tool C).
[0199] Step S1025: Extract the output result of the preceding tool and the input parameters of the following tool from the input parameters and output results of each of the calling operations.
[0200] In this embodiment, the target call operation chain can be selected from multiple call operation chains based on the tool identifier of the preceding tool and the tool identifier of the following tool.
[0201] In the target call operation chain, obtain the output result associated with the call operation corresponding to the tool identifier of the preceding tool, and use it as the output result of the preceding tool.
[0202] Obtain the input parameters associated with the call operation corresponding to the tool identifier of the subsequent tool in the target call operation chain, and use them as the input parameters of the subsequent tool.
[0203] Step S1026: Determine that there is a dependency between the output result of the preceding tool and the input parameters of the following tool in each tool pair, and determine the first candidate tool call sequence as the target tool call sequence.
[0204] In this embodiment, the specific process of determining the dependency between the output of the preceding tool and the input parameters of the following tool in a tool pair may include, but is not limited to, at least one of the following:
[0205] Step S31: Compare the field keywords in the output results of the preceding tool (such as "sales revenue", "product A", and "recent 3 days" in "sales revenue of product A in the last 3 days") with the field keywords in the input parameters of the subsequent tool to determine whether there is a direct semantic relationship between the two.
[0206] If the core field of the input parameter of the subsequent tool (such as "sales amount of product A in the last 3 days" input by the trend calculation tool) is completely contained in the field of the output result of the preceding tool, it is judged as a preliminary match; if the input parameter field and the field of the preceding output result have no overlapping keywords (such as "sales amount" in the preceding output and "inventory quantity" in the subsequent input), it is directly judged as no dependency relationship.
[0207] Step S32: Calculate the proportion of data from the output results of the preceding tools in the input parameters of the subsequent tools.
[0208] If the preceding output provides all the core data required for the execution of subsequent tools (such as the "sales data and growth trend" input by the report generation tool being entirely from the output of the preceding sales data query tool and trend calculation tool), then the proportion is 100%, which is considered a strong dependency; if the proportion of core data is lower than the preset threshold (such as 50%), then the dependency relationship is not satisfied.
[0209] In this embodiment, by extracting the preceding output and subsequent input parameters of the tool pair and performing correlation verification, the data flow relationship between tools can be accurately identified, filtering out pseudo-tool combinations that are temporally adjacent but have no actual data dependency. This avoids using logically disjointed sequences for macro instruction tool construction, thereby improving the usability of macro instruction tools from the source. In turn, it can improve the efficiency of intelligent agent task execution and reduce the number of inferences and resource consumption.
[0210] In this embodiment, Embodiments 2 and 3 can be combined to mine tool call sequences from historical execution data. First, a first candidate tool call sequence is obtained according to the method of Embodiment 2. Then, the data dependency relationship of the first candidate tool call sequence is verified by combining the method of Embodiment 3, and finally, the target tool call sequence with high frequency and data dependency relationship is determined.
[0211] For example, identifying the target tool call sequence from the historical execution data may include, but is not limited to, the following steps:
[0212] Step S41: Arrange the tool identifiers corresponding to each call operation in the call operation chain according to the execution order of each call operation in the call operation chain to obtain the first candidate tool call sequence corresponding to the call operation chain.
[0213] Step S42: From the first candidate tool call sequence corresponding to each of the call operation chains, identify the second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window.
[0214] For a detailed description of steps S41-S42, please refer to the relevant description of step S1021 in Example 2, which will not be repeated here.
[0215] Step S43: Extract all tool pairs from the second candidate tool call sequence, each tool pair containing an adjacent preceding tool and a following tool.
[0216] Step S44: Extract the output result of the preceding tool and the input parameters of the following tool from the input parameters and output results of each of the calling operations.
[0217] Step S45: Determine that there is a dependency between the output of the preceding tool and the input parameters of the following tool in each tool pair, and determine the first candidate tool call sequence as the target tool call sequence.
[0218] In this embodiment, steps S43-S45 can be understood by referring to steps S1024-S1026 in embodiment 3, and will not be repeated here.
[0219] In this embodiment, steps S41-S42 generate a first candidate sequence based on the temporal logic of the call operation chain, and then select a second candidate sequence whose frequency exceeds a threshold within a set time window. This effectively filters out accidental and low-frequency non-general tool combinations, ensuring that the candidate sequences have practical reuse value. Steps S43-S45 then extract input parameters and output results and verify dependencies for adjacent tool pairs of the second candidate sequence, eliminating pseudo-valid sequences that are temporally adjacent but have no substantial data dependency. The final selected target tool call sequence has both high-frequency reusability and logical validity. Macro instruction tools built based on this sequence can automatically complete the serial execution of multiple tools without additional data adaptation during invocation, which can reduce the number of inferences and network interaction costs of the agent, and improve task execution efficiency and stability.
[0220] As another optional embodiment of this application, refer to Figure 4 This is a flowchart illustrating a processing method provided in Embodiment 4 of this application. This embodiment is mainly an implementation of step S103 in Embodiment 1, such as... Figure 4 As shown, step S103 may include, but is not limited to, the following steps:
[0221] Step S1031: Obtain the input parameters and output results of each target tool in the target tool call sequence.
[0222] Iterate through each tool in the target tool call sequence (e.g., sales data query tool → trend calculation tool → report generation tool → email sending tool).
[0223] Extract the input parameters (such as time range and product category) and output results (such as sales data query tool output is sales data of product A in the past 3 days) associated with each tool from the historical execution data.
[0224] Step S1032: Determine the macro instruction input parameters based on the input parameters and output results of each target tool.
[0225] In this embodiment, by analyzing the input parameters and output results of each target tool, it is possible to identify which information is truly indispensable in the entire call sequence. For example, the input parameters of some tools may be derived from the output results of preceding tools, and these parameters do not need to be repeated as macro instruction input parameters; however, parameters such as the recipient's email address in an email sending tool, which cannot be derived from preceding steps, and key input parameters that form the basis of the entire sequence (such as "last 3 days" and "product A" in a sales data query tool), must be used as macro instruction input parameters. The macro instruction input parameters determined through this filtering and integration accurately define the minimum necessary information set required to activate the macro instruction tool, avoiding information redundancy and improving operational efficiency.
[0226] Step S1033: Determine the macro instruction output parameters based on the output results of each of the target tools.
[0227] Each target tool produces different outputs during execution, but not all outputs are equally important to the user or the overall business process. By analyzing the outputs of each target tool, the core deliverables that best reflect the value of the entire call sequence can be selected. For example, in a data analysis and report generation task, the intermediate data cleaning tool may output cleaned data, but what the user truly cares about is the insightful report generated after analysis. Therefore, defining report-related parameters as macro command output parameters can focus on the core deliverables and avoid providing too much irrelevant information.
[0228] Macro output parameters can be used to clearly define the specific form (e.g., output as a file (such as a text file, table file, chart file, etc.) or as a data set, specific indicator value, etc.) and key content of the final result that should be presented after the target tool call sequence is executed, ensuring that users can obtain the information they really care about.
[0229] For example, suppose the user request received by the agent is "generate a product sales trend analysis report for the past 3 days and send it to the operations manager." From historical execution data, the identified target tool call sequence may include: sales data query tool → trend calculation tool → report generation tool → email sending tool. Based on the output results of each tool, the determined macro instruction output parameters may include, but are not limited to:
[0230] Report file parameters:
[0231] Parameter Name: File path of the product sales trend analysis report for the past 3 days; Parameter Type: String; Parameter Description: Specifies the storage path of the generated PDF format product sales trend analysis report for the past 3 days in the system. Users can obtain the complete report file through this path. The file contains detailed text descriptions of product sales trends for the past 3 days, relevant data tables, and intuitive charts.
[0232] Sales trend indicator parameters:
[0233] Parameter Name: Total Sales Recent 3 Days; Parameter Type: Numeric; Parameter Description: Extracts the total sales revenue for the past 3 days from the output of the trend calculation tool and presents it in an intuitive numerical form, making it easy for operations managers to quickly understand the overall sales scale.
[0234] Email sending feedback parameters:
[0235] Parameter Name: Email Sending Status; Parameter Type: String; Parameter Description: Retrieves the email sending status information (such as "sent successfully", "sent failed", etc.) from the output of the email sending tool and presents it in string format so that the operations manager can know in a timely manner whether the report has been successfully received.
[0236] By using the macro command output parameters mentioned above, we can not only clarify the core task of generating a complete analysis report for the macro command tool, ensuring that all links work together to output comprehensive and organized report content, but also extract key sales trend indicators and present core data in a concise and intuitive form. At the same time, we can provide feedback on the report sending status, making the macro command tool's operation results clear, verifiable, and controllable, greatly improving the tool's usability and the efficiency of users obtaining information.
[0237] Step S1034: Construct a macro instruction tool based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence.
[0238] In this embodiment, the target tool call sequence can be used as the core skeleton of the execution logic to build an orderly task execution process framework for the macro instruction tool; the macro instruction input parameters are used as the entry constraints for external calls to clarify the range of key information required when the tool starts, ensuring the standardization and necessity of the input; the macro instruction output parameters are used as the standard for external output results to define the final result format and key content that should be presented after the tool is executed. These three core elements are organically integrated to construct the macro instruction tool.
[0239] In this embodiment, by acquiring the input parameters and output results of each tool in the target tool call sequence, the input parameters required to start the macro instruction are then selected and integrated accordingly. This avoids information redundancy and improves operational efficiency. At the same time, the output parameters that reflect the core value of the call sequence are accurately selected, focusing on the core results that users are truly concerned about and clarifying the output form and content. Finally, the macro instruction tool is constructed based on the organic integration of these three core elements. This not only achieves the standardization and automated execution of the target tool call sequence, reducing the complexity of agent invocation and task execution, but also ensures the stability of the macro instruction tool's operation and the predictability of the results by standardizing input and output, improving the tool's practicality and reusability, while allowing users to efficiently obtain key information.
[0240] As another optional embodiment of this application, refer to Figure 5 This is a flowchart illustrating a processing method provided in Embodiment 5 of this application. This embodiment is mainly an implementation of step S1032 in Embodiment 4, such as... Figure 5 As shown, step S1032 may include, but is not limited to, the following steps:
[0241] Step S10321: Extract the input parameters of the first target tool from the input parameters of each of the target tools.
[0242] The first target tool serves as the starting point of the target tool invocation sequence, and its input parameters are the fundamental key information for initiating the entire process.
[0243] For example, in the task of "generating a product sales trend analysis report for the past 3 days and sending it to the operations manager," the target tool call sequence is: sales data query tool → trend calculation tool → report generation tool → email sending tool. The sales data query tool is the first target tool, and its input parameters may include a time range (e.g., "the past 3 days") and a product category (e.g., "product A"). Extracting the input parameters of the first target tool is to clarify the basic and core data requirements when the entire task starts.
[0244] Step S10322: Based on the output results of each target tool, extract free parameters from the input parameters of each target tool; the values of the free parameters come from external input or preset values.
[0245] In a target tool call sequence, the sources of input parameters for different target tools vary. Some target tools' input parameters can be derived from the output of preceding tools, while others cannot be obtained from previous steps. These parameters that cannot be derived from preceding steps can be considered free parameters. The values of free parameters can come from external input (such as information directly provided by the user) or preset values (such as default parameter settings).
[0246] Continuing with the above task as an example, the email sending tool is the last tool in the target tool call sequence. Its input parameters include the recipient's email address, email subject, and email body. The recipient's email address cannot be derived from the output of the preceding tools such as sales data query, trend calculation, and report generation. It needs to be provided by the user in advance or a default email address of the operations manager must be preset by the system. Therefore, the recipient's email address is a free parameter.
[0247] Step S10323: Determine the input parameters of the first target tool and the free parameters as macro instruction input parameters.
[0248] The input parameters and free parameters of the first target tool together constitute the minimum set of necessary information required to start the macro instruction tool. The input parameters of the first target tool ensure that the task can start execution from the correct starting point, while the free parameters supplement information that cannot be obtained through preceding steps but is necessary for task execution.
[0249] For example, in the task described above, the input parameters of the sales data query tool ("last 3 days", "product A") and the free parameters of the email sending tool (recipient's email address) are determined as macro instruction input parameters. Thus, when the agent receives a user-initiated task, it only needs to obtain this key information to activate the macro instruction tool, execute each tool sequentially according to the target tool call sequence, and complete the task of generating and sending the report.
[0250] This method of determining macro instruction input parameters avoids information redundancy, focuses only on truly indispensable information, improves operating efficiency, and also makes the input of macro instruction tools more standardized and clear, making it easier for users to understand and use.
[0251] In this embodiment, the input parameters required to launch the macro instruction tool are precisely selected from the target tool call sequence. This ensures the integrity of the information needed for task execution while avoiding unnecessary information interference. This method of determining macro instruction input parameters helps to build more efficient and practical macro instruction tools, reduces the number of inferences and network interactions by the agent during task execution, reduces resource consumption, and improves the stability and reliability of task execution, thereby better meeting user needs and enhancing the user experience.
[0252] As another optional embodiment of this application, refer to Figure 6 This is a flowchart illustrating a processing method provided in Embodiment 6 of this application. This embodiment is mainly an implementation of step S1033 in Embodiment 4, such as... Figure 6 As shown, step S1033 may include, but is not limited to, the following steps:
[0253] Step S10331: Based on the output results of each of the target tools, determine a first output parameter and / or a second output parameter, and determine the first output parameter and / or the second output parameter as macro instruction output parameters; the first output parameter corresponds to the last target tool among the target tools; the second output parameter corresponds to the intermediate tool specified among the target tools.
[0254] In a sequence of target tool calls, each target tool generates corresponding output results after executing its task. These output results have varying degrees of importance to the user and the overall business process. To ensure that macro tools provide the key information that users truly care about, it is necessary to select appropriate parameters from these output results as macro output parameters.
[0255] The final target tool, located at the end of the target tool call sequence, typically delivers the core result to the user upon completion of the entire task. For example, in the task "Generate a product sales trend analysis report for the past 3 days and send it to the operations manager," the target tool call sequence is: sales data query tool → trend calculation tool → report generation tool → email sending tool. While the email sending tool is the last target tool, its primary function is to send the report; the truly valuable output is the report content generated by the report generation tool. However, from a broader perspective, if the email sending success status is also important to the user, then the "email sending status" feedback from the email sending tool (such as "sent successfully," "sent failed," etc.) can also be considered a key output. But more typically and fundamentally, the report generated by the report generation tool contains a detailed analysis of the product sales trends over the past 3 days, representing the key information the user ultimately wants to obtain. Therefore, determining the first output parameter based on the output of the last target tool (represented here by the report generation tool) ensures that the macro command tool provides the user with the final and crucial result.
[0256] In some complex task processes, besides the final output, the outputs of intermediate tools can also be of significant reference value to users. These intermediate tool outputs may reflect key intermediate states or key indicators during task execution. For example, in the task mentioned above, the trend calculation tool acts as an intermediary between the sales data query tool and the report generation tool. It calculates the trend of product sales quantity or sales revenue over time (such as an upward trend, a downward trend, or a stable trend) by analyzing the sales data obtained from the sales data query tool. This trend is crucial for users to understand product sales and formulate sales strategies. Therefore, a second output parameter can be determined based on the output of the trend calculation tool (such as a detailed description of the product sales trend over the past three days or relevant indicator values).
[0257] In this embodiment, defining the first output parameter and / or the second output parameter as macro instruction output parameters comprehensively meets the user's needs from both the final result and key intermediate results dimensions. Users can obtain both the complete core results after task completion and the key intermediate information during task execution, thus enabling better decision-making. For example, in the task described above, users can obtain not only a complete product sales trend analysis report for the past three days (first output parameter) but also the specific trends in product sales (second output parameter). This allows users to gain a deeper understanding of sales dynamics and provides stronger support for subsequent work arrangements.
[0258] As another optional embodiment of this application, refer to Figure 7This is a flowchart illustrating a processing method provided in Embodiment 7 of this application. This embodiment is mainly an implementation of step S1034 in Embodiment 4, such as... Figure 7 As shown, step S1034 may include, but is not limited to, the following steps:
[0259] Step S10341: Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, generate an interface file; the interface file is used to define the parameter requirements and output format when the macro instruction tool is called; the tool description is used to describe the overall function of the macro instruction tool.
[0260] Interface files can, but are not limited to, using the standard Tool Schema format, such as the OpenAI FunctionCalling format. This format typically includes information such as parameter names, parameter types, parameter descriptions, and output formats.
[0261] The interface file clarifies the specific requirements for the input and output parameters of the macro command tool, avoiding problems caused by parameter mismatch or format errors. It ensures that the macro command tool can transmit and receive data according to the predetermined specifications when interacting with other systems or components.
[0262] The tool description may include, but is not limited to, the macro tool's name, function description, input parameter description, output result description, and usage examples. This information helps in understanding the macro tool's purpose and usage, improving its ease of use and practicality.
[0263] Step S10342: Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, generate executable code; the executable code encodes the execution order, data dependencies, and data processing logic of each target tool in the target tool call sequence.
[0264] The executable code encodes the execution order of each target tool in the target tool call sequence, which can ensure that the task can be executed step by step according to the predetermined process.
[0265] The execution code encodes the data dependencies of each target tool in the target tool call sequence, ensuring that data can be correctly transferred and processed between tools.
[0266] The executable code encodes the data processing logic of each target tool in the target tool call sequence, such as data transformation and data filtering. This data processing logic can be used to preprocess input data or post-process output data to meet task requirements.
[0267] In this embodiment, a specific example is used to illustrate the executable code. For example, the executable code may include: def Macro_SearchSummarizeEmail(query, email_address):
[0268] # Step 1: Launch target tool A (file search tool)
[0269] file_content = Atom_SearchFile(keyword=query)
[0270] # Step 2: Data flow, calling target tool B (summary generation tool)
[0271] summary = Atom_Summarize(text=file_content)
[0272] # Step 3: Data flow, calling target tool C (email sending tool)
[0273] result = Atom_SendEmail(to=email_address, body=summary)
[0274] return result
[0275] In this example of executable code, `Macro_SearchSummarizeEmail` is a macro that accepts a query keyword (`query`) and an email address (`email_address`) as input parameters. By calling three target tools (a file search tool, a summary generation tool, and an email sending tool), it can achieve a complete workflow from file search to summary generation to email sending.
[0276] Step S10343: Combine the interface file, the tool description, and the executable code into a macro instruction tool.
[0277] By combining interface files, tool descriptions, and executable code, a complete macro instruction tool can be built to achieve standardized and automated execution of the target tool call sequence.
[0278] For example, taking a macro tool containing the executable code from step S10342 as an example, if the user's requirement is for a legal professional to find the "breach of contract clauses" in a contract and send them to a client, the agent can call the macro tool Macro_SearchSummarizeEmail, input the query keyword "breach of contract clauses" and the client's email address "client@example.com", and the macro tool will automatically call the file search tool to locate the contract content, the summary generation tool to extract key information, and the email sending tool to deliver the results in sequence, finally returning the execution status (such as "Email sent successfully"). The entire process does not require multiple reasoning steps, which can improve task processing efficiency and accuracy.
[0279] In this embodiment, the interface file clearly defines the input parameter requirements and output format specifications of the macro instruction tool. This ensures parameter matching and data consistency when the macro instruction tool interacts with agents and other systems, avoiding execution interruptions due to incorrect parameter formats. The tool description also clearly defines the overall function of the macro instruction tool, reducing the cognitive cost for agents to recognize and call the macro instruction tool, and improving the tool's usability and reusability. On the other hand, the executable code encodes the execution order, data dependencies, and data processing logic of the target tool call sequence. This can replace the agent's original multiple "think-act-observe" loops. When calling the macro instruction tool, only one inference is needed to trigger fully automated execution, improving the stability and reliability of task execution, significantly reducing the number of inferences, network interaction frequency, and token consumption, and significantly reducing task execution latency and resource costs.
[0280] As another optional embodiment of this application, this embodiment provides a processing method for embodiment 8 of this application. This embodiment is mainly an implementation method of the tool described above. The tool description may include, but is not limited to:
[0281] The macro command tool includes a functional description and prompts; the prompts are used to suggest the target model, and when the function of the macro command tool matches the user's needs, the macro command tool is selected for execution first.
[0282] The macro tool's functional description describes the complete range of tasks the macro tool can perform, clearly distinguishing it from the target tool. For example, the functional description could include: This tool integrates the capabilities of a "sales data query tool," "trend calculation tool," "report generation tool," and "email sending tool." Based on the input time range, product category, and recipient email address, it can automatically complete the entire process of sales data query → trend analysis → report generation → email sending, directly outputting the report storage path, total sales amount, and email sending status.
[0283] The prompts can use instructional expressions that the target model can recognize, so as to avoid the target model ignoring macro instruction tools due to its preference for step-by-step reasoning.
[0284] For example, the prompt message may include: When the user's needs include core task scenarios, such as the complete chain of sales report generation and sending, please call this macro tool first, rather than calling individual tools in sequence, such as sales data query tool, trend calculation tool, etc.; the function of this tool covers the serial execution logic of the above target tools, and has higher execution efficiency and lower resource consumption.
[0285] In this embodiment, a functional description is used to describe the complete task range that the macro instruction tool can perform, clearly distinguishing it from a single target tool. This allows the target model to quickly identify the complete task chain that the macro instruction tool can directly complete, eliminating the need to reason about the combined logic of multiple single tools and significantly reducing the model's task matching and decision-making costs. Simultaneously, priority prompts guide the target model to prioritize calling the macro instruction tool when user needs match its functionality. This avoids the inefficient path of multiple calls to single tools due to a preference for step-by-step reasoning, ensuring that tasks are executed in an efficient mode of one inference and one interaction. This steadily reduces the number of inferences, network interaction frequency, and token consumption, thereby lowering task execution latency and resource costs.
[0286] As another optional embodiment of this application, refer to Figure 8 This is a flowchart illustrating a processing method provided in Embodiment 9 of this application, as shown below. Figure 8 As shown, the method may include, but is not limited to, the following steps:
[0287] Step S201: Obtain historical execution data from the reasoning process of the target model.
[0288] Step S202: Identify the target tool call sequence from the historical execution data; the target tool call sequence contains multiple target tools called consecutively in chronological order; each target tool is used to perform a single target task related to the inference of the target model.
[0289] Step S203: Based on the target tool call sequence, construct a macro instruction tool; the macro instruction tool is used to define the execution order and data dependencies of multiple target tools.
[0290] For a detailed description of steps S201-S203, please refer to the relevant description of steps S101-S103 in Example 1, which will not be repeated here.
[0291] Step S204: Register the macro instruction tool to a first tool library; the first tool library is independent of the second tool library; the second tool library contains multiple tools; the multiple tools include the multiple target tools.
[0292] In this embodiment, macro instruction tools can be stored in a specified physical storage location according to the preset directory structure of the first tool library.
[0293] A search index is built corresponding to the physical storage location of macro command tools. Using this search index, macro command tools can be retrieved from the first tool library.
[0294] Step S205: In response to the input data, search for the target macro instruction tool in the first tool library based on the target model.
[0295] In this embodiment, key information and intent can be extracted from the input data using Natural Language Processing (NLP) technology, to obtain first semantic information. For example, for the input "Generate a product sales trend analysis report for the past 3 days and send it to the operations manager", NLP technology can identify key actions (generating a report, sending an email), time range (the past 3 days), report type (product sales trend analysis report), and recipient (operations manager), etc., as first semantic information.
[0296] Simultaneously, the core functions and key parameters of each macro instruction tool in the first tool library are extracted to obtain the second semantic information.
[0297] Then, the first semantic information of the input data can be matched with the second semantic information of the macro tool. For example, similarity calculation algorithms (such as cosine similarity, Jaccard similarity, etc.) can be used to measure the degree of similarity between the first and second semantic information. If the similarity exceeds a certain threshold, it can be determined that the input data matches the function of the macro tool.
[0298] If yes, proceed to step S206; otherwise, proceed to step S207.
[0299] Step S206: Based on the target macro instruction tool, process the input data to obtain the inference result.
[0300] For a detailed description of step S206, please refer to the relevant introduction on reasoning based on macro instruction tools in Example 1, which will not be repeated here.
[0301] Step S207: Based on the target model, search for the target tool in the second tool library.
[0302] The detailed process of step S207 can be found in the description of the matching single target tool in Example 1, and will not be repeated here.
[0303] In this embodiment, historical execution data is obtained from the inference process of the target model to identify the target tool call sequence. A macro instruction tool is then constructed based on this sequence and registered in a first tool library independent of the second tool library, forming a dual-tool library architecture. Finally, when responding to input data, a matching macro instruction tool can be searched in the first tool library. If a match is found, the macro instruction tool is directly invoked to complete the entire task, eliminating the need for multiple inferences by the agent. Only one inference and one network interaction are required to trigger the automated sequential execution of multiple tools, significantly reducing the number of inferences, network interaction frequencies, and token consumption, thereby significantly reducing task execution latency and resource costs. If no macro instruction tool is found, the target tool is searched in the second tool library to complete the task, ensuring the comprehensiveness and flexibility of task processing.
[0304] By deploying the dual tool libraries independently and using a layered invocation mechanism, the advantages of macro instruction tools and target tools are complemented, balancing the efficiency and full coverage of task processing, and effectively improving the response speed and service quality of the intelligent agent.
[0305] In this embodiment, the processing method will be fully described in conjunction with the system architecture. For example, as Figure 9 As shown, the execution trajectory collection module in the offline mining and generation system can obtain historical execution data from the log library (which contains logs generated by the agent execution engine).
[0306] The sequence pattern mining module in the offline mining and generation system can identify target tool call sequences from historical execution data.
[0307] The macro instruction synthesizer in the offline mining and generation system can construct macro instruction tools based on the target tool call sequence.
[0308] Macro tools can be registered to the macro registry (one implementation of the first tool library).
[0309] The construction process of the aforementioned macro instruction tools in the offline mining and generation system can be carried out offline, without conflicting with the real-time user data processing flow. It can perform centralized analysis and processing of accumulated historical execution data during relatively idle periods or specific time cycles, thereby constructing macro instruction tools to improve the efficiency of subsequent data processing.
[0310] When the agent's execution engine receives user input data, it can respond to the input data and prioritize searching for the target macro instruction tool in the macro instruction registry center;
[0311] If found, the agent execution engine can load the target macro instruction tool, and then process the input data based on the target macro instruction tool to obtain the inference result.
[0312] If the target tool is not found, the agent's execution engine can continue searching in the second tool library. This second tool library stores various tools; if the target tool is successfully found there, the input data is processed based on that tool. This supplementary approach ensures that even without suitable macro instruction tools, the system can utilize basic tools to complete data processing tasks, guaranteeing the system's robustness and versatility.
[0313] The processing apparatus provided in this application will be described below. The processing apparatus described below can be referred to in correspondence with the processing method described above.
[0314] The processing device includes:
[0315] The acquisition module is used to obtain historical execution data from the inference process of the target model.
[0316] An identification module is used to identify a target tool call sequence from the historical execution data; the target tool call sequence contains multiple target tools called consecutively in chronological order; the target tool is used to perform a single target task related to the inference of the target model.
[0317] A construction module is used to construct a macro instruction tool based on the target tool call sequence; the macro instruction tool is used to define the execution order and data dependencies of multiple target tools.
[0318] In this embodiment, the historical execution data may include: multiple call operation chains and tool identifiers corresponding to each call operation in the call operation chain; the call operation is used to call a tool.
[0319] The recognition module can be specifically used for:
[0320] According to the execution order of each call operation in the call operation chain, the tool identifiers corresponding to each call operation in the call operation chain are arranged to obtain the first candidate tool call sequence corresponding to the call operation chain;
[0321] From the first candidate tool call sequence corresponding to each of the call operation chains, identify the second candidate tool call sequence that appears more frequently than a set frequency threshold within a set time window, and determine the second candidate tool call sequence as the target tool call sequence.
[0322] In this embodiment, the historical execution data may include: multiple call operation chains, the tool identifier corresponding to each call operation in the call operation chain, and the input parameters and output results of each call operation.
[0323] The recognition module can be specifically used for:
[0324] According to the execution order of each call operation in the call operation chain, the tool identifiers corresponding to each call operation in the call operation chain are arranged to obtain the first candidate tool call sequence corresponding to the call operation chain;
[0325] Extract all tool pairs from the first candidate tool invocation sequence; each tool pair contains an adjacent preceding tool and a following tool.
[0326] Extract the output of the preceding tool and the input parameters of the following tool from the input parameters and output results of each of the aforementioned invocation operations;
[0327] If a dependency is found between the output of the preceding tool and the input parameters of the following tool in each tool pair, the first candidate tool call sequence is determined as the target tool call sequence.
[0328] In this embodiment, the construction module can specifically be used for:
[0329] Obtain the input parameters and output results of each target tool in the target tool call sequence;
[0330] Based on the input parameters and output results of each of the target tools, the macro instruction input parameters are determined;
[0331] Based on the output results of each of the target tools, determine the macro instruction output parameters;
[0332] A macro instruction tool is constructed based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence.
[0333] The construction module determines the macro instruction input parameters based on the input parameters and output results of each target tool, which may specifically include:
[0334] Extract the input parameters of the first target tool from the input parameters of each of the target tools;
[0335] Based on the output results of each target tool, free parameters are extracted from the input parameters of each target tool; the values of the free parameters come from external input or preset values.
[0336] The input parameters of the first target tool and the free parameters are determined as macro instruction input parameters.
[0337] Based on the output results of each of the target tools, the construction module determines the macro instruction output parameters, which may specifically include:
[0338] Based on the output results of each of the target tools, a first output parameter and / or a second output parameter are determined, and the first output parameter and / or the second output parameter are determined as macro instruction output parameters; the first output parameter corresponds to the last target tool among the target tools; the second output parameter corresponds to the intermediate tool specified among the target tools.
[0339] The construction module constructs a macro instruction tool based on the macro instruction input parameters, the macro instruction output parameters, and the target tool invocation sequence, which may specifically include:
[0340] Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, an interface file and a tool description are generated; the interface file is used to define the parameter requirements and output format when the macro instruction tool is called; the tool description is used to describe the overall functionality of the macro instruction tool.
[0341] Based on the macro instruction input parameters, the macro instruction output parameters, and the target tool call sequence, executable code is generated; the executable code encodes the execution order, data dependencies, and data processing logic of each target tool in the target tool call sequence;
[0342] The interface file, the tool description, and the executable code are combined to form a macro instruction tool.
[0343] The tool description may specifically include:
[0344] The macro command tool includes a functional description and prompts; the prompts are used to suggest the target model, and when the function of the macro command tool matches the user's needs, the macro command tool is selected for execution first.
[0345] In this embodiment, the processing device may further include:
[0346] A registration module is used to register the macro instruction tool to a first tool library; the first tool library is independent of the second tool library; the second tool library contains multiple tools; the multiple tools include the multiple target tools.
[0347] The first search module is used to search for target macro instruction tools in the first tool library based on the target model in response to input data.
[0348] The first processing module, if a target macro instruction tool is found in the first tool library, processes the input data based on the target macro instruction tool to obtain a reasoning result.
[0349] The second search module is used to search for the target tool in the second tool library based on the target model if the target macro instruction tool is not found in the first tool library.
[0350] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0351] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0352] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0353] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A processing method, comprising: obtaining historical execution data from an inference process of a target model; identifying a target tool call sequence from the historical execution data; the target tool call sequence comprising a plurality of target tools called in time sequence; each of the target tools being used to perform a single target task related to the inference of the target model; constructing a macro instruction tool based on the target tool call sequence; the macro instruction tool being used to define an execution order and a data dependency relationship of the plurality of target tools.
2. The processing method of claim 1, the historical execution data comprising: a plurality of call operation chains and tool identifiers corresponding to each call operation in the call operation chains; the call operation being used to call a tool; the identifying the target tool call sequence from the historical execution data comprises: arranging the tool identifiers corresponding to each call operation in the call operation chains in an execution order of the call operations in the call operation chains to obtain a first candidate tool call sequence corresponding to the call operation chains; identifying a second candidate tool call sequence with a frequency higher than a set frequency threshold within a set time window from each first candidate tool call sequence to determine the second candidate tool call sequence as the target tool call sequence.
3. The processing method of claim 1, the historical execution data comprising: a plurality of call operation chains and tool identifiers corresponding to each call operation in the call operation chains and input parameters and output results of each call operation; the identifying the target tool call sequence from the historical execution data comprises: arranging the tool identifiers corresponding to each call operation in the call operation chains in an execution order of the call operations in the call operation chains to obtain a first candidate tool call sequence corresponding to the call operation chains; extracting all tool pairs from the first candidate tool call sequence; the tool pair comprising a preceding tool and a subsequent tool adjacent to each other; extracting the output result of the preceding tool and the input parameter of the subsequent tool from the input parameters and output results of each call operation; determining that there is a dependency relationship between the output result of the preceding tool and the input parameter of the subsequent tool in each tool pair to determine the first candidate tool call sequence as the target tool call sequence.
4. The processing method of claim 1, the constructing the macro instruction tool based on the target tool call sequence comprises: obtaining input parameters and output results of each target tool in the target tool call sequence; determining a macro instruction input parameter based on the input parameters and output results of each target tool; determining a macro instruction output parameter based on the output results of each target tool; constructing the macro instruction tool based on the macro instruction input parameter, the macro instruction output parameter and the target tool call sequence.
5. The processing method of claim 4, the determining the macro instruction input parameter based on the input parameters and output results of each target tool comprises: extracting an input parameter of a first target tool from the input parameters of each target tool; extract a free parameter from input parameters of each of the target tools based on output results of the target tools; the free parameter is from external input or a preset value; determine the input parameters of the first target tool and the free parameter as macro instruction input parameters.
6. The processing method of claim 4, determining macro instruction output parameters based on output results of each of the target tools, comprising: determining first output parameters and / or second output parameters based on output results of each of the target tools, and determining the first output parameters and / or the second output parameters as macro instruction output parameters; the first output parameters correspond to a last target tool among the target tools; the second output parameters correspond to a specified intermediate tool among the target tools.
7. The processing method of claim 4, constructing a macro instruction tool based on the macro instruction input parameters, the macro instruction output parameters and the target tool calling sequence, comprising: generating an interface file and a tool description based on the macro instruction input parameters, the macro instruction output parameters and the target tool calling sequence; the interface file is used to define parameter requirements and output formats when the macro instruction tool is called; the tool description is used to describe overall functions of the macro instruction tool; generating executable code based on the macro instruction input parameters, the macro instruction output parameters and the target tool calling sequence; the executable code is encoded with execution orders, data dependency relationships and data processing logic of each target tool in the target tool calling sequence; composing the macro instruction tool with the interface file, the tool description and the executable code.
8. The processing method of claim 7, the tool description, comprising: function description and prompt information of the macro instruction tool; the prompt information is used to prompt a target model to preferentially select the macro instruction tool for execution when functions of the macro instruction tool match user needs.
9. The processing method of claim 1, the processing method further comprising: registering the macro instruction tool to a first tool library; the first tool library is independent of a second tool library; the second tool library contains a plurality of tools; the plurality of tools contain the plurality of target tools; based on a target model, searching for a target macro instruction tool in the first tool library in response to input data; based on the target macro instruction tool, processing the input data to obtain inference results if the target macro instruction tool is found; based on the target model, searching for a target tool in the second tool library if the target macro instruction tool is not found.
10. A processing apparatus, comprising: an acquisition module, configured to acquire historical execution data from an inference process of a target model; an identification module, configured to identify a target tool calling sequence from the historical execution data; the target tool calling sequence contains a plurality of target tools called in time sequence; the target tools are used to execute a single target task related to inference of the target model. A constructing module is configured to construct a macro instruction tool based on the target tool call sequence, and the macro instruction tool is configured to define an execution sequence and a data dependency relationship of the target tools.