An agent routing method and related apparatus
Patent Information
- Application Number
- CN202611146924.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-09-15
AI Technical Summary
[0033]By employing the aforementioned technical solution, the agent routing method provided in this application constructs a three-dimensional quantitative indicator system comprising at least a first indicator (resource consumption), a second indicator (effectiveness), and a third indicator (default risk), thus unifying the agent's resource cost, execution quality, and risk into a computable quantitative framework. This allows routing selection to be based not on a single factor, but on the comprehensive value of the agent, significantly improving the accuracy and rationality of routing decisions. By setting at least two candidate routing strategies, each strategy comprising a scoring function constructed based on at least some indicators from the quantitative indicator set, and each scoring function representing a different routing optimization objective, the system can flexibly select or switch routing strategies according to the real-time needs of the business scenario. The decision-making process is completely transparent and interpretable, significantly improving the system's flexibility and scenario adaptability. This provides a scientific and comprehensive basis for routing decisions, thereby improving the efficiency and rationality of agent selection.
Smart Images

Figure CN122764902A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an intelligent agent routing method and related apparatus. Background Technology
[0002] With the rapid development of Large Language Model (LLM) technology, AI agents built on LLM, as software entities capable of autonomously perceiving their environment, planning tasks, invoking tools, and achieving complex goals, are gradually moving from academic research to engineering applications. In industrial practice, multiple agents typically provide capabilities as a service. As the number of agents continues to increase, how to achieve more efficient agent selection has become an urgent problem to solve. Summary of the Invention
[0003] In view of the above problems, this application provides an agent routing selection method and related apparatus to improve selection efficiency and the rationality of agent services. The specific solution is as follows:
[0004] The first aspect of this application provides an agent routing method, including:
[0005] A set of quantitative indicators for multiple candidate intelligent agents is obtained. The set of quantitative indicators includes at least a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate intelligent agent to perform the task. The second indicator is used to characterize the effectiveness of the candidate intelligent agent in performing the task. The third indicator is used to characterize the default risk of the candidate intelligent agent in performing the task.
[0006] A specified routing strategy is determined for the current task. The specified routing strategy is selected from at least two candidate routing strategies. Each candidate routing strategy includes a scoring function constructed based on at least some of the indicators in the set of quantitative indicators, and each scoring function represents a different routing optimization objective.
[0007] Based on the scoring function corresponding to the specified routing policy, the routing score of each candidate agent is determined, and the target agent is determined from the plurality of candidate agents based on the routing score.
[0008] In one possible implementation, the set of quantification metrics further includes a fourth metric, which characterizes the exploratory value corresponding to the uncertainty of the outcome of the candidate agent's task execution.
[0009] In one possible implementation, the method further includes:
[0010] Obtain the actual execution feedback data after the target intelligent agent executes the current task;
[0011] The target agent's index value in the set of quantitative indicators is updated based on the actual execution feedback data.
[0012] In one possible implementation, updating the indicator values in the set of quantitative indicators based on the actual execution feedback data includes:
[0013] Calculate the instantaneous value of the target agent's current performance index based on the actual execution feedback data;
[0014] Read the historical values of the target agent's metrics from the value repository;
[0015] The instantaneous value of the indicator is merged with the historical value of the indicator using the exponentially weighted moving average method to obtain the updated indicator value, and the updated indicator value is written into the value database.
[0016] In one possible implementation, the at least two candidate routing strategies include: a first strategy and a second strategy, wherein the scoring function of the first strategy is positively correlated with the second metric and the first metric, and negatively correlated with the invocation cost of the candidate agent;
[0017] The scoring function of the second strategy is positively correlated with the second indicator, negatively correlated with the call cost, and negatively correlated with the third indicator.
[0018] In one possible implementation, the at least two candidate routing strategies further include a third strategy and a fourth strategy, wherein the scoring function of the third strategy is positively correlated with the second metric, negatively correlated with the call cost, and positively correlated with the fourth metric;
[0019] The scoring function of the fourth strategy includes a basic scoring item and an exploration incentive item. The basic scoring item is positively correlated with the second indicator and negatively correlated with the calling cost of the candidate agent. The exploration incentive item is positively correlated with the fourth indicator.
[0020] In one possible implementation, before determining the specified routing policy for the current task, the method further includes:
[0021] Obtain the preset validity threshold value;
[0022] Compare the second metric of each candidate agent with the validity threshold value;
[0023] Candidate agents whose second metric is lower than the validity threshold are removed from the plurality of candidate agents to update the candidate agents.
[0024] A second aspect of this application provides an intelligent agent routing device, comprising:
[0025] The indicator acquisition module is used to acquire a set of quantitative indicators for multiple candidate agents. The set of quantitative indicators includes at least a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate agent to perform the task, the second indicator is used to characterize the effectiveness of the candidate agent in performing the task, and the third indicator is used to characterize the default risk of the candidate agent in performing the task.
[0026] A strategy determination module is used to determine a specified routing strategy for the current task. The specified routing strategy is selected from at least two candidate routing strategies, each candidate routing strategy comprising: a scoring function constructed based on at least a portion of the metrics in the set of quantifiable metrics, and each scoring function characterizing a different routing optimization objective; and...
[0027] The routing decision module is used to determine the routing score of each candidate agent according to the scoring function corresponding to the specified routing policy, and to determine the target agent from the multiple candidate agents according to the routing score.
[0028] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the intelligent agent routing selection method of the first aspect or any implementation thereof.
[0029] A fourth aspect of this application provides an electronic device, including at least one processor and a memory connected to the processor, wherein:
[0030] The memory is used to store computer programs;
[0031] The processor is used to execute the computer program so that the electronic device can implement the agent routing method of the first aspect or any implementation thereof.
[0032] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the intelligent agent routing selection method described in the first aspect or any implementation thereof.
[0033] By employing the aforementioned technical solution, the agent routing method provided in this application constructs a three-dimensional quantitative indicator system comprising at least a first indicator (resource consumption), a second indicator (effectiveness), and a third indicator (default risk), thus unifying the agent's resource cost, execution quality, and risk into a computable quantitative framework. This allows routing selection to be based not on a single factor, but on the comprehensive value of the agent, significantly improving the accuracy and rationality of routing decisions. By setting at least two candidate routing strategies, each strategy comprising a scoring function constructed based on at least some indicators from the quantitative indicator set, and each scoring function representing a different routing optimization objective, the system can flexibly select or switch routing strategies according to the real-time needs of the business scenario. The decision-making process is completely transparent and interpretable, significantly improving the system's flexibility and scenario adaptability. This provides a scientific and comprehensive basis for routing decisions, thereby improving the efficiency and rationality of agent selection. Attached Figure Description
[0034] 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.
[0035] Figure 1 A flowchart of an agent routing method provided in this application;
[0036] Figure 2 This application provides a schematic diagram of the overall architecture of an intelligent agent routing system.
[0037] Figure 3 This is a schematic diagram of the closed-loop feedback update process provided in this application;
[0038] Figure 4 A structural diagram of an intelligent agent routing selection device provided in this application;
[0039] Figure 5 This is a structural diagram of an electronic device provided in this application. Detailed Implementation
[0040] 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.
[0041] As will be known to those skilled in the art, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0042] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of 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 are interchangeable 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 elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0043] Currently, the following problems are commonly found in solutions for selecting intelligent agents:
[0044] First, the evaluation of intelligent agents is based on a single dimension and lacks a four-dimensional quantitative correlation model encompassing cost, quality, risk, and potential. Some existing technologies indirectly reflect agent suitability through task priority scores, select agents based on the synergy between the agent and the MCP, and indirectly reflect resource quality through auction prices. None of these technologies use the agent's resource consumption cost, effective action value, SLA risk exposure, and exploration potential as directly calculable independent quantitative indicators, nor do they establish functional dependencies between these indicators (e.g., risk exposure depends on resource consumption, and exploration value depends on operational stability).
[0045] Second, routing decisions rely on a black-box training paradigm, lacking interpretable and lightweight explicit strategies. Some require building simulated environments to train reinforcement learning models and graph neural networks, while others require training multi-agent reinforcement learning pricing models. Both suffer from engineering flaws such as high model training costs, long convergence periods, and uninterpretable decision-making processes, and cannot flexibly switch routing strategies according to business scenarios (e.g., switching from pursuing cost-effectiveness to avoiding high risks).
[0046] Third, there is a lack of mechanisms for quantifying and proactively mitigating the risk of agent default. Existing solutions do not involve the quantitative calculation of SLA compensation risks resulting from agent execution failures. While some address node failures, these pertain to infrastructure-level availability assurance, rather than the semantic-level output quality risk of the agent. Current technologies cannot predict and avoid high-risk agents during the routing phase, and cannot incorporate risk costs into the selection decision.
[0047] Fourth, the quality assessment and billing system for intelligent agents are decoupled. In existing solutions, the scheduling / selection logic and billing logic operate independently: billing is settled based on token quantity or resource consumption, while selection is determined by success rate or auction results. This decoupling allows low-quality, high-consumption agents to still obtain unreasonable profits, and prevents price signals from guiding high-quality agents to obtain more scheduling opportunities.
[0048] The above-mentioned reasons have resulted in a low rationality in the selection of intelligent agents, with unsatisfactory selection effects and efficiency, which can no longer meet the needs.
[0049] To address the aforementioned problems, embodiments of this application provide an intelligent agent routing selection method. The intelligent agent routing selection method of this application embodiment will be described in detail below with reference to the accompanying drawings.
[0050] Reference Figure 2 The diagram shown is a schematic representation of the overall architecture of the intelligent agent routing system of this application. Figure 2 As shown, the external business platform communicates with the four core modules of this application's system through an API gateway: the registration module (for agent registration and initial metric calculation), the feedback update module (for dynamic metric updates based on execution feedback), the routing module (for single-task routing), and the task routing module (for batch task routing planning). Each module is connected to a multi-dimensional metric calculation engine, which calculates or updates four core metrics (TRT, Ea, Risk, and EVPI). Each module uses an agent dynamic value library to persistently store and retrieve metrics.
[0051] Reference Figure 1 , Figure 1 This is a flowchart illustrating an intelligent agent routing method provided in an embodiment of this application, such as... Figure 1 As shown, the intelligent agent routing selection method provided in this application embodiment may include steps S101 to S103, which will be described in detail below.
[0052] Step S101: Obtain a set of quantitative indicators for multiple candidate agents. The set of quantitative indicators includes at least a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate agent to perform the task, the second indicator is used to characterize the effectiveness of the candidate agent in performing the task, and the third indicator is used to characterize the default risk of the candidate agent in performing the task.
[0053] In this embodiment, when a new agent is launched, or when an existing agent needs to be re-evaluated, the business platform sends a request (POST / api / v1 / agent / register) to the registration module via the API gateway. The request body includes the agent identifier (agent_id), the list of supported LLM models (supported_LLM), the price per call (price_per_call), and a set of test data (test_data) reflecting the agent's performance. The registration module then passes these parameters to the multi-dimensional metric calculation engine to calculate various metrics.
[0054] The first metric characterizes the resource consumption required for a candidate agent to perform a task. This resource consumption refers to a comprehensive measure of the costs incurred by the agent during a single task execution, including computational resources and API call resources. In one specific implementation, the first metric can be the Total Resource Token (TRT), which converts the token consumption, LLM call counts, and tool call counts generated by the agent during a single task execution into a dimensionless resource cost value. The formula for calculating TRT is:
[0055] ;
[0056] Where K is the normalization constant. Here, T represents the relative resource consumption coefficient of the model, and T is the average number of tokens consumed per task. Here, C represents the fixed resource consumption per LLM call, and C is the average number of LLM calls consumed per task. This is a fixed resource consumption value for each tool call. The average number of tool calls consumed per task.
[0057] The second metric characterizes the effectiveness of the candidate agent in performing the task. This effectiveness refers to the quality level of the agent's output, including but not limited to a comprehensive measure of quality sub-metrics such as execution success rate, output format compliance rate, tool invocation success rate, and semantic accuracy. In one specific implementation, the second metric can be the net utility of effective actions (Net Effective Action). ),Should The value is calculated based on multiple quality sub-indices through a product and an exponential decay function, and is used to quantify the effectiveness of the agent's output results. The calculation formula is:
[0058] ;
[0059] Where α is the attenuation intensity coefficient. These are the various quality sub-indicators.
[0060] The third metric characterizes the default risk of a candidate agent performing a task. This default risk refers to the risk of breach of the Service Level Agreement (SLA) due to agent failure or substandard quality. In one specific implementation, the third metric can be risk exposure, which is used to estimate the expected loss due to agent failure or substandard quality, quantifying business risk into a calculable technical parameter. The formula for calculating Risk is:
[0061] ;
[0062] Where θ is the compensation ratio and TRT is the total resource value. The currency unit price corresponding to each TRT. This is a success-related metric.
[0063] In one implementation of this embodiment, the indicator acquisition module reads the quantitative indicator values of each candidate intelligent agent from the intelligent agent dynamic value library. The intelligent agent dynamic value library is used to persistently store the historical and updated values of the four-dimensional indicators of each intelligent agent. The quantitative indicator values of each intelligent agent can be calculated through test data when a new intelligent agent is registered online, or they can be dynamically updated through feedback data during actual execution.
[0064] The metrics acquisition module receives the quantified metric values of each candidate agent directly provided by the external business platform in the routing request. That is, when the external business platform initiates a routing request, it carries the metric data of each candidate agent in the request body, from which the metrics acquisition module extracts and parses.
[0065] In this embodiment, multiple candidate agents refer to all available agents capable of performing the current task. The list of candidate agents can be specified by an external business platform in a routing request, or it can be obtained by an agent routing selection device by filtering from the set of registered agents based on task type and capability matching.
[0066] Step S102: Determine the specified routing strategy for the current task. The specified routing strategy is selected from at least two candidate routing strategies. Each candidate routing strategy includes a scoring function constructed based on at least some of the indicators in the set of quantified indicators, and each scoring function represents a different routing optimization objective.
[0067] In this embodiment, the routing strategy is specified by the user or preset by the system. In one implementation, when an external business platform initiates a routing request, it specifies the required routing strategy through the strategy field in the request body. For example, the request body includes an intents array (each element containing an intent_id and a candidate_agents list), a minimum valid action threshold ea_min, and the specified strategy field. In another implementation, the intelligent agent routing selection device automatically selects a default routing strategy based on the type of the current task or the business scenario.
[0068] At least two candidate routing strategies each contain different scoring functions. Each scoring function employs different mathematical combinations or weighting methods of at least some indicators from the set of quantitative indicators to characterize different routing optimization objectives. For example, the optimization objective of the first strategy may be to maximize effective output per unit cost (pursuing cost-effectiveness), the optimization objective of the second strategy may be to minimize default risk while pursuing cost-effectiveness (risk aversion), and the optimization objective of the third strategy may be to encourage agents to explore higher uncertainties while pursuing cost-effectiveness (exploration-driven).
[0069] Step S103: Determine the routing score of each candidate agent according to the scoring function corresponding to the specified routing policy, and determine the target agent from multiple candidate agents based on the routing score.
[0070] In this embodiment, for each candidate agent, the routing decision module substitutes the agent's quantified index value into the scoring function corresponding to the specified routing strategy to calculate the agent's routing score. The scoring function can be constructed using additive, multiplicative, or mixed operational logic, as long as it can achieve different routing optimization objectives based on different mathematical combinations of quantified indices.
[0071] In one implementation of this embodiment, the routing decision module calculates a score for each agent in the candidate set and selects the agent with the highest score as the target agent for the current task. After all intents have been processed, the mapping result (intent_id → agent_id, score) is returned to the business platform through the API gateway.
[0072] In another implementation of this embodiment, after the routing decision module calculates the scores of each agent, it selects one or more agents whose scores exceed a preset threshold as target agents.
[0073] In this embodiment, after the target agent is identified, the routing decision module returns the identifier (such as agent_id) and the corresponding score value of the target agent to the external business platform, so that the business platform can call the target agent to execute the current task.
[0074] This embodiment introduces quantitative indicators encompassing three dimensions—resource consumption, effectiveness, and default risk—into the routing decision-making process. Based on this indicator system, it provides multiple pluggable scoring strategies. Compared to the single evaluation dimension and fixed routing logic of existing technologies, this achieves a more comprehensive, flexible, and interpretable agent routing selection. Compared to existing scheduling models that rely on black-box training, the method in this embodiment requires no model training, the decision-making process is completely transparent, and routing strategies can be switched in real-time according to business needs. This significantly improves the system's adaptability and maintainability, thereby enhancing the rationality of agent selection and the effectiveness of agent usage, ultimately improving the user experience.
[0075] In another embodiment of this application, the set of quantification metrics further includes a fourth metric. The fourth metric characterizes the exploration value corresponding to the uncertainty of the outcome of a candidate agent performing a task. In one specific implementation, the fourth metric may be the Expected Value of Perfect Information (EVPI), which is calculated using a linear discount based on the consistency of the agent's results across multiple runs. This EVPI quantifies the uncertainty cost caused by the agent's unstable performance and can serve as an incentive term for an exploration-driven routing strategy.
[0076] Specifically, EVPI is calculated as follows:
[0077] ;
[0078] Where TRT is the total resource cost, s is the consistency index of multiple runs (e.g., the first_run_stability field in the test data is used as the s value in (1-s), and γ is the scaling factor. The physical meaning of this index is that the higher the uncertainty of the agent's running results (i.e., the lower the s value), the larger the EVPI value, indicating that the agent has higher exploration value. The EVPI item can be used as a bonus item for subsequent exploration-driven routing strategies.
[0079] Based on the above embodiments, the process of obtaining a set of quantitative indicators may include the following steps:
[0080] First, initial test data for candidate agents is obtained. When a new agent is launched, or when an existing agent needs to be re-evaluated, the business platform sends a request (POST / api / v1 / agent / register) to the registration module via the API gateway. The request body includes the agent identifier (agent_id), a list of supported LLM models (supported_LLM), a price per call (price_per_call), and a set of test data (test_data) reflecting the agent's performance. The initial test data includes at least the price per call, token consumption, number of calls to large language models, number of tool calls, and several quality sub-indicators.
[0081] Then, the first, second, third, and fourth indicators are calculated based on the initial test data. The registration module passes these parameters to the multi-dimensional indicator calculation engine, which then calculates the four initial indicators—TRT, Ea, Risk, and EVPI—in sequence according to the four formulas.
[0082] Specifically, the formula for calculating the first indicator (Total Resource Value, TRT) is as follows:
[0083] ;
[0084] Where K is a normalization constant (hyperparameter) used to map the number of tokens to a base TRT unit. For example, K=0.001 means that every 1000 tokens is converted into 1 base TRT.
[0085] The relative resource consumption coefficient of the model is preset according to the actual computing power cost of different LLMs. For example, it is set to 1.0 for GLM5.1, 1.2 for Qwen 3.6 plus, and 4.0 for Claude-3-Opus.
[0086] T represents the average number of tokens consumed per task;
[0087] This is a fixed resource consumption value for each LLM call, for example, 0.02 TRT / call;
[0088] C represents the average number of LLM calls consumed per task;
[0089] This is a fixed resource consumption value per tool call, for example, 0.05 TRT / call;
[0090] The average number of tool calls consumed per task.
[0091] For the second indicator (net utility of effective actions) The calculation formula is as follows:
[0092] ;
[0093] Where α is the attenuation intensity coefficient (hyperparameter), which controls the sensitivity of this index to quality defects, for example α=3;
[0094] These are quality indicators, involving core quality sub-indicators, including:
[0095] =execution_success(execution success rate);
[0096] =output_format_compliance(output format compliance rate);
[0097] =tool_call_success_rate (tool call success rate);
[0098] = factual_accuracy (semantic accuracy). The physical meaning of this formula is: when all quality sub-indices are close to 1.0, ,but This indicates the highest utility; a decrease in any sub-indicator will lead to a significant reduction in the product, which in turn amplifies the decay through an exponential function, making... Rapidly decrease.
[0099] The third indicator (SLA risk exposure risk) is calculated as follows:
[0100] ;
[0101] Where θ is the compensation ratio, for example θ=1.0, which means that the monetary value corresponding to the single resource cost will be fully compensated when the failure is caused by the responsibility of the intelligent agent;
[0102] TRT stands for Total Resource Value;
[0103] This is the currency unit price corresponding to each TRT unit, with an initial default value of, for example, 0.01;
[0104] This is a set of "success-related indicators" used in risk calculation, including... =Execution success rate =Initial run stability;
[0105] pass The calculated expected failure probability.
[0106] The formula for calculating the fourth indicator (Expected Value of Perfect Information EVPI) is as follows:
[0107] ;
[0108] Where TRT is the total resource value;
[0109] s is a consistency metric for the results of multiple runs, for example, using the first_run_stability field in the test data as the s value in (1-s);
[0110] γ is a scaling factor (hyperparameter) used to convert uncertainty into a value unit with the same dimensions as TRT, for example, γ=9.0.
[0111] After calculation, the four initial indicator values are written into the agent's dynamic value library, forming the agent's initial profile. By introducing the fourth indicator (EVPI), a complete four-dimensional quantitative system of cost, quality, risk, and potential is constructed. The registration module ensures that new agents possess a quantitative profile that can be used for routing decisions from the outset. Compared to existing solutions that lack a unified quantitative indicator system, the four dimensions of this embodiment have clear functional dependencies (e.g., risk exposure depends on resource consumption, and exploration value depends on operational stability), forming a systematic causal model rather than an isolated accumulation of indicators.
[0112] In other embodiments, the above-mentioned at least two candidate routing strategies include four independently selectable routing strategies: the optimal cost-effectiveness strategy (first strategy), the risk avoidance strategy (second strategy), the task value optimal strategy (third strategy), and the exploration-driven strategy (fourth strategy). The numbers of the first, second, third, and fourth strategies in this embodiment are for distinction only and do not represent the order or priority of the strategies.
[0113] Before determining the specified routing policy for the current task, the Ea threshold filtering step is performed first:
[0114] A preset validity threshold value (ea_min) is obtained, which is the lowest valid action threshold preset by the system or configured by the user. After the routing module reads the four-dimensional index values of each candidate agent from the agent dynamic value library, it first compares the second index (Ea value) of each candidate agent with the validity threshold value. Candidate agents whose second index is lower than the validity threshold value are removed from the candidate agents to update the candidate agents. Specifically, if the Ea value of a candidate agent is less than ea_min, the agent is removed from the candidate set, and subsequent scoring calculations are only performed on the remaining candidate agents. This threshold filtering step can effectively reduce invalid computational overhead and improve the computational efficiency of routing decisions.
[0115] After the Ea threshold filtering is completed, the corresponding scoring formula is selected based on the value of the strategy field in the route request.
[0116] First strategy: Optimal cost-performance strategy.
[0117] This is the default strategy, designed to select the agent that provides the maximum effective action value per unit of monetary cost. The scoring function of the first strategy is positively correlated with the second metric (effectiveness) and the first metric (resource consumption), and negatively correlated with the invocation cost of the candidate agents.
[0118] In one specific implementation, the scoring formula for the first strategy is:
[0119] ;
[0120] Among them, Ea is the second indicator (net utility of effective actions), and TRT is the first indicator (total resource value). Here, is the unit price in currency corresponding to each TRT, and Price is the price quoted per call by the candidate agent (taken from the registration information, price_per_call). The physical meaning of this scoring function is to select the agent that can provide the maximum effective action value per unit of currency cost.
[0121] Second strategy: Risk aversion strategy (risk_averse):
[0122] The scoring function of the second strategy is positively correlated with the second indicator, negatively correlated with the call cost, and negatively correlated with the third indicator (default risk). Based on the optimal cost-effectiveness score, this strategy deducts the risk exposure term through a risk aversion coefficient to avoid agents with a high probability of SLA payout.
[0123] In one specific implementation, the scoring formula for the second strategy is:
[0124] ;
[0125] Here, λ is the risk aversion coefficient, for example, λ=0.5, and a higher value indicates a stronger penalty for risk. Based on the optimal cost-effectiveness score, this scoring function subtracts the risk exposure term (Risk) through the risk aversion coefficient λ to avoid agents with a high probability of SLA payouts.
[0126] Third strategy: Exploration-driven strategy:
[0127] The scoring function of the third strategy is positively correlated with the second indicator, negatively correlated with the invocation cost, and positively correlated with the fourth indicator (exploration value). This strategy adds an EVPI term weighted by the exploration coefficient to the optimal cost-effectiveness score, in order to encourage the routing system to prioritize agents with higher evaluation uncertainty (i.e., higher EVPI), thus achieving a balance between utilization and exploration.
[0128] In one specific implementation, the scoring function of the third strategy includes a basic scoring item and an exploration incentive item. The basic scoring item is positively correlated with the second metric and negatively correlated with the invocation cost of the candidate agent. The exploration incentive item is positively correlated with the fourth metric. The routing score is the sum of the basic scoring item and the exploration incentive item. The specific formula is:
[0129] ;
[0130] Where β is the exploration coefficient, for example β=0.1, the higher the value, the more inclined it is to explore unknown intelligent agents.
[0131] Fourth strategy: Task value optimal strategy (vpt_optimal):
[0132] This strategy evaluates the value of a task based on the amount of task output per unit of TRT (Task Time Retirement) consumed. When this strategy is enabled, the `value_per_task` parameter must be additionally provided in the request body. The scoring formula is:
[0133] ;
[0134] The higher the score, the less resources are consumed to complete a task of equal value, indicating a better agent.
[0135] Select the best and return: Calculate a score for each Agent in the candidate set, and select the one with the highest score as the optimal agent for that intent. After all intents have been processed, return the mapping result (intent_id → agent_id, score) to the business platform via the API gateway.
[0136] By providing four complete pluggable scoring strategies, flexible switching of routing strategies is achieved. Among them, the risk avoidance strategy and the exploration-driven strategy represent two different routes: utilizing known optimality and exploring unknown potential, respectively. The system can flexibly select or switch according to the business scenario. Compared with existing solutions with a single strategy, this embodiment provides a more comprehensive decision-making dimension. Furthermore, by adding an Ea threshold filtering step, the system's computational efficiency is improved while ensuring routing quality, demonstrating significant engineering practical value.
[0137] In some embodiments, after identifying the target agent, this application further includes the following feedback update step, which can be referred to... Figure 3 As shown:
[0138] Step S201: Obtain the actual execution feedback data after the target agent executes the current task.
[0139] After an agent completes an actual task, the business platform submits feedback data containing the execution result to the feedback update module (POST / api / v1 / agent / feedback) through the API gateway. The feedback data contains at least information that reflects the performance of that execution.
[0140] Specifically, the feedback data `execution_data` includes: a task success flag (success), an output format correctness flag (output_format_ok), a tool call success rate (tool_call_success_rate), a tool call count (tool_call_count), a token consumption count (tokens_used), an LLM call count (llm_calls), and operational stability (stability). The task success flag indicates whether the task was executed successfully; the output format correctness flag indicates whether the agent's output meets the expected format requirements; the tool call success rate indicates the proportion of successful calls to external tools during task execution; the tool call count and token consumption count reflect the resource consumption of this execution; the LLM call count reflects the frequency of calling the large language model during task execution; and operational stability reflects the consistency of the agent's results across multiple runs.
[0141] Step S202: Update the target agent's index value in the quantitative index set based on the actual execution feedback data.
[0142] The feedback update module passes the above data to the multidimensional indicator calculation engine. The multidimensional indicator calculation engine completes the indicator update according to the following process:
[0143] Sub-step S2021: Read historical values.
[0144] Read the historical values of the four-dimensional indicators (TRT_old, Ea_old, Risk_old, EVPI_old) currently stored in the agent's dynamic value library.
[0145] Sub-step S2022: Calculate the instantaneous value.
[0146] Based on the calculation formulas of the above four indicators, and taking the current execution_data as input, a set of instantaneous indicator values (TRT_new, Ea_new, Risk_new, EVPI_new) are calculated.
[0147] Sub-step S2023: Exponentially weighted moving average fusion.
[0148] The Exponentially Weighted Moving Average (EWMA) method is used to merge instantaneous values with historical values using a preset smoothing coefficient. For example:
[0149] ;
[0150] Here, η is a smoothing coefficient, ranging from (0, 1), used to control the weight of historical values and instantaneous values in the update result. A larger η value indicates a greater influence of the current instantaneous value on the update result, resulting in a more sensitive system response; a smaller η value indicates a greater influence of historical values on the update result, resulting in a smoother system response. In this embodiment, the value of η is preset according to the system's requirements for stability and sensitivity. Similarly, the second, third, and fourth indicators can be updated.
[0151] Sub-step S2024: Write back to the value repository.
[0152] Write the merged values of the four metrics (TRT_updated, Ea_updated, Risk_updated, EVPI_updated) back to the agent's dynamic value library, overwriting the old values.
[0153] Thus, the four-dimensional indicators stored in the agent's dynamic value library converge dynamically with each actual execution result, forming a closed-loop adaptive evaluation mechanism.
[0154] In a complete application scenario of this embodiment, the system's workflow (complete data loop) can be represented by Table 1 below:
[0155] Table 1
[0156]
[0157] Step 1 (①): When a new intelligent agent goes online, it submits test data through the registration module. The multi-dimensional indicator calculation engine calculates the initial four-dimensional indicator values and writes them into the value library (registration writes the initial profile).
[0158] In the second step (②), when the business platform initiates a routing request, the routing selection module reads the latest indicator values of each candidate agent from the value library, calculates the score according to the specified routing strategy, and selects the optimal agent (routing is based on profile selection).
[0159] The third step (③) is for the selected target agent to execute the current task and generate the execution result (execution output result).
[0160] Step 4 (④): The execution result is submitted to the feedback update module in the form of feedback data. The multidimensional indicator calculation engine calculates the instantaneous indicator value based on the feedback data and performs EWMA fusion with the historical value. The updated indicator value is then written back to the value library (feedback update profile).
[0161] Step 5 (⑤): The updated profile is used for subsequent routing decisions, enabling the system to continuously perceive and adaptively optimize the real operating state of the agent (the updated profile is used for the next routing).
[0162] Compared to existing technologies that rely on static evaluation or retraining, this embodiment achieves continuous tracking and adaptive adjustment of agent performance drift, ensuring the long-term accuracy and robustness of routing decisions. Simultaneously, the use of the EWMA method for smooth updates effectively avoids drastic oscillations in metrics caused by single abnormal execution results, thus improving system stability.
[0163] In other embodiments, this application also provides an implementation method for batch task routing planning to support agent routing requirements in large-scale concurrent scenarios.
[0164] In this embodiment, after the target agent is determined, the method further includes a batch task routing step.
[0165] The business platform sends a request (POST / api / v1 / routing / task) to the task routing module, passing in a set of tasks (an array of tasks). Each task object contains task_id (task identifier), task_agents (list of candidate agents), and value_per_task (task value).
[0166] The task routing module reads the four-dimensional indicator values (including TRT, Ea, Risk, and EVPI) of each candidate agent from the agent dynamic value library, independently calls the aforementioned routing scoring logic for each task element (using the default strategy or the preset strategy), calculates the corresponding optimal agent ID and detailed intermediate indicators, and aggregates all results before returning them to the business platform through the API gateway.
[0167] Specifically, the task routing module performs the following steps for each task element: obtain the set of quantitative indicators corresponding to the candidate agent list of the task element; determine the specified routing strategy for the task (either the system's default strategy or a strategy identifier carried in the task element); determine the routing score of each candidate agent according to the scoring function corresponding to the specified routing strategy; and select the candidate agent with the highest score as the target agent for the task element.
[0168] After all task elements have been processed, the task routing module generates a mapping relationship between each task element and its respective target agent (task_id → agent_id, score), and returns it to the business platform through the API gateway.
[0169] This embodiment supports batch task routing planning by setting up a task routing module, which effectively supports the routing needs of intelligent agents in large-scale concurrent scenarios and improves the system's throughput and processing efficiency.
[0170] The above describes an agent routing method provided by the embodiments of this application. The following describes the apparatus for executing the above agent routing method.
[0171] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an intelligent agent routing device provided in an embodiment of this application. Figure 4 As shown, the intelligent agent routing device includes:
[0172] The indicator acquisition module 401 is used to acquire a set of quantitative indicators for multiple candidate intelligent agents. The set of quantitative indicators includes at least: a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate intelligent agent to perform the task, the second indicator is used to characterize the effectiveness of the candidate intelligent agent in performing the task, and the third indicator is used to characterize the default risk of the candidate intelligent agent in performing the task.
[0173] The strategy determination module 402 is used to determine a specified routing strategy for the current task. The specified routing strategy is selected from at least two candidate routing strategies, and each candidate routing strategy includes: a scoring function constructed based on at least some indicators in a set of quantifiable indicators, and each scoring function characterizes a different routing optimization objective; and,
[0174] The routing decision module 403 is used to determine the routing score of each candidate agent according to the scoring function corresponding to the specified routing policy, and to determine the target agent from multiple candidate agents based on the routing score.
[0175] In one possible implementation, the set of quantitative indicators in the indicator acquisition module 401 further includes a fourth indicator, which is used to characterize the exploratory value corresponding to the uncertainty of the result of the candidate agent performing the task.
[0176] In one possible implementation, the routing decision module 403 is also used for:
[0177] Obtain the actual execution feedback data of the target agent after it has executed the current task;
[0178] Update the target agent's indicator value in the set of quantitative indicators based on actual execution feedback data.
[0179] In one possible implementation, the process by which the routing decision module 403 updates the indicator values in the quantitative indicator set based on actual execution feedback data includes:
[0180] Calculate the instantaneous value of the target agent's performance metrics for this execution based on the actual execution feedback data;
[0181] Read historical metric values of the target agent from the value repository;
[0182] The index-weighted moving average method is used to merge the instantaneous value of the indicator with the historical value of the indicator to obtain the updated indicator value, and the updated indicator value is written into the value database.
[0183] In one possible implementation, the policy determination module 402 includes at least two candidate routing policies: a first policy and a second policy, wherein the scoring function of the first policy is positively correlated with the second metric and the first metric, and negatively correlated with the calling cost of the candidate agent;
[0184] The scoring function of the second strategy is positively correlated with the second indicator, negatively correlated with the call cost, and negatively correlated with the third indicator.
[0185] In one possible implementation, the at least two candidate routing strategies in the strategy determination module 402 further include: a third strategy and a fourth strategy, wherein the scoring function of the third strategy is positively correlated with the second metric, negatively correlated with the call cost, and positively correlated with the fourth metric;
[0186] The scoring function of the fourth strategy includes a basic scoring item and an exploration incentive item. The basic scoring item is positively correlated with the second indicator and negatively correlated with the calling cost of the candidate agent. The exploration incentive item is positively correlated with the fourth indicator.
[0187] In one possible implementation, before determining the specified routing policy for the current task, the policy determination module 402 is further configured to:
[0188] Obtain the preset validity threshold value;
[0189] Compare the second metric of each candidate agent with the effectiveness threshold value;
[0190] Eliminate candidates whose second metric is below the validity threshold from multiple candidate agents to update the candidate agents.
[0191] This application also provides an electronic device in its embodiments. (See reference...) Figure 5 The diagram illustrates a structural schematic of an electronic device suitable for implementing the intelligent agent routing method in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0192] like Figure 5As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. When the electronic device is powered on, the RAM 503 also stores various programs and data required for the operation of the electronic device. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0193] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, memory cards, hard drives, etc.; and communication devices 509. Communication device 509 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0194] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the intelligent agent routing selection methods provided in this application.
[0195] This application also provides a computer-readable storage medium carrying one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the intelligent agent routing methods provided in this application.
[0196] 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.
[0197] 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 drive, 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 intelligent agent routing selection method described in the various embodiments of this application.
[0198] 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.
[0199] 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 method for intelligent agent routing selection, characterized in that, include: A set of quantitative indicators for multiple candidate intelligent agents is obtained. The set of quantitative indicators includes at least a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate intelligent agent to perform the task. The second indicator is used to characterize the effectiveness of the candidate intelligent agent in performing the task. The third indicator is used to characterize the default risk of the candidate intelligent agent in performing the task. A specified routing strategy is determined for the current task. The specified routing strategy is selected from at least two candidate routing strategies. Each candidate routing strategy includes a scoring function constructed based on at least some of the indicators in the set of quantitative indicators, and each scoring function represents a different routing optimization objective. Based on the scoring function corresponding to the specified routing policy, the routing score of each candidate agent is determined, and the target agent is determined from the plurality of candidate agents based on the routing score.
2. The agent routing method according to claim 1, characterized in that, The set of quantitative indicators also includes a fourth indicator, which is used to characterize the exploratory value corresponding to the uncertainty of the result of the candidate agent performing the task.
3. The agent routing method according to claim 1, characterized in that, The method further includes: Obtain the actual execution feedback data after the target intelligent agent executes the current task; The target agent's index value in the set of quantitative indicators is updated based on the actual execution feedback data.
4. The agent routing method according to claim 3, characterized in that, Updating the indicator values in the quantitative indicator set based on the actual execution feedback data includes: Calculate the instantaneous value of the target agent's current performance index based on the actual execution feedback data; Read the historical values of the target agent's metrics from the value repository; The instantaneous value of the indicator is merged with the historical value of the indicator using the exponentially weighted moving average method to obtain the updated indicator value, and the updated indicator value is written into the value database.
5. The agent routing method according to claim 2, characterized in that, The at least two candidate routing strategies include: a first strategy and a second strategy, wherein the scoring function of the first strategy is positively correlated with the second metric and the first metric, and negatively correlated with the calling cost of the candidate agent; The scoring function of the second strategy is positively correlated with the second indicator, negatively correlated with the call cost, and negatively correlated with the third indicator.
6. The agent routing method according to claim 5, characterized in that, The at least two candidate routing strategies further include: a third strategy and a fourth strategy, wherein the scoring function of the third strategy is positively correlated with the second indicator, negatively correlated with the call cost, and positively correlated with the fourth indicator; The scoring function of the fourth strategy includes a basic scoring item and an exploration incentive item. The basic scoring item is positively correlated with the second indicator and negatively correlated with the calling cost of the candidate agent. The exploration incentive item is positively correlated with the fourth indicator.
7. The agent routing method according to claim 1, characterized in that, Before determining the specified routing policy for the current task, the method further includes: Obtain the preset validity threshold value; Compare the second metric of each candidate agent with the validity threshold value; Candidate agents whose second metric is lower than the validity threshold are removed from the plurality of candidate agents to update the candidate agents.
8. A smart agent routing device, characterized in that, include: The indicator acquisition module is used to acquire a set of quantitative indicators for multiple candidate agents. The set of quantitative indicators includes at least a first indicator, a second indicator, and a third indicator. The first indicator is used to characterize the resource consumption required for the candidate agent to perform the task, the second indicator is used to characterize the effectiveness of the candidate agent in performing the task, and the third indicator is used to characterize the default risk of the candidate agent in performing the task. A strategy determination module is used to determine a specified routing strategy for the current task. The specified routing strategy is selected from at least two candidate routing strategies, each candidate routing strategy comprising: a scoring function constructed based on at least a portion of the metrics in the set of quantifiable metrics, and each scoring function characterizing a different routing optimization objective; and... The routing decision module is used to determine the routing score of each candidate agent according to the scoring function corresponding to the specified routing policy, and to determine the target agent from the multiple candidate agents according to the routing score.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the agent routing method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the agent routing method as described in any one of claims 1 to 7.