Method and system for selecting external tool of intelligent agent

By combining semantic similarity search and multidimensional evaluation with optimization algorithms, the method and system for selecting external tools for intelligent agents solve the problems of lack of flexibility and accuracy in the selection and invocation of external tools in existing technologies, and realize safe, comprehensive and efficient tool selection and invocation.

CN121277971APending Publication Date: 2026-01-06THE FIFTH AFFILIATED HOSPITAL OF GUANGZHOU MEDICAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511313886.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2026-01-06

AI Technical Summary

Technical Problem

In existing technologies, the discovery, selection, and invocation of external tools by intelligent agents lack flexibility and accuracy, resulting in limited overall performance. It is impossible to discover available tools beyond keywords or metadata, and the selection and invocation decisions lose reliability and credibility.

Method used

By using semantic similarity to find candidate external tools, constructing a multi-dimensional evaluation vector, combining optimization algorithms and intelligent agent strategies, selecting the optimal solution, and acting as an agent for task requests through an access gateway, the system achieves improvements in security, comprehensiveness, and flexibility.

Benefits of technology

It improves the accuracy of selecting and rationalizing the use of external tools for intelligent agents, prevents malicious behavior, and ensures the security and efficiency of task execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121277971A_ABST
    Figure CN121277971A_ABST
Patent Text Reader

Abstract

The invention discloses an agent external tool selection method and system, and relates to the field of artificial intelligence, and the method comprises the steps: obtaining a plurality of candidate external tools through semantic similarity searching in a tool registration center according to a task request of a first agent if an access gateway passes the identity authentication of the first agent; classifying and evaluating the historical operation data of each candidate external tool through a plurality of preset dimensions, and constructing a multi-dimensional evaluation vector of each candidate external tool; based on an optimization algorithm, according to the multi-dimensional evaluation vector of each candidate external tool, in combination with a first strategy of the first agent, searching for an optimal solution of the candidate external tool to obtain a tool to be called; and feeding back the calling decision of the to-be-called tool to the access gateway, so that the access gateway agents the task request to the to-be-called tool for execution. According to the method and the device, the problem of lack of flexibility and accuracy in discovery, selection and calling of external tools of existing agents can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method and system for selecting external tools for an intelligent agent. Background Technology

[0002] With the continuous development of artificial intelligence, large, singular language models / big models are gradually evolving into intelligent agents that autonomously or semi-autonomously perform tasks within their environments. These agents can represent users in multi-step tasks such as data analysis, report generation, or schedule management. Inevitably, this requires selecting and invoking external tools, accessing real-time data sources, or interacting with third-party services. In practical applications, the effectiveness of discovering, selecting, and invoking external tools directly impacts the overall performance and user experience of the large model / intelligent agent. Therefore, it is necessary to optimize the discovery, selection, and invoking of external tools for large models / intelligent agents to improve their overall performance and enhance the user experience.

[0003] Currently, solutions for the discovery, selection, and invocation of external tools for large models / agents mainly include static hard-coded integration or rule-based configuration, Universal Description Discovery and Integration (UDDI) systems for service-oriented architectures, service mesh and API gateway technologies for microservice architectures, and MCP (Model Context Protocol) registry and gateway technologies. These technologies all have varying degrees of shortcomings in application: (1) Existing solutions highly link the discovery, selection, and invocation of external tools to human developers or operators. Agents can only passively receive pre-configured external tools, which severely limits the flexibility of interfacing with external tools and even has a negative impact on the overall performance of large models / agents; (2) Existing solutions discover external tools through text search or classification of keywords or metadata. This discovery method is insufficient for agents, which can only search for pre-configured keywords or metadata of external tools to discover corresponding tools, and cannot discover available tools beyond keywords or metadata. For example, if the agent's task is to "create a sales data chart", the possible tool to be discovered could be "DataVisualizer". This tool may not contain keywords or metadata such as "chart" or "sales data", but it can still complete the task. (3) Existing solutions usually simplify the selection and invocation of external tools into a superposition of multiple binary logics, such as whether the service / external tool is available, the first-come-first-served invocation of multiple available tools, or setting the invocation to some simple hard-coded preferences. These methods will cause the decision of tool selection and invocation to lose reliability and credibility, and will not be able to solve more complex decision problems. They lack flexibility and it is difficult to find the optimal solution to the task. Therefore, how to improve the flexibility and accuracy of the discovery, selection and invocation of external tools for large models / agents is still a problem that needs to be solved by existing technologies. Summary of the Invention

[0004] This application provides a method and system for selecting external tools for intelligent agents, in order to solve the technical problems of lack of flexibility and accuracy in the discovery, selection and invocation of external tools for intelligent agents.

[0005] According to a first aspect of the embodiments of this application, a method for selecting external tools for an intelligent agent is provided, comprising:

[0006] If the gateway successfully authenticates the first intelligent agent, then based on the task request of the first intelligent agent, it searches for several candidate external tools in a preset tool registry center through semantic similarity; wherein, the task request is obtained by the first intelligent agent through semantic understanding of the user's input instructions;

[0007] Find the historical operation data of each candidate external tool, and classify and evaluate the historical operation data of each candidate external tool through multiple preset dimensions, and construct a multi-dimensional evaluation vector for each candidate external tool;

[0008] Based on a preset optimization algorithm, and according to the multidimensional evaluation vector of each candidate external tool, combined with the first strategy of the first agent, the optimal solution of the candidate external tool is found to obtain the tool to be invoked; wherein the first strategy is obtained based on the analysis of the task request by the first agent.

[0009] The decision to invoke the tool to be invoked is fed back to the access gateway, so that the access gateway proxies the task request to the tool to be invoked for execution.

[0010] After the access gateway authenticates the first intelligent agent, this application uses semantic similarity to find several candidate external tools corresponding to the task request. Authenticating the first intelligent agent prevents malicious behavior during task execution and ensures task security. Simultaneously, semantic similarity-based tool lookup defines a reasonable and precise selection range, improving the accuracy of subsequent selection and solution. Furthermore, by classifying and evaluating the historical operational data of each candidate external tool across multiple preset dimensions, a multi-dimensional evaluation vector is constructed. This enhances the comprehensiveness of the evaluation of candidate external tools and avoids the unreliability caused by the superposition of multiple binary logics in existing external tool selection methods. The system enhances credibility and flexibility, improving the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool evaluation, it improves the objectivity of candidate external tool assessment, thus ensuring flexibility in selection. Furthermore, based on optimization algorithms, combining the multi-dimensional evaluation vector of each candidate external tool with the first strategy, the optimal solution is found to obtain the tool to be invoked. The optimization algorithm accurately solves and selects the optimal tool among all candidate external tools, improving the accuracy of external tool selection for the agent. This, in turn, improves the rationality of proxy execution when feeding back the invocation decision of the tool to be invoked to the access gateway to delegate task requests to the tool for execution.

[0011] In some embodiments of this application, the step of obtaining several candidate external tools by semantic similarity search in a preset tool registry based on the task request of the first intelligent agent specifically includes:

[0012] Based on the preset task processing model, the task request is converted into a task request query vector.

[0013] Based on the task request query vector, a search is performed in the corresponding vector database of the tool registry. During the search, the similarity between the task request query vector and the query vectors of each tool in the tool registry is calculated, and several candidate external tools are obtained by filtering and sorting based on the similarity.

[0014] This application first converts task requests into task request query vectors based on a large task processing model. This converts task requests into a data format that is easier to process later, improving processing efficiency. Then, in the vector database of the tool registry, it searches by calculating the similarity between the task request query vectors and the query vectors of each tool. Based on the similarity, it filters and sorts several candidate external tools to obtain several candidates. Based on the similarity search method, it can define a reasonable and accurate selection range, improving the accuracy of subsequent selection and solution.

[0015] In some embodiments of this application, the step of classifying and evaluating the historical operational data of each candidate external tool through multiple preset dimensions, and constructing a multi-dimensional evaluation vector for each candidate external tool, specifically includes:

[0016] Each column of historical operational data for each candidate external tool is categorized into the dimensions of the multiple dimensions, and the initial evaluation value of each candidate external tool on each of the multiple dimensions is calculated using normalization; wherein, the multiple dimensions include performance dimension, security dimension, reliability dimension, community trust dimension, and cost dimension;

[0017] Based on the preset weights of each dimension in the multiple dimensions, the initial evaluation values ​​of each candidate external tool in each dimension are weighted to obtain a weighted evaluation value. The weighted evaluation values ​​of all dimensions of each candidate external tool are then integrated to construct a multidimensional evaluation vector for each candidate external tool.

[0018] This application first categorizes the historical operational data of each candidate external tool into multiple dimensions, then normalizes and calculates the initial evaluation value of each data column. Based on the preset weights of each dimension, it then weights and integrates the initial evaluation values ​​of each data column to construct a multi-dimensional evaluation vector for each candidate external tool. This improves the comprehensiveness of the evaluation of candidate external tools, avoids the lack of reliability, credibility, and flexibility caused by the superposition of multiple binary logics in existing external tool selection methods, and improves the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool selection, it enhances the objectivity of the evaluation of candidate external tools, thereby ensuring flexibility in the selection of candidate external tools.

[0019] In some embodiments of this application, the step of finding the optimal solution for the candidate external tool based on a preset optimization algorithm, according to the multidimensional evaluation vector of each candidate external tool, and in conjunction with the first strategy of the first agent, to obtain the tool to be invoked, specifically includes:

[0020] Based on each candidate external tool and its corresponding multidimensional evaluation vector, and combined with the first strategy of the first agent, the problem to be solved and the corresponding solution constraints are determined.

[0021] Based on the Pareto optimization method, the problem to be solved and its corresponding constraints are solved, the Pareto optimal solution of the problem to be solved is identified, and the tool to be called is obtained.

[0022] This application first determines the problem to be solved and the constraints to be solved based on each candidate external tool and its corresponding multidimensional evaluation vector, combined with the first strategy. Then, based on the Pareto optimization method, it identifies the Pareto optimal solution to the problem to be solved and determines the tool to be invoked. The Pareto optimization algorithm is used to accurately solve and select the tool to be invoked from all candidate external tools, thereby improving the accuracy of the selection of external tools for the agent and thus improving the rationality of subsequent execution of task requests by proxy through the tool to be invoked.

[0023] In some embodiments of this application, after feeding back the invocation decision for the tool to be invoked to the access gateway, so that the access gateway proxies the task request to the tool to be invoked for execution, the method further includes:

[0024] The system acquires the execution data of the task request collected by the access gateway and executed in the tool to be invoked, and updates the historical running data of the tool to be invoked based on the execution data.

[0025] This application obtains the execution data of the task requests collected by the access gateway and executed in the tool to be invoked, and then updates the historical running data of the tool to be invoked. This enables closed-loop data feedback, thereby continuously improving the flexibility and accuracy of the intelligent agent in discovering, selecting and invoking external tools.

[0026] According to a second aspect of the embodiments of this application, an apparatus for selecting external tools for an intelligent agent is provided, including a candidate tool search module, a candidate tool evaluation module, a tool optimization selection module, and a tool decision invocation module;

[0027] The candidate tool search module is used to obtain several candidate external tools by semantic similarity search in a preset tool registry center according to the task request of the first intelligent agent if the access gateway successfully authenticates the identity of the first intelligent agent; wherein, the task request is obtained by the first intelligent agent through semantic understanding of the user's input instructions;

[0028] The candidate tool evaluation module is used to find the historical operation data of each candidate external tool, and to classify and evaluate the historical operation data of each candidate external tool through multiple preset dimensions, thereby constructing a multi-dimensional evaluation vector for each candidate external tool.

[0029] The tool optimization and selection module is used to find the optimal solution of the candidate external tool based on a preset optimization algorithm, according to the multi-dimensional evaluation vector of each candidate external tool, and in combination with the first strategy of the first agent, to obtain the tool to be called; wherein the first strategy is obtained based on the analysis of the task request by the first agent.

[0030] The tool decision invocation module is used to feed back the invocation decision for the tool to be invoked to the access gateway, so that the access gateway will delegate the task request to the tool to be invoked for execution.

[0031] In some embodiments of this application, the candidate tool search module includes a task request conversion unit and a candidate tool search unit;

[0032] The task request conversion unit is used to convert the task request into a task request query vector based on a preset task processing big model.

[0033] The candidate tool search unit is used to search in the corresponding vector database of the tool registry center according to the task request query vector. During the search, the similarity between the task request query vector and each tool query vector in the tool registry center is calculated, and a number of candidate external tools are obtained by filtering and sorting according to the similarity.

[0034] In some embodiments of this application, the candidate tool evaluation module includes an initial evaluation unit and a weighted evaluation unit;

[0035] The initial evaluation unit is used to classify each data column of the historical operation data of each candidate external tool into each of the multiple dimensions, and to normalize and calculate the initial evaluation value of each candidate external tool in each of the multiple dimensions; wherein, the multiple dimensions include performance dimension, security dimension, reliability dimension, community trust dimension and cost dimension.

[0036] The weighted evaluation unit is used to weight the initial evaluation values ​​of each candidate external tool on each of the multiple dimensions based on the preset weights of each dimension to obtain a weighted evaluation value, and to integrate the weighted evaluation values ​​of all dimensions of each candidate external tool to construct a multidimensional evaluation vector for each candidate external tool.

[0037] In some embodiments of this application, the tool optimization selection module includes a problem determination unit and a problem solving unit;

[0038] The problem determination unit is used to determine the problem to be solved and the corresponding solution constraints based on each candidate external tool and its corresponding multidimensional evaluation vector, combined with the first strategy of the first agent.

[0039] The problem-solving unit is used to solve the problem to be solved and the corresponding solution constraints based on the Pareto optimization method, identify the Pareto optimal solution of the problem to be solved, and obtain the tool to be called.

[0040] In some embodiments of this application, a tool feedback update module is also included;

[0041] The tool feedback update module is used to obtain the execution data of the task request collected by the access gateway and executed in the tool to be invoked, and update the historical running data of the tool to be invoked based on the execution data.

[0042] After the access gateway authenticates the first intelligent agent, this application uses semantic similarity to find several candidate external tools corresponding to the task request. Authenticating the first intelligent agent prevents malicious behavior during task execution and ensures task security. Simultaneously, semantic similarity-based tool lookup defines a reasonable and precise selection range, improving the accuracy of subsequent selection and solution. Furthermore, by classifying and evaluating the historical operational data of each candidate external tool across multiple preset dimensions, a multi-dimensional evaluation vector is constructed. This enhances the comprehensiveness of the evaluation of candidate external tools and avoids the unreliability caused by the superposition of multiple binary logics in existing external tool selection methods. The system enhances credibility and flexibility, improving the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool evaluation, it improves the objectivity of candidate external tool assessment, thus ensuring flexibility in selection. Furthermore, based on optimization algorithms, combining the multi-dimensional evaluation vector of each candidate external tool with the first strategy, the optimal solution is found to obtain the tool to be invoked. The optimization algorithm accurately solves and selects the optimal tool among all candidate external tools, improving the accuracy of external tool selection for the agent. This, in turn, improves the rationality of proxy execution when feeding back the invocation decision of the tool to be invoked to the access gateway to delegate task requests to the tool for execution. Attached Figure Description

[0043] Figure 1 This is a flowchart illustrating a method for selecting external tools for an intelligent agent, as shown in some embodiments of this application.

[0044] Figure 2This is a modular structure diagram of a device for selecting external tools for an intelligent agent, as shown in some embodiments of this application. Detailed Implementation

[0045] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below in conjunction with the accompanying drawings are exemplary and are only used to explain some embodiments of this application, and should not be construed as limiting the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments shown in this application without inventive effort are within the protection scope of this application.

[0046] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, unless otherwise explicitly specified, "a plurality of" or "several" means two or more.

[0047] Existing solutions for the discovery, selection, and invocation of external tools for large models / agents all have various shortcomings in practical applications: (1) Overly linking the discovery, selection, and invocation of external tools with human activities, causing agents to passively receive pre-configured external tools, severely limiting the flexibility of interfacing with external tools, and even negatively impacting the overall performance of large models / agents; (2) For agents, when discovering external tools, text search or classification based on keywords or metadata has the limitation that it can only search for pre-configured keywords or metadata of external tools to find corresponding tools, and cannot discover available tools beyond keywords or metadata; (3) Simplifying the selection and invocation of external tools into a superposition of multiple binary logics leads to a loss of reliability and credibility in the decision-making process of tool selection and invocation, and it is also unable to solve more complex decision problems, lacking flexibility and making it difficult to find the optimal solution for the task. Therefore, how to improve the flexibility and accuracy of the discovery, selection, and invocation of external tools for large models / agents remains an urgent problem to be solved by existing technologies.

[0048] Based on the above technical background, please refer to Figure 1 This application provides a method for selecting external tools for an intelligent agent, including steps S101 to S104, each step of which is as follows:

[0049] Step S101: If the access gateway successfully authenticates the identity of the first intelligent agent, then based on the task request of the first intelligent agent, a number of candidate external tools are obtained by semantic similarity search in the preset tool registry center; wherein, the task request is obtained by the first intelligent agent through semantic understanding of the user's input instructions.

[0050] In some embodiments of this application, if the access gateway fails to authenticate the identity of the first intelligent agent, the subsequent operation is canceled, and a task failure message is returned to the user through the first intelligent agent.

[0051] In some embodiments of this application, the step of obtaining several candidate external tools by semantic similarity search in a preset tool registry based on the task request of the first intelligent agent specifically includes:

[0052] Based on the preset task processing model, the task request is converted into a task request query vector.

[0053] Based on the task request query vector, a search is performed in the corresponding vector database of the tool registry. During the search, the similarity between the task request query vector and the query vectors of each tool in the tool registry is calculated, and several candidate external tools are obtained by filtering and sorting based on the similarity.

[0054] In some embodiments of this application, the tool registry is used to provide a specific data model structure to ensure that each registered tool (i.e., external tool) registered in the tool registry has the same data model structure, and the corresponding vector database is used to store the data model of each registered tool. Specifically, the data model can be expressed as a superposition of multiple basic fields, including basic metadata, technical patterns, semantic embedding vectors, and multidimensional evaluation vectors; wherein, the basic metadata includes the name, text description, endpoint URL, author, and license of the registered tool; the technical patterns include the definition of the input and output parameters and formats of the registered tool; the semantic embedding vector is a high-dimensional floating-point vector used to store the semantic information of the registered tool's functions and intentions; the multidimensional evaluation vector is a high-dimensional floating-point vector used to store the evaluation scores of the registered tool in each dimension, and each dimension is represented as a data column in the multidimensional evaluation vector, such as an example multidimensional evaluation vector category of: [performance, security, reliability, community trust, cost].

[0055] Specifically, the registration methods for registering tools in the tool registration center include the following three types: (1) Manual registration: Registering the first registration tool in response to the developer's filling in of the information form for the first registration tool; wherein, the information form is presented in the form of a WEB user interface; (2) Programmatic registration: Providing an application programming interface to the second registration tool to register the second tool during the integration and deployment process; wherein, a preferred implementation of the application programming interface is a RESTful API; (3) Automated absorption: Summarizing the tool documents of the crawled developer web pages through a large model, generating the tool description and technical pattern of the third registration tool, and constructing the initial semantic embedding vector of the third registration tool to register the third registration tool; wherein, the tool documents include OpenAPI specifications, Markdown files or introductory web pages; the large model includes Wenxin Yiyan, Tongyi Qianwen, Xunfei Xinghuo, Deepseek, Gemini, GPT-4 or Kimi.

[0056] In some embodiments of this application, when the tool registry adds a new registered tool, the basic metadata, technical patterns, and semantic embedding vectors in the data model of the newly registered tool are semantically understood and integrated and transformed through the task processing big model to obtain the tool query vector of the newly registered tool, and the tool query vector of the newly registered tool is stored in the corresponding vector database of the tool registry.

[0057] In some embodiments of this application, the corresponding vector database of the tool registry is implemented based on the nearest neighbor algorithm (ANN algorithm), and its index structure includes HNSW, IVF and PQ structures; the vector database can also be replaced by a database that implements any of the HNSW, IVF and PQ index structures.

[0058] In some embodiments of this application, the task processing big model includes, but is not limited to, Wenxin Yiyan, Tongyi Qianwen, Xunfei Xinghuo, Deepseek, Gemini, GPT-4 or Kimi, with Deepseek being the preferred embodiment.

[0059] In some embodiments of this application, when calculating the similarity between the task request query vector and the query vectors of each tool in the tool registry, the similarity can be calculated based on cosine similarity, Pearson correlation coefficient, Euclidean distance, or Spearman rank correlation coefficient, with cosine similarity being the preferred similarity algorithm. Specifically, when filtering and sorting based on similarity, all external tools can first be sorted according to similarity from high to low, and then a filtering operation can be performed, selecting the top five external tools in the ranking as candidate external tools. It is easy to understand that those skilled in the art can change the filtering threshold based on implementation experience or actual implementation conditions. In this application, the preset filtering threshold is five, that is, the top five external tools in the ranking are selected as candidate external tools during the filtering process.

[0060] This application first converts task requests into task request query vectors based on a large task processing model. This converts task requests into a data format that is easier to process later, improving processing efficiency. Then, in the vector database of the tool registry, it searches by calculating the similarity between the task request query vectors and the query vectors of each tool. Based on the similarity, it filters and sorts several candidate external tools to obtain several candidates. Based on the similarity search method, it can define a reasonable and accurate selection range, improving the accuracy of subsequent selection and solution.

[0061] Step S102: Find the historical operation data of each candidate external tool, and classify and evaluate the historical operation data of each candidate external tool through multiple preset dimensions to construct a multi-dimensional evaluation vector for each candidate external tool.

[0062] In some embodiments of this application, the step of classifying and evaluating the historical operational data of each candidate external tool through multiple preset dimensions, and constructing a multi-dimensional evaluation vector for each candidate external tool, specifically includes:

[0063] Each column of historical operational data for each candidate external tool is categorized into the dimensions of the multiple dimensions, and the initial evaluation value of each candidate external tool on each of the multiple dimensions is calculated using normalization; wherein, the multiple dimensions include performance dimension, security dimension, reliability dimension, community trust dimension, and cost dimension;

[0064] Based on the preset weights of each dimension in the multiple dimensions, the initial evaluation values ​​of each candidate external tool in each dimension are weighted to obtain a weighted evaluation value. The weighted evaluation values ​​of all dimensions of each candidate external tool are then integrated to construct a multidimensional evaluation vector for each candidate external tool.

[0065] Specifically, among the multiple dimensions, the performance dimension is represented by the latency or error rate of the candidate external tool, normalized using an inverse logarithmic scale, with a weight of 0.3; the security dimension is represented by the authentication strength or number of CVE vulnerabilities of the candidate external tool, normalized using an ordinal scale (i.e., converting the ranking or rating obtained through an ordinal table into a numerical value), with a weight of 0.4; the reliability dimension is represented by uptime or health check pass rate, normalized as a percentage, with a weight of 0.15; the community trust dimension is represented by user ratings or user adoption rate, normalized using an average value or frequency count, with a weight of 0.1; and the cost dimension is represented by the cost per call or monthly call fee, normalized using the reciprocal of normalization, with a weight of 0.05. Generally, the weights for each dimension are preset values ​​based on experience, and those skilled in the art can set the weights for each dimension according to the actual implementation.

[0066] This application first categorizes the historical operational data of each candidate external tool into multiple dimensions, then normalizes and calculates the initial evaluation value of each data column. Based on the preset weights of each dimension, it then weights and integrates the initial evaluation values ​​of each data column to construct a multi-dimensional evaluation vector for each candidate external tool. This improves the comprehensiveness of the evaluation of candidate external tools, avoids the lack of reliability, credibility, and flexibility caused by the superposition of multiple binary logics in existing external tool selection methods, and improves the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool selection, it enhances the objectivity of the evaluation of candidate external tools, thereby ensuring flexibility in the selection of candidate external tools.

[0067] Step S103: Based on a preset optimization algorithm, according to the multidimensional evaluation vector of each candidate external tool and combined with the first strategy of the first agent, find the optimal solution of the candidate external tool to obtain the tool to be invoked; wherein the first strategy is obtained based on the analysis of the task request by the first agent.

[0068] In some embodiments of this application, the step of finding the optimal solution for the candidate external tool based on a preset optimization algorithm, according to the multidimensional evaluation vector of each candidate external tool, and in conjunction with the first strategy of the first agent, to obtain the tool to be invoked, specifically includes:

[0069] Based on each candidate external tool and its corresponding multidimensional evaluation vector, and combined with the first strategy of the first agent, the problem to be solved and the corresponding solution constraints are determined.

[0070] Based on the Pareto optimization method, the problem to be solved and its corresponding constraints are solved, the Pareto optimal solution of the problem to be solved is identified, and the tool to be called is obtained.

[0071] Specifically, the first strategy of the first agent specifies or may further determine the preference vector (i.e., solution constraint) of the problem to be solved. The preference vector represents the preference of the problem to be solved for each dimension of the multidimensional evaluation vector. For example, an example preference vector can be represented as: [security_weight:0.8, performance_weight:0.1, cost_weight:0.1], which represents that the performance dimension of the multidimensional evaluation vector of the problem to be solved is assigned a weight of 0.1, the security dimension is assigned a weight of 0.8, and the cost dimension is assigned a weight of 0.1.

[0072] In some embodiments of this application, for the sake of higher accuracy, the preferred implementation of the preset optimization algorithm is the Pareto optimization method. However, in actual implementation, for ease of implementation, the preset optimization algorithm can be set as a weighted sum method for solving the problem. Specifically, the implementation of the weighted sum method is as follows: calculate the total score of each candidate external tool, and select the candidate external tool with the highest total score as the tool to be called; wherein, the total score is the dot product of the multidimensional evaluation vector of the corresponding candidate external tool and the vector of the first strategy. Solving the problem using the weighted sum method is easy to implement and can select a partial solution of the Pareto optimal solution. However, it may not be able to select all Pareto optimal solutions, and the accuracy may be lower than that of the Pareto optimization method. However, considering both implementation difficulty and solution accuracy, the weighted sum method can still be used as an optional implementation of the preset optimization algorithm in this application.

[0073] This application first determines the problem to be solved and the constraints to be solved based on each candidate external tool and its corresponding multidimensional evaluation vector, combined with the first strategy. Then, based on the Pareto optimization method, it identifies the Pareto optimal solution to the problem to be solved and determines the tool to be invoked. The Pareto optimization algorithm is used to accurately solve and select the tool to be invoked from all candidate external tools, thereby improving the accuracy of the selection of external tools for the agent and thus improving the rationality of subsequent execution of task requests by proxy through the tool to be invoked.

[0074] Step S104: Feed back the invocation decision for the tool to be invoked to the access gateway, so that the access gateway proxies the task request to the tool to be invoked for execution.

[0075] In some embodiments of this application, after feeding back the invocation decision for the tool to be invoked to the access gateway, so that the access gateway proxies the task request to the tool to be invoked for execution, the method further includes:

[0076] The system acquires the execution data of the task request collected by the access gateway and executed in the tool to be invoked, and updates the historical running data of the tool to be invoked based on the execution data.

[0077] This application obtains the execution data of the task requests collected by the access gateway and executed in the tool to be invoked, and then updates the historical running data of the tool to be invoked. This enables closed-loop data feedback, thereby continuously improving the flexibility and accuracy of the intelligent agent in discovering, selecting and invoking external tools.

[0078] To illustrate the specific implementation process of this application, an implementation use case is provided as follows: The first intelligent agent receives a user instruction to "summarize our third quarter sales PDF report and find a suitable cover photo for the report"; the first intelligent agent decomposes the instruction into tasks and constructs a natural language query for the first task request, which is "a tool that can extract text and tables from a PDF document"; the first task request is sent to an access gateway, which authenticates the first intelligent agent. After successful authentication, the first task request is converted into a task request query vector, and five candidate external tools that are semantically most relevant to the task request query vector are found in the tool registry; historical running data of the five candidate external tools are retrieved, and corresponding multidimensional evaluation vectors are constructed. Simultaneously, the first intelligent agent determines a first strategy and corresponding preference vector based on the first task request. The first strategy is "prioritize tools that can extract text and tables from a PDF document"; "Reliability and low cost"; based on the multidimensional evaluation vectors of five candidate external tools and the preference vector of the first strategy, an optimization algorithm is run to select the tool to be invoked, which is "PDF-Extractor-Pro"; the invocation decision of the tool to be invoked is fed back to the access gateway, so that the gateway forwards the tool invocation request of the first agent for the first task request to the endpoint of the server of the tool to be invoked, "PDF-Extractor-Pro", and causes the server of the tool to be invoked to proxy execute the first task request; after the first task request is completed, the access gateway obtains the execution data after the first task request is completed, which includes the invocation success status and task execution time, and updates the multidimensional evaluation vector in the historical running data of the tool to be invoked according to the execution data; the first agent constructs a natural language query for the second task request according to the task decomposition result of the instruction, and repeats the above process to proxy execute the second task request.

[0079] Compared to existing technologies, this application, after the access gateway authenticates the first intelligent agent, uses semantic similarity to find several candidate external tools corresponding to the task request. This authentication of the first intelligent agent prevents malicious behavior during task execution and ensures task security. Furthermore, semantic similarity-based tool lookup defines a reasonable and precise selection range, improving the accuracy of subsequent selection and solution. Finally, by classifying and evaluating the historical operational data of each candidate external tool across multiple preset dimensions, a multi-dimensional evaluation vector is constructed, enhancing the comprehensiveness of the evaluation and avoiding the lack of comprehensiveness often seen in existing external tool selection methods due to the superposition of multiple binary logics. Reliability, credibility, and flexibility improve the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool selection, the objectivity of candidate external tool evaluation is enhanced, thus ensuring flexibility in selection. Furthermore, based on optimization algorithms, combining the multi-dimensional evaluation vector of each candidate external tool with the first strategy, the optimal solution is found to obtain the tool to be invoked. The optimization algorithm accurately solves and selects the optimal tool among all candidate external tools, improving the accuracy of external tool selection for the agent. This, in turn, enhances the rationality of proxy execution when feeding back the invocation decision of the tool to be invoked to the access gateway to delegate task requests to the tool for execution.

[0080] For a method corresponding to the one described above, please refer to [link to relevant documentation]. Figure 2 This application provides a device for selecting external tools for an intelligent agent, including a candidate tool search module 210, a candidate tool evaluation module 220, a tool optimization selection module 230, and a tool decision invocation module 240.

[0081] The candidate tool search module 210 is used to obtain several candidate external tools by semantic similarity search in a preset tool registry center according to the task request of the first intelligent agent if the access gateway authenticates the identity of the first intelligent agent; wherein, the task request is obtained by the first intelligent agent through semantic understanding of the user's input instructions;

[0082] The candidate tool evaluation module 220 is used to find the historical operation data of each candidate external tool, and to classify and evaluate the historical operation data of each candidate external tool through multiple preset dimensions, thereby constructing a multi-dimensional evaluation vector for each candidate external tool.

[0083] The tool optimization and selection module 230 is used to find the optimal solution of the candidate external tool based on a preset optimization algorithm, according to the multi-dimensional evaluation vector of each candidate external tool, and in combination with the first strategy of the first agent, to obtain the tool to be called; wherein the first strategy is obtained based on the analysis of the task request by the first agent.

[0084] The tool decision invocation module 240 is used to feed back the invocation decision for the tool to be invoked to the access gateway, so that the access gateway will delegate the task request to the tool to be invoked for execution.

[0085] In some embodiments of this application, the candidate tool search module 210 includes a task request conversion unit and a candidate tool search unit;

[0086] The task request conversion unit is used to convert the task request into a task request query vector based on a preset task processing big model.

[0087] The candidate tool search unit is used to search in the corresponding vector database of the tool registry center according to the task request query vector. During the search, the similarity between the task request query vector and each tool query vector in the tool registry center is calculated, and a number of candidate external tools are obtained by filtering and sorting according to the similarity.

[0088] In some embodiments of this application, the candidate tool evaluation module 220 includes an initial evaluation unit and a weighted evaluation unit;

[0089] The initial evaluation unit is used to classify each data column of the historical operation data of each candidate external tool into each of the multiple dimensions, and to normalize and calculate the initial evaluation value of each candidate external tool in each of the multiple dimensions; wherein, the multiple dimensions include performance dimension, security dimension, reliability dimension, community trust dimension and cost dimension.

[0090] The weighted evaluation unit is used to weight the initial evaluation values ​​of each candidate external tool on each of the multiple dimensions based on the preset weights of each dimension to obtain a weighted evaluation value, and to integrate the weighted evaluation values ​​of all dimensions of each candidate external tool to construct a multidimensional evaluation vector for each candidate external tool.

[0091] In some embodiments of this application, the tool optimization selection module 230 includes a problem determination unit and a problem solving unit;

[0092] The problem determination unit is used to determine the problem to be solved and the corresponding solution constraints based on each candidate external tool and its corresponding multidimensional evaluation vector, combined with the first strategy of the first agent.

[0093] The problem-solving unit is used to solve the problem to be solved and the corresponding solution constraints based on the Pareto optimization method, identify the Pareto optimal solution of the problem to be solved, and obtain the tool to be called.

[0094] In some embodiments of this application, a tool feedback update module is also included;

[0095] The tool feedback update module is used to obtain the execution data of the task request collected by the access gateway and executed in the tool to be invoked, and update the historical running data of the tool to be invoked based on the execution data.

[0096] After the access gateway authenticates the first intelligent agent, this application uses semantic similarity to find several candidate external tools corresponding to the task request. Authenticating the first intelligent agent prevents malicious behavior during task execution and ensures task security. Simultaneously, semantic similarity-based tool lookup defines a reasonable and precise selection range, improving the accuracy of subsequent selection and solution. Furthermore, by classifying and evaluating the historical operational data of each candidate external tool across multiple preset dimensions, a multi-dimensional evaluation vector is constructed. This enhances the comprehensiveness of the evaluation of candidate external tools and avoids the unreliability caused by the superposition of multiple binary logics in existing external tool selection methods. The system enhances credibility and flexibility, improving the accuracy of subsequent selection of candidate external tools. Simultaneously, by reducing the weight of human decision-making in external tool evaluation, it improves the objectivity of candidate external tool assessment, thus ensuring flexibility in selection. Furthermore, based on optimization algorithms, combining the multi-dimensional evaluation vector of each candidate external tool with the first strategy, the optimal solution is found to obtain the tool to be invoked. The optimization algorithm accurately solves and selects the optimal tool among all candidate external tools, improving the accuracy of external tool selection for the agent. This, in turn, improves the rationality of proxy execution when feeding back the invocation decision of the tool to be invoked to the access gateway to delegate task requests to the tool for execution.

[0097] It should be understood that the apparatus provided in the embodiments of this application corresponds to the aforementioned method. The apparatus for selecting external tools for an intelligent agent provided in the embodiments of this application can implement the method for selecting external tools for an intelligent agent provided in any embodiment of this application.

[0098] Adaptively, embodiments of this application also provide a computer device and a computer-readable storage medium.

[0099] The computer device includes: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor;

[0100] The processor executes the computer program to implement a method for selecting external tools for an intelligent agent, as described in this application.

[0101] The computer-readable storage medium stores multiple instructions adapted for loading by a processor to execute a method for selecting external tools for an intelligent agent according to this application.

[0102] The above description represents some embodiments of this application, providing a further detailed explanation of the purpose, technical solution, and beneficial effects of this application. It should be understood that the above-described embodiments of this application should not be construed as limiting this application. In particular, any changes, modifications, equivalent substitutions, and variations made by those skilled in the art within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for selecting external tools for an intelligent agent, characterized in that, The method comprises the steps of: If the identity authentication of the first agent is passed by the access gateway, a plurality of candidate external tools are obtained by searching in a preset tool registration center according to the task request of the first agent through semantic similarity, wherein the task request is obtained by semantic understanding of the input instruction of the user by the first agent; The historical running data of each candidate external tool is searched, and the historical running data of each candidate external tool is classified and evaluated through a plurality of preset dimensions to construct a multi-dimensional evaluation vector of each candidate external tool; Based on a preset optimization algorithm, the optimal solution of the candidate external tool is searched according to the multi-dimensional evaluation vector of each candidate external tool combined with the first strategy of the first agent to obtain a tool to be called, wherein the first strategy is obtained based on the analysis of the first agent on the task request; The calling decision of the tool to be called is fed back to the access gateway, so that the access gateway proxies the task request to the tool to be called for execution.

2. The method of claim 1, wherein, The method comprises the steps of: Based on a preset task processing large model, the task request is converted into a task request query vector; According to the task request query vector, searching is performed in the corresponding vector database of the tool registration center, and when searching, the similarity between the task request query vector and each tool query vector in the tool registration center is calculated, and a plurality of candidate external tools are obtained by screening and sorting according to the similarity.

3. The method of claim 1, wherein the selecting of the external tool is based on the at least one of the one or more criteria. The method comprises the steps of: Each data column of the historical running data of each candidate external tool is classified into each dimension of the plurality of dimensions, and the initial evaluation value of each candidate external tool in each dimension of the plurality of dimensions is normalized and calculated; wherein the plurality of dimensions include performance dimension, security dimension, reliability dimension, community trust dimension and cost dimension; Based on the preset weight of each dimension in the plurality of dimensions, the initial evaluation value of each candidate external tool in each dimension of the plurality of dimensions is weighted to obtain a weighted evaluation value, and the weighted evaluation value of each dimension of each candidate external tool is integrated to construct a multi-dimensional evaluation vector of each candidate external tool.

4. The method of claim 1, wherein, The method comprises the steps of: According to each candidate external tool and the corresponding multi-dimensional evaluation vector, the first strategy of the first agent is combined to determine a problem to be solved and corresponding solving constraints; Based on the Pareto optimization method, the problem to be solved and the corresponding solving constraints are solved, the Pareto optimal solution of the problem to be solved is identified, and the tool to be called is obtained.

5. The method of claim 1 to 4, wherein, The calling decision on the tool to be called is fed back to the access gateway, so that the access gateway proxies the task request to the tool to be called for execution. Execution data of the task request collected by the access gateway in the tool to be called is acquired, and historical running data of the tool to be called is updated according to the execution data.

6. An intelligent agent external tool selection system, comprising: The system comprises a candidate tool searching module, a candidate tool evaluating module, a tool optimization selecting module and a tool decision calling module. The candidate tool searching module is configured to, if the identity authentication of the first agent by the access gateway is passed, search for a plurality of candidate external tools in a preset tool registration center according to the task request of the first agent by semantic similarity. The candidate tool evaluating module is configured to search for historical running data of each candidate external tool, and perform classification evaluation on the historical running data of each candidate external tool by a plurality of preset dimensions to construct a multi-dimensional evaluation vector of each candidate external tool. The tool optimization selecting module is configured to, based on a preset optimization algorithm, search for an optimal solution of the candidate external tools according to the multi-dimensional evaluation vector of each candidate external tool in combination with a first strategy of the first agent to obtain a tool to be called, wherein the first strategy is obtained based on analysis of the first agent on the task request. The tool decision calling module is configured to feed back a calling decision on the tool to be called to the access gateway, so that the access gateway proxies the task request to the tool to be called for execution.

7. The system of claim 6, wherein, The candidate tool searching module comprises a task request converting unit and a candidate tool searching unit. The task request converting unit is configured to convert the task request into a task request query vector based on a preset task processing large model. The candidate tool searching unit is configured to search in a corresponding vector database of the tool registration center according to the task request query vector, calculate similarity of the task request query vector and each tool query vector in the tool registration center when searching, and filter and sort a plurality of candidate external tools according to the similarity.

8. The system of claim 6, wherein, The candidate tool evaluating module comprises an initial evaluation unit and a weighted evaluation unit. The initial evaluation unit is configured to classify each data column of the historical running data of each candidate external tool into each dimension of the plurality of dimensions, and normalize to calculate an initial evaluation value of each candidate external tool on each dimension of the plurality of dimensions; wherein the plurality of dimensions comprise a performance dimension, a security dimension, a reliability dimension, a community trust dimension and a cost dimension. The weighted evaluation unit is configured to weight the initial evaluation value of each candidate external tool on each dimension of the plurality of dimensions based on a preset weight of each dimension in the plurality of dimensions to obtain a weighted evaluation value, and integrate the weighted evaluation value of all dimensions of each candidate external tool to construct a multi-dimensional evaluation vector of each candidate external tool.

9. The system for selecting an external tool for an intelligent body according to claim 6, wherein, The tool optimization selection module comprises a problem determining unit and a problem solving unit; The problem determining unit is configured to determine a problem to be solved and corresponding solving constraints according to each candidate external tool and the corresponding multi-dimensional evaluation vector in combination with the first strategy of the first intelligent agent; The problem solving unit is configured to solve the problem to be solved and the corresponding solving constraints based on a Pareto optimization method, identify a Pareto optimal solution of the problem to be solved, and obtain a tool to be called.

10. The system for selecting an external tool for an intelligent body according to any one of claims 6 to 9, wherein, The tool feedback updating module is further included; The tool feedback updating module is configured to acquire execution data of the task request executed in the tool to be called collected by the access gateway, and update historical running data of the tool to be called according to the execution data.