Method and device for dynamic recommendation of intelligent agent capability subsets based on value-driven

By constructing UV maps and calculating correlations, U instance functions related to the agent's current value function are recommended, which solves the problem of excessive space for agent planning and reasoning, improves planning efficiency and accuracy, and enhances adaptive capabilities.

CN120146201BActive Publication Date: 2025-08-29BEIJING INSTITUTE FOR GENERAL ARTIFICIAL INTELLIGENCE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510624071.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2025-08-29
Estimated Expiration
2045-05-15

AI Technical Summary

Technical Problem

In the prior art, the planning and inference space of agents is too large, resulting in a surge in computing complexity and inefficient planning efficiency, lacking a general and user-insensitive filtering mechanism, making it difficult to meet practical application needs.

Method used

By obtaining the current U instance function and V value function of the agent, combining the Infostate object, building a UV graph and calculating the correlation, recommending U instance functions related to the current value function, using Python's ast and trace modules to parse the code, counting the use and changes of Infostate variables, building a UV graph and calculating the correlation score, and recommending TopN's related U instance functions.

Benefits of technology

It significantly reduces the ability search space of the agent, improves the efficiency and accuracy of planning reasoning, ensures that the recommended ability examples are consistent with the current needs of the agent, enhances adaptability, and improves the accuracy and effectiveness of planning decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146201B_ABST
    Figure CN120146201B_ABST
Patent Text Reader

Abstract

The present invention provides a value-driven dynamic recommendation method and device for agent capability subsets. The method obtains all current U instance functions and the agent's current V value function, which are agent capabilities U and value functions V written in the Python version of TongPL. The method also obtains the current Infostate object, a data representation of the information state used to store and transmit information needed by the agent during decision-making. Based on the current U instance function, current V value function, and current Infostate object, the method recommends U instance functions related to the current V value function. This method addresses the prior art issue of increased computational complexity and an excessively large search space caused by the expansion of value functions V and the explosive growth of capability sets U as agent complexity increases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a value-driven method, device, electronic device, computer-readable storage medium and computer program product for dynamically recommending intelligent agent capability subsets. Background Art

[0002] In the field of artificial intelligence, an agent's planning and reasoning abilities are important indicators of its intelligence. However, as application scenarios become increasingly complex, the agent's value function, capabilities, or action space often become extremely large, posing significant challenges to planning and reasoning. To address this issue, the original TongPL (Lua version) proposed a method for recommending specific capability spaces (U) based on the value function (V). By reducing the U space, the speed and accuracy of planning and reasoning are improved.

[0003] In the original TongPL (Lua version) solution, the UV library was defined based on SPO (subject-verb-object triples) in OWL (Web Ontology Language). The V-to-U algorithm calculated the similarity between UVs by comparing SPO strings, thereby achieving Top-N U recommendations. However, this solution has a strong dependency on function definitions, especially the OWL-based SPO structure, which makes it difficult to scale in practical applications.

[0004] Meanwhile, some other solutions, such as watchpoints, can track variable changes but ignore variable usage (i.e., references that haven't changed). This results in these solutions failing to provide sufficient information for correlation calculations, limiting their effectiveness in intelligent planning systems.

[0005] To address the issue of excessively large planning and reasoning spaces for complex agents, in most scenarios, it's practical to filter out a significant amount of unnecessary information before planning and reasoning. For example, filtering mechanisms based on common sense and context can significantly improve planning efficiency and accuracy.

[0006] Therefore, how to design a universal, open, and user-imperceptible filtering mechanism to solve the problem of excessive planning and reasoning space for complex intelligent agents has become a technical problem that needs to be solved urgently. Summary of the Invention

[0007] In view of this, the present invention provides a value-driven dynamic recommendation method, device, electronic device, computer-readable storage medium and computer program product for agent capability subsets to solve the problem of excessively large planning and reasoning space for complex agents in the prior art.

[0008] In order to solve the above technical problems, an embodiment of the present invention provides a value-driven method for dynamically recommending agent capability subsets, the method comprising:

[0009] Get all the current U instance functions and the current V value functions of the agent; wherein the current U instance functions and the current V value functions are based on the Python version of TongPL and the agent capability U and value function V;

[0010] Get the current Infostate object; the Infostate object is a data representation of the information state, which is used to store and transmit the information needed by the agent in the decision-making process;

[0011] Based on the above current U instance function, current V value function and current Infostate object, a U instance function related to the current V value function is recommended.

[0012] Optionally, the method further includes:

[0013] The different value dimensions of the agent are collectively referred to as the value function V, where the value function V includes n dimensions. Each dimension of the value function V has a corresponding calculation function denoted as fi and a weight denoted as wi. The total calculation function V is f_1 * w_1 + f_2 * w_2 + ... + f_n * w_n. The calculation result is the value function of the overall V. The improvement of the value function of the overall V determines the driving force of the agent's actions.

[0014] Optionally, based on the above-mentioned current U instance function, current V value function and current Infostate object, recommending a U instance function related to the current V value function includes:

[0015] Run the value function of the overall V and each U instance function based on trace+ast to obtain the use attribute counter and change attribute counter of the overall V value function and each U instance function about the Infostate object;

[0016] Constructing a UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter;

[0017] Calculate the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result;

[0018] The relevant U instance function is recommended based on the correlation technical results.

[0019] Optionally, running the value function of the overall V and each U instance function based on trace+ast to obtain the usage attribute counter and the change attribute counter of the Infostate object of the value function of the overall V and each U instance function includes:

[0020] During a function call, a node class StackNode is established for each call stack; wherein each call stack node class StackNode includes at least the function definition node of the ast, all ast nodes indexed by code lines, and the parsed Infostate variable name; and a data structure StackInfo is established for each call stack; wherein each call stack data structure StackInfo includes at least the mapping relationship between the Infostate variable ID and the Infostate variable name, the mapping relationship between the local Infostate variable and the Infostate variable name, the flag indicating that the Infostate variable has changed, a used attribute counter, and a changed attribute counter;

[0021] Use Python's ast and inspect modules to parse the source code of the UV function to obtain an ast-based tree structure;

[0022] Use the tree structure to recursively count the usage and changes of Infostate variables in a single call stack;

[0023] The trace module is used to track the usage and changes of Infostate variables in multiple call stacks to obtain the total usage attribute counter and change attribute counter.

[0024] Optionally, constructing the UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter includes:

[0025] The overall V value function and each U instance function have a total usage attribute counter and a change attribute counter of the Infostate object. The overall V value function and each U instance function are used as nodes in the graph;

[0026] When two nodes use or change the same Infostate object attribute, the two nodes are related, and a directed edge is established between the two nodes. The edge weight is the sum of the counts of all overlapping Infostate object attributes, thereby constructing the UV graph.

[0027] Optionally, calculating the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result, and recommending the relevant U instance function according to the correlation technical result includes:

[0028] Calculate the sum of the edge weights of each incoming edge of the U instance function node connected to the value function node of the overall V according to the UV graph as the relevance score of the U instance function node;

[0029] Sort the relevance scores of all U instance function nodes and recommend the TopN related U instance functions.

[0030] Optionally, the method further includes:

[0031] Maintain one or more U instance functions; wherein each U instance function corresponds to a specific capability of the agent;

[0032] In a U instance function is configured to modify one or more state parameters in the Infostate object when executed.

[0033] Another aspect of an optional embodiment of the present invention provides a value-driven dynamic recommendation device for agent capability subsets, the device comprising:

[0034] The first acquisition module is used to obtain all current U instance functions and current V value functions of the agent; wherein the current U instance function and the current V value function are the agent capability U and value function V written based on the Python version of TongPL;

[0035] The second acquisition module is used to obtain the current Infostate object; wherein the Infostate object is a data representation of the information state, which is used to store and transmit the information required by the agent in the decision-making process;

[0036] The recommendation module is used to recommend a U instance function related to the current V value function based on the current U instance function, the current V value function and the current Infostate object.

[0037] Optionally, the device further comprises:

[0038] The calculation module is used to collectively record the different value dimensions of the intelligent agent as a value function V, where the value function V includes n dimensions, each dimension of the value function V has a corresponding calculation function recorded as fi and a weight recorded as wi, and the total calculation function V is f_1 * w_1 + f_2 * w_2 + ... + f_n * w_n. The calculation result is used as the value function of the overall V. The improvement of the value function of the overall V determines the driving force of the intelligent agent's actions.

[0039] Optionally, the recommendation module includes:

[0040] The first acquisition unit is configured to run the value function of the overall V and each U instance function based on trace+ast to obtain a usage attribute counter and a change attribute counter of the overall V value function and each U instance function with respect to an Infostate object;

[0041] a construction unit, configured to construct a UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter;

[0042] The second acquisition unit is configured to calculate the sum of the input edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result;

[0043] A recommendation unit is used to recommend the relevant U instance function according to the correlation technical result.

[0044] Optionally, the first acquiring unit includes:

[0045] Establish a subunit for establishing a node class StackNode for each call stack during a function call process; wherein the node class StackNode for each call stack includes at least an ast function definition node, all ast nodes indexed by code lines, and a parsed Infostate variable name; and establish a data structure StackInfo for each call stack; wherein the data structure StackInfo for each call stack includes at least a mapping relationship between an Infostate variable ID and an Infostate variable name, a mapping relationship between a local Infostate variable and an Infostate variable name, a flag indicating that an Infostate variable has changed, a usage attribute counter, and a change attribute counter;

[0046] The first acquisition subunit is used to parse the source code of the UV function using Python's ast and inspect modules to obtain an ast-based tree structure;

[0047] The statistics subunit is used to recursively count the usage and changes of Infostate variables in a single call stack using a tree structure;

[0048] The second acquisition subunit is used to use the trace module to trace the usage and change of the Infostate variable in multiple call stacks to obtain a total usage attribute counter and a change attribute counter.

[0049] Optionally, the building blocks include:

[0050] The third acquisition subunit, for the overall V value function and each U instance function, has a total usage attribute counter and a change attribute counter of the Infostate object, and uses the overall V value function and each U instance function as nodes in the graph;

[0051] A construction subunit is used to establish a directed edge between two nodes when the same Infostate object attribute is used or changed between the two nodes, and the edge weight is the sum of the counts of all overlapping Infostate object attributes, thereby constructing the UV map.

[0052] Optionally, the recommendation unit is also used to calculate the sum of the edge weights of each incoming edge of the U instance function node connected to the value function node of the overall V based on the UV graph as the relevance score of the U instance function node; sort the relevance scores of all U instance function nodes, and recommend the TopN related U instance functions.

[0053] Optionally, the device further comprises:

[0054] A maintenance module, configured to maintain one or more U instance functions; wherein each U instance function corresponds to a specific capability of the agent;

[0055] The modification module is used to modify one or more state parameters in an Infostate object when a U instance function is configured to be executed.

[0056] According to another aspect of an optional embodiment of the present invention, an electronic device is provided, comprising:

[0057] processor; and

[0058] Memory for storing programs,

[0059] The program includes instructions, which, when executed by the processor, enable the processor to perform the method according to any one of the above embodiments.

[0060] According to another aspect of an optional embodiment of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method according to any one of the above embodiments.

[0061] According to another aspect of an optional embodiment of the present invention, a computer program product is provided. The computer program product includes instructions. When the instructions are executed, the computer is caused to execute the method according to any one of the above embodiments.

[0062] Through an optional embodiment of the present invention, all current U instance functions of the intelligent agent and the current V value function of the intelligent agent are obtained; wherein, the current U instance function and the current V value function are the intelligent agent capability U and value function V written based on the Python version of TongPL; the current Infostate object is obtained; wherein, the Infostate object is a data representation of the information state, which is used to store and transmit the information required by the intelligent agent in the decision-making process; based on the above-mentioned current U instance function, current V value function and current Infostate object, a U instance function related to the current V value function is recommended. This approach addresses the existing problem that, as agent complexity increases, the value function V and the capability set U explode, leading to a surge in computational complexity and an overly large search space. Furthermore, existing string similarity-based filtering mechanisms are inefficient when dealing with highly complex V and U, and lack a universal, user-insensitive filtering mechanism, resulting in low planning efficiency and difficulty meeting practical application requirements. By obtaining the agent's current U instance function and V value function and combining them with the current Infostate object, the present invention accurately recommends U instance functions related to the agent's current value function. This recommendation mechanism, based on the Python version of TongPL, effectively narrows the agent's capability search space, significantly improving planning reasoning efficiency. Furthermore, because the recommendation results are closely linked to the agent's current value function, the recommended capability instances are ensured to be highly consistent with the agent's current needs and goals, thereby improving the accuracy and effectiveness of planning decisions. Furthermore, by utilizing the Infostate object to store and transmit information during the decision-making process, the present invention's optional instances enhance the agent's adaptability in different scenarios, enabling it to more flexibly respond to various complex situations.

[0063] It should be understood that the foregoing general description and the following detailed description are merely exemplary and illustrative and are not intended to limit the scope of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The accompanying drawings, which are part of the specification of the present invention, illustrate exemplary embodiments of the present invention and, together with the description, serve to explain the principles of the present invention.

[0065] Figure 1 This is a flowchart of a value-driven method for dynamically recommending agent capability subsets according to an embodiment of the present invention.

[0066] Figure 2 3 is a schematic diagram of a value-driven method for dynamically recommending agent capability subsets according to an embodiment of the present invention.

[0067] Figure 3This is another flow chart of the value-driven method for dynamically recommending agent capability subsets according to an embodiment of the present invention.

[0068] Figure 4 4 is a structural block diagram of a value-driven dynamic recommendation device for intelligent agent capability subsets according to an embodiment of the present invention.

[0069] Figure 5 This is another structural block diagram of a value-driven dynamic recommendation device for agent capability subsets according to an embodiment of the present invention.

[0070] Figure 6 4 is a structural block diagram of a recommendation module according to an embodiment of the present invention.

[0071] Figure 7 is a structural block diagram of a first acquisition unit according to an embodiment of the present invention.

[0072] Figure 8 is a structural block diagram of a building unit according to an embodiment of the present invention.

[0073] Figure 9 This is another structural block diagram of a value-driven dynamic recommendation device for agent capability subsets according to an embodiment of the present invention.

[0074] Figure 10 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0075] In order to make the objectives, technical solutions and advantages of the embodiments of the present invention more clearly understood, the spirit of the contents disclosed in the present invention will be clearly illustrated with the accompanying drawings and detailed descriptions below. After understanding the embodiments of the contents of the present invention, any technician in the relevant technical field can change and modify the contents of the present invention based on the techniques taught by the contents of the present invention without departing from the spirit and scope of the contents of the present invention.

[0076] The exemplary embodiments of the present invention and their description are used to explain the present invention, but are not intended to limit the present invention. In addition, elements / components with the same or similar reference numerals used in the drawings and embodiments are used to represent the same or similar parts.

[0077] The terms “first,” “second,” etc. used herein do not particularly refer to an order or sequence, nor are they intended to limit the present invention. They are merely used to distinguish elements or operations described with the same technical terms.

[0078] The directional terms used herein, such as up, down, left, right, front, or back, are only used to refer to the directions in the accompanying drawings. Therefore, the directional terms used are used to illustrate and not to limit the present invention.

[0079] The words “include,” “including,” “have,” “contain,” etc. used in this document are open-ended terms, meaning including but not limited to.

[0080] As used herein, "and / or" includes any and all combinations of the items mentioned.

[0081] Regarding "plurality" in this document, "plurality" includes "two" and "more than two"; regarding "plurality groups" in this document, "plurality groups" includes "two groups" and "more than two groups".

[0082] As used herein, the terms "substantially" and "approximately" are used to modify any quantity or error that may vary slightly, but such variations or errors do not alter the essence of the quantity. Generally speaking, the range of such variations or errors modified by such terms may be 20% in some embodiments, 10% in some embodiments, 5% in some embodiments, or other values. Those skilled in the art will appreciate that the aforementioned values ​​may be adjusted based on actual needs and are not intended to be limiting.

[0083] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0084] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to systems having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, and C, etc.). When expressions such as "at least one of A, B, or C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to systems having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, and C, etc.). Those skilled in the art should also understand that any transitional conjunctions and / or phrases indicating two or more optional items, whether in the specification, claims, or drawings, should be understood to provide the possibility of including one, either, or both of these items. For example, the phrase "A or B" should be understood to include the possibilities of "A" or "B", or "A and B".

[0085] To address the issue of excessively large planning and reasoning spaces for complex agents (e.g., the diverse value dimensions and capability sets of agents are vast), in most scenarios, it's practical to filter out a significant amount of unnecessary information before planning and reasoning (e.g., eating when hungry is the correct action, cleaning when messy). The diverse value dimensions of an agent, collectively referred to as V, encompass both those defined manually and those learned from data and experience. The capability set of an agent, denoted as U, encompasses all the actions the agent can perform. These can range from simple actions to complex behaviors, such as walking, talking, eating, sleeping, picking up and putting down objects, and cleaning the room. Capabilities can be innate knowledge imparted to the agent through human coding, or they can be new knowledge acquired through interaction with the environment or communication with other agents. As an agent's capabilities grow, this set will also grow larger. When making planning decisions, the agent needs to input its current value V and capability set U, and consider which capabilities (i.e., which actions) will maximize its value score. When the dimensions of V and the number of U are large, the computational overhead required for planning decisions becomes prohibitive, necessitating a method to improve planning efficiency. To improve planning efficiency and accuracy, and in line with the design principles of TongPL (Python version) and the principle of being as universal and open as possible, a user-friendly way to filter overly large capability sets is needed.

[0086] Based on the value V, dynamic U recommendation is implemented at runtime to help the agent planner to plan more effectively and quickly, while reducing the restrictions or additional workload when the user writes the UV library. To this end, this embodiment provides a value-driven agent capability subset dynamic recommendation method. Figure 1 FIG. 1 is a flow chart of a method for dynamically recommending a subset of intelligent agent capabilities based on value-drivenness according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0087] Step S101: Obtain all current U instance functions and V value functions of the agent. These current U instance functions and V value functions are based on the Python version of TongPL, representing the agent's capabilities U and value functions V. In one optional embodiment, the agent's various value dimensions are collectively referred to as value functions V. These may be manually defined or learned from data and experience, such as hunger, thirst, cleanliness, tidiness, curiosity, fun, fatigue, and so on. Value functions V consist of n dimensions, each of which has a corresponding calculation function, denoted as f_i, and a weight, denoted as w_i. The total calculation function V is f_1 * w_1 + f_2 * w_2 + ... + f_n * w_n. The result is the overall value function V. Improving this overall value function V determines the driving force behind the agent's actions. The agent's set of capabilities, denoted as U, encompasses all actions the agent can perform. These can range from simple actions to complex behaviors, such as walking, talking, eating, sleeping, picking up objects, putting them down, and cleaning the room. Capabilities can be innate knowledge given to an agent through human coding, or they can be new knowledge generated by the agent through interaction with the environment or communication with other agents. As the capabilities of the agent grow, this set will also become larger and larger.

[0088] Step S102: Obtain the current Infostate object; wherein the Infostate object is a data representation of the information state, and is used to store and transmit the information required by the agent in the decision-making process.

[0089] Step S103: Based on the above current U instance function, current V value function and current Infostate object, recommend a U instance function related to the current V value function.

[0090] Through the above steps, all the current U instance functions and the current V value function of the intelligent agent are obtained; wherein, the current U instance function and the current V value function are the intelligent agent capabilities U and value functions V written based on the Python version of TongPL; the current Infostate object is obtained; wherein, the Infostate object is a data representation of the information state, which is used to store and transmit the information required by the intelligent agent in the decision-making process; based on the above current U instance function, the current V value function and the current Infostate object, the U instance function related to the current V value function is recommended. This approach addresses the existing problem that, as agent complexity increases, the value function V and the capability set U explode, leading to a surge in computational complexity and an overly large search space. Furthermore, existing string similarity-based filtering mechanisms are inefficient when dealing with highly complex V and U, and lack a universal, user-insensitive filtering mechanism, resulting in low planning efficiency and difficulty meeting practical application requirements. By obtaining the agent's current U instance function and V value function and combining them with the current Infostate object, the present invention accurately recommends U instance functions related to the agent's current value function. This recommendation mechanism, based on the Python version of TongPL, effectively narrows the agent's capability search space, significantly improving planning reasoning efficiency. Furthermore, because the recommendation results are closely linked to the agent's current value function, the recommended capability instances are ensured to be highly consistent with the agent's current needs and goals, thereby improving the accuracy and effectiveness of planning decisions. Furthermore, by utilizing the Infostate object to store and transmit information during the decision-making process, the aforementioned steps of the optional embodiment of the present invention can enhance the agent's adaptive capabilities in different scenarios, enabling it to more flexibly respond to various complex situations. In a specific application scenario, the attention mechanism applied to complex intelligent agents can, for example, calculate the correlation between the agent's value (V) and its capability set (U) to select the most relevant subset of capabilities based on specific values. The agent's values ​​can be manually defined or learned from data or experience, such as hunger, thirst, cleanliness, tidiness, curiosity, and so on. The capability set includes what the agent can do, such as eating, drinking, cleaning dirty dishes, cleaning the room, and exploring unknown areas. If the agent is not hungry but its room is messy, it can select only a portion of the capability set when planning its next action (i.e., omitting eating and only considering capabilities related to cleaning the room). This reduces unnecessary planning and reasoning resource usage, improves the accuracy and reliability of planning and reasoning results, and enhances the efficiency of the planning and reasoning process.At the same time, the above embodiment has no restrictions on the data structure of the variable itself. It can process simple Python data structures (such as arrays, tuples, and dictionaries), as well as complex class instances or nested structures, such as classes with many member variables, and dictionaries or arrays nested in dictionaries (such as the Infostate object mentioned below).

[0091] In an alternative embodiment, if Figure 2 As shown, the input parameters are: all current U instances, V calculation functions, and Infostate objects of the agent; the return parameter is: all U instances associated with V. U instances and V calculation functions are user-written capability and value functions based on TongPL (Python). At runtime, the agent instance of the agent maintains a list of U instances and a total of V calculation function objects. Furthermore, the Infostate object represents all environmental and state information, stored in memory as a dictionary. This data is generated and provided by the perception module (vision, hearing, etc.). The V calculation function calculates scores based on the Infostate object (e.g., whether the environment is clean or the user is hungry). U instance functions manipulate the Infostate object during planning. For example, a U that is eating will change its hunger level in the Infostate object to "not hungry."

[0092] The above step S103 involves recommending a U instance function related to the current V value function based on the current U instance function, the current V value function and the current Infostate object. In an optional embodiment, as shown in FIG. Figure 3 As shown, the following steps are included:

[0093] Step S301: Run the value function of the overall V and each U instance function based on trace+ast to obtain the usage attribute counter and change attribute counter of the Infostate object in the overall V value function and each U instance function. Specifically, the Python trace module can be used to trace the usage and change of the Infostate object in the overall V and each U function. All attributes of the Infostate object will be tracked and recorded. For example, if Infostate = {'a': {'b':[1, 2]}}, then for the statement temp = Infostate['a']['b'][0], it is a use of Infostate, and the name of the used attribute is Infostate['a']['b'][0]. Correspondingly, for the statement Infostate['a']['b'] = [4, 5], it is a change of Infostate, and the name of the changed attribute is Infostate['a']['b'].

[0094] Step S302: Construct a UV graph based on the overlap between the used attribute names of the used attribute counters and the changed attribute names of the changed attribute counters. Specifically, the overlap between the used attribute counter names (strings) and the changed attribute counter names (strings) is calculated. The used attribute counters contain multiple used attribute names and their corresponding quantities (key-value pairs), while the changed attribute counters contain multiple changed attribute names and their corresponding quantities (key-value pairs). In this optional embodiment, by running the value function of the overall V and each U instance function using trace + ast, the used attribute counters and changed attribute counters for the overall V and each U with respect to the Infostate object can be accurately obtained. This process not only reveals the specific operations of the U instances and V calculation functions at the code level, but also quantifies their dependence on and influence on various attributes in the Infostate object. In this way, this embodiment of the present invention can accurately identify the intrinsic correlation between the U instances and the V calculation functions, laying a solid foundation for the subsequent recommendation process. At the same time, the overlap of attribute names (strings) and changed attribute names (strings) is used in combination with attribute counters and changed attribute counters to construct a UV association graph. The graph uses attribute names as nodes and attribute usage and changes as edges. The association strength between nodes is quantified by the overlap. The construction of this graph structure transforms the originally complex code-level association relationship into an intuitive graphical representation, making the association between U instances and V calculation functions clearer and easier to understand. The construction of the graph structure also provides an efficient data foundation for subsequent correlation calculations.

[0095] Step S303: Calculate the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V based on the UV graph to obtain the correlation calculation result. In addition, the correlation score is calculated by summing the incoming edge weights of the U nodes connected to the V node, and the TopN U sets are recommended based on the correlation score. This process ensures that the U instance set recommended to the agent has the highest correlation with the V calculation function, thereby maximally meeting the current needs and goals of the agent during the decision-making process. The recommendation mechanism based on the correlation score not only improves the accuracy and effectiveness of the recommendation, but also avoids interference from irrelevant or low-relevant U instances, further improving the decision-making efficiency and performance of the agent.

[0096] Step S304: recommend the relevant U instance function according to the correlation technical result.

[0097] Furthermore, regarding the trace+AST-based execution of the overall V value function and each U instance function, the usage attribute counter and the change attribute counter of the Infostate object for the overall V value function and each U instance function are obtained. In one optional embodiment, during the function call process, a node class StackNode is established for each call stack; each StackNode node class includes at least the AST function definition node, all AST nodes indexed by code line, and the parsed Infostate variable name. A data structure StackInfo is also established for each call stack; each StackInfo data structure includes at least the mapping between Infostate variable IDs and Infostate variable names, the mapping between local Infostate variables and Infostate variable names, a flag indicating Infostate variable changes, a usage attribute counter, and a change attribute counter. Due to the flexibility of Python coding, it is necessary to track the use and changes of Infostate objects in various situations. For example, some local temporary variables actually reference Infostate objects, and references also exist between functions. The source code of the UV function is parsed using Python's ast and inspect modules to obtain an AST-based tree structure. Specifically, the Python ast (abstract syntax tree, a Python module) and inspect modules are used to parse the source code to obtain the AST tree structure and convert it into the aforementioned data structure. This tree structure is then used to recursively count the usage and changes of Infostate variables within a single call stack. Specifically, a NodeVisitor class is constructed to update the data information for each call stack. A recursive method is used to parse all variables in the data structure, and the Name, Attribute, and Subscript nodes of the AST are then used to count the usage and changes of the variables. The trace module is used to track the usage and changes of Infostate variables across multiple call stacks, generating a total attribute usage counter and attribute change counter.This optional embodiment establishes a node class, StackNode, and a data structure, StackInfo, for each call stack during the function call process. By utilizing Python's ast, inspect, and trace modules for source code parsing and variable tracking, this implementation enables precise statistics and analysis of the use and changes of Infostate objects across each call stack, resulting in the following significant technical benefits: 1) Accurately capture function call context: By establishing a node class, StackNode, for each call stack, containing the AST function definition node, all AST nodes indexed by code line, and parsed Infostate variable names, this embodiment accurately captures function call context information. This refined context capture provides accurate basic data for subsequent variable tracking and analysis, ensuring that analysis of Infostate object usage and changes can be performed down to the specific function call level. 2) Comprehensively record the mapping and changes of Infostate variables: By establishing a data structure, StackInfo, for each call stack, containing the mapping between Infostate variable IDs and names, the mapping between local Infostate variables and names, flags indicating Infostate variable changes, usage attribute counters, and change attribute counters, this embodiment comprehensively records the mapping and changes of Infostate variables across each call stack. This comprehensive recording mechanism not only covers the mapping of global and local variables, but also quantifies the degree of variable usage and changes through change flags and usage / change counters, providing rich data support for subsequent analysis. 3) Effectively Tracking the Flexibility of Python Coding: To address the flexibility of Python coding, the embodiments of the present invention ensure accurate tracking of the use and changes of Infostate objects in various complex coding scenarios by tracking the use and changes of Infostate objects in various situations, such as references to Infostate objects by local temporary variables and references between functions. This effective tracking mechanism overcomes the challenges brought by the flexibility of Python coding and ensures the accuracy and completeness of analysis. 4) Efficiently Parse Source Code and Convert it into Data Structures: By utilizing Python's ast and inspect modules to parse source code, obtain a tree structure based on the ast function and convert it into the aforementioned data structure, the embodiments of the present invention achieve efficient conversion of source code into data structures. This conversion process not only preserves the structural information of the source code but also converts it into a data form that is convenient for subsequent analysis and processing, thereby improving processing efficiency and accuracy.5) Accurately count the usage and changes of Infostate variables: By constructing a NodeVisitor class and recursively counting the usage and changes of Infostate variables within a single call stack, this embodiment of the present invention achieves precise statistics on the usage and changes of Infostate variables. Specifically, by recursively parsing all variables in the data structure and using the Name, Attribute, and Subscript nodes of the AST to count variable usage and changes, the statistics are comprehensive and accurate. 6) Comprehensively track the usage and changes of Infostate variables across multiple call stacks: By utilizing the trace module to track the usage and changes of Infostate variables across multiple call stacks, generating a total usage attribute counter and a change attribute counter, this embodiment of the present invention achieves comprehensive tracking of the overall usage and changes of Infostate variables across multiple call stacks. This comprehensive tracking mechanism provides a global perspective for subsequent analysis and decision-making, ensuring the completeness and accuracy of the analysis. 7) No restrictions or changes are required on the tracked variables, and no code modifications are required at runtime. ASTs are static code parsers, making it easier to control the handling methods and corner cases in different situations. In summary, by establishing a sophisticated call stack data structure and leveraging Python's `ast`, `inspect`, and `trace` modules for source code parsing and variable tracking, this embodiment of the present invention can track the use and changes of any Python variable within any Python function. This information is returned as a counter, enabling precise statistics and analysis of the use and changes of InfoState objects across various call stacks. These technical achievements enable intelligent agents to more accurately and comprehensively understand their own state and the interaction with their environment, enabling them to make more rational and efficient decisions. This approach has significant practical value and broad application prospects.

[0098] Regarding constructing a UV graph based on the overlap between the used attribute names in the use attribute counter and the changed attribute names in the change attribute counter, in one optional embodiment, the value function of the entire V and each U instance function have a total used attribute counter and a changed attribute counter for Infostate objects. The value function of the entire V and each U instance function are considered nodes in the graph. When two nodes use or change the same Infostate object attribute, the two nodes are considered related. A directed edge is established between them, with the edge weight being the sum of the counts of all overlapping Infostate object attributes. The direction of the edge is defined as from use count to change count. Use represents a consumer node, and change represents a producer node. Generally, the entire V is a pure consumer node, and U is a producer node. We are more interested in the correlation from V to U. For example, if the entire V and U1 have use and change counts (counts greater than 0) for Infostate['x'] and Infostate['y'], an edge is required between the entire V and U1. Furthermore, since the use count of the entire V is greater than 0, and the change count of U1 is greater than 0, the direction of the edge is from the entire V to U1. In general, edges are established between V and U, and between U and U according to the above method. Edges also need to be established between U and U, because some U do not directly affect V, but are indirectly associated with V through other U, and finally a directed graph between UVs is obtained.

[0099] Regarding calculating the sum of the edge weights of the incoming edges of the U instance function nodes connected to the value function node of the overall V according to the UV graph, obtaining the correlation calculation result, and recommending the relevant U instance function according to the correlation technical result, in an optional embodiment, the sum of the edge weights of the incoming edges of each U instance function node connected to the value function node of the overall V is calculated according to the UV graph as the correlation score of the U instance function node, and the correlation scores of all U instance function nodes are sorted to recommend the TopN relevant U instance functions. Specifically, based on the UV directed graph obtained in the above embodiment, the sum of the edge weights of the incoming edges of each U node connected to the overall V is calculated (for example, if U1 has two incoming edges, then the score of U1 is the sum of the edge weights of these two edges) as the correlation score of the U node. The correlation scores of all U nodes are sorted, and the TopN U instances can be recommended and provided to downstream planning decisions for efficient reasoning.

[0100] In an optional embodiment, one or more U instance functions are maintained; wherein each U instance function corresponds to a specific capability of the agent, and a U instance function is configured to modify one or more state parameters in the Infostate object when executed.

[0101] An optional embodiment of the present invention provides a Python-based variable tracking and correlation calculation method that leverages Python's abstract syntax tree (AST) to understand and record the read and write behavior of any Python variable. Leveraging this capability and Python's Trace module, it is possible to track the usage of a variable within any Python function and further construct a correlation calculation graph based on that variable between different functions.

[0102] In this embodiment, a value-driven dynamic recommendation device for agent capability subsets is also provided, which is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation by hardware, or a combination of software and hardware, is also possible and conceivable.

[0103] This embodiment provides a value-driven intelligent agent capability subset dynamic recommendation device, such as Figure 4 As shown, including:

[0104] The first acquisition module 41 is used to obtain all current U instance functions and current V value functions of the agent; wherein the current U instance function and the current V value function are the agent capability U and value function V written based on the Python version of TongPL;

[0105] The second acquisition module 42 is used to obtain the current Infostate object; wherein the Infostate object is a data representation of the information state, which is used to store and transmit the information required by the agent in the decision-making process;

[0106] The recommendation module 43 is configured to recommend a U instance function related to the current V value function based on the current U instance function, the current V value function and the current Infostate object.

[0107] Alternatively, as Figure 5 As shown, the device also includes:

[0108] The calculation module 45 is used to collectively record the different value dimensions of the intelligent agent as a value function V, where the value function V includes n dimensions, each dimension of the value function V has a corresponding calculation function recorded as fi and a weight recorded as wi, and the total calculation function V is f_1 * w_1 + f_2 * w_2 + ... + f_n * w_n. The calculation result is used as the value function of the overall V. The improvement of the value function of the overall V determines the driving force of the intelligent agent's actions.

[0109] Alternatively, as Figure 6 As shown, the recommendation module 43 includes:

[0110] The first acquisition unit 431 is configured to run the value function of the overall V and each U instance function based on trace+ast to obtain a usage attribute counter and a change attribute counter of the overall V value function and each U instance function with respect to an Infostate object;

[0111] A construction unit 432 is configured to construct a UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter;

[0112] The second acquisition unit 433 is configured to calculate the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result;

[0113] The recommendation unit 434 is configured to recommend the relevant U instance function according to the correlation technical result.

[0114] Alternatively, as Figure 7 As shown, the first acquiring unit 431 includes:

[0115] Establishment subunit 4311 is used to establish a node class StackNode for each call stack during a function call process; wherein the node class StackNode for each call stack includes at least the function definition node of the ast, all ast nodes indexed by code line, and the parsed Infostate variable name; and establish a data structure StackInfo for each call stack; wherein the data structure StackInfo for each call stack includes at least the mapping relationship between the Infostate variable ID and the Infostate variable name, the mapping relationship between the local Infostate variable and the Infostate variable name, the flag indicating that the Infostate variable has changed, the use attribute counter, and the change attribute counter;

[0116] The first acquisition subunit 4312 is used to parse the source code of the UV function using Python's ast and inspect modules to obtain an ast-based tree structure;

[0117] The statistics subunit 4313 is used to recursively count the usage and change of Infostate variables in a single call stack using a tree structure;

[0118] The second acquisition subunit 4314 is configured to use the trace module to trace the usage and change of the Infostate variable in multiple call stacks, and obtain a total usage attribute counter and a change attribute counter.

[0119] Alternatively, as Figure 8 As shown, the construction unit 432 includes:

[0120] The third acquisition subunit 4321 has a total usage attribute counter and a change attribute counter for the Infostate object for the overall V value function and each U instance function, and uses the overall V value function and each U instance function as nodes in the graph;

[0121] The construction subunit 4322 is used to establish a directed edge between the two nodes when the same Infostate object attribute is used or changed between the two nodes, and the edge weight is the sum of the counts of all overlapping Infostate object attributes, thereby constructing the UV graph.

[0122] Optionally, the recommendation unit 434 is also used to calculate the sum of the edge weights of each incoming edge of the U instance function node connected to the value function node of the overall V based on the UV graph as the relevance score of the U instance function node; sort the relevance scores of all U instance function nodes, and recommend the TopN related U instance functions.

[0123] Alternatively, as Figure 9 As shown, the device also includes:

[0124] A maintenance module 46 is configured to maintain one or more U instance functions, wherein each U instance function corresponds to a specific capability of the agent;

[0125] The modification module 47 is configured to modify one or more state parameters in the Infostate object when a U instance function is executed.

[0126] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.

[0127] An exemplary embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, wherein the computer program, when executed by the at least one processor, causes the electronic device to perform a method according to an embodiment of the present invention.

[0128] Exemplary embodiments of the present invention further provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.

[0129] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is configured to cause the computer to perform a method according to an embodiment of the present invention.

[0130] refer to Figure 10 , a block diagram of an electronic device that can serve as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0131] like Figure 10 As shown, electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. RAM 1003 may also store various programs and data required for the operation of device 1000. Computing unit 1001, ROM 1002, and RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to bus 1004.

[0132] Multiple components within electronic device 1000 are connected to I / O interface 1005, including an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. Input unit 1006 can be any type of device capable of inputting information into electronic device 1000. Input unit 1006 can receive input numeric or character information and generate key input signals related to user settings and / or function control of the electronic device. Output unit 1007 can be any type of device capable of presenting information and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. Storage unit 1008 may include, but is not limited to, a magnetic disk or an optical disk. Communication unit 1009 allows electronic device 1000 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver and / or chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0133] The computing unit 1001 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above. For example, in some embodiments, the music data processing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 1000 via the ROM 1002 and / or the communication unit 1009. In some embodiments, the computing unit 1001 may be configured to perform the methods according to embodiments of the present invention by any other suitable means (e.g., via firmware).

[0134] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0135] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0136] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and / or data to a programmable processor.

[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0138] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0139] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.

[0140] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.

Claims

1. A value-driven method for dynamically recommending agent capability subsets, characterized in that: The method comprises: Get all the current U instance functions and the current V value functions of the agent; wherein the current U instance functions and the current V value functions are based on the Python version of TongPL and the agent capability U and value function V; Get the current Infostate object; the Infostate object is a data representation of the information state, which is used to store and transmit the information needed by the agent in the decision-making process; Based on the current U instance function, the current V value function and the current Infostate object, a U instance function related to the current V value function is recommended.

2. The value-driven agent capability subset dynamic recommendation method according to claim 1 is characterized in that: The method further comprises: The different value dimensions of the agent are collectively referred to as the value function V, where the value function V includes n dimensions. Each dimension of the value function V has a corresponding calculation function denoted as fi and a weight denoted as wi. The total value function V is f_1 * w_1 +f_2 * w_2 + ... + f_n * w_n. The calculation result is the value function of the overall V. The improvement of the value function of the overall V determines the driving force of the agent's actions.

3. The value-driven agent capability subset dynamic recommendation method according to claim 2 is characterized in that: Recommending a U instance function related to the current V value function based on the current U instance function, the current V value function, and the current Infostate object includes: Run the value function of the overall V and each U instance function based on trace+ast to obtain the use attribute counter and change attribute counter of the overall V value function and each U instance function about the Infostate object; Constructing a UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter; Calculate the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result; The relevant U instance function is recommended according to the correlation calculation result.

4. The value-driven agent capability subset dynamic recommendation method according to claim 3 is characterized in that: Based on trace+ast, the value function of the overall V and each U instance function are run to obtain the usage attribute counter and change attribute counter of the Infostate object of the value function of the overall V and each U instance function. During a function call, a node class StackNode is established for each call stack; wherein each call stack node class StackNode includes at least the function definition node of the ast, all ast nodes indexed by code lines, and the parsed Infostate variable name; and a data structure StackInfo is established for each call stack; wherein each call stack data structure StackInfo includes at least the mapping relationship between the Infostate variable ID and the Infostate variable name, the mapping relationship between the local Infostate variable and the Infostate variable name, the flag indicating that the Infostate variable has changed, a used attribute counter, and a changed attribute counter; Use Python's ast and inspect modules to parse the source code of the UV function to obtain an ast-based tree structure; Use the tree structure to recursively count the usage and changes of Infostate variables in a single call stack; The trace module is used to track the usage and changes of Infostate variables in multiple call stacks to obtain the total usage attribute counter and change attribute counter.

5. The value-driven agent capability subset dynamic recommendation method according to claim 3 is characterized in that: Constructing a UV map based on the coincidence of the used attribute name of the used attribute counter and the changed attribute name of the changed attribute counter includes: The overall V value function and each U instance function have a total usage attribute counter and a change attribute counter of the Infostate object. The overall V value function and each U instance function are used as nodes in the graph; When two nodes use or change the same Infostate object attribute, the two nodes are related, and a directed edge is established between the two nodes. The edge weight is the sum of the counts of all overlapping Infostate object attributes, thereby constructing the UV graph.

6. The value-driven agent capability subset dynamic recommendation method according to claim 5 is characterized in that: Calculate the sum of the incoming edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result. Recommend the relevant U instance function according to the correlation calculation result, including: Calculate the sum of the edge weights of each incoming edge of the U instance function node connected to the value function node of the overall V according to the UV graph as the relevance score of the U instance function node; Sort the relevance scores of all U instance function nodes and recommend the TopN related U instance functions.

7. The value-driven agent capability subset dynamic recommendation method according to any one of claims 3 to 6, characterized in that: The method further comprises: Maintain one or more U instance functions; wherein each U instance function corresponds to a specific capability of the agent; In a U instance function is configured to modify one or more state parameters in the Infostate object when executed.

8. A value-driven dynamic recommendation device for agent capability subsets, characterized in that: The device comprises: The first acquisition module is used to obtain all current U instance functions and current V value functions of the agent; wherein the current U instance function and the current V value function are the agent capability U and value function V written based on the Python version of TongPL; The second acquisition module is used to obtain the current Infostate object; wherein the Infostate object is a data representation of the information state, which is used to store and transmit the information required by the agent in the decision-making process; The recommendation module is used to recommend a U instance function related to the current V value function based on the current U instance function, the current V value function and the current Infostate object.

9. The value-driven agent capability subset dynamic recommendation device according to claim 8, characterized in that: The device further comprises: The calculation module is used to collectively record the different value dimensions of the intelligent agent as a value function V, where the value function V includes n dimensions, each dimension of the value function V has a corresponding calculation function recorded as fi and a weight recorded as wi, and the total value function V is f_1 * w_1 + f_2 * w_2 + ... + f_n * w_n. The calculation result is used as the value function of the overall V. The improvement of the value function of the overall V determines the driving force of the intelligent agent's actions.

10. The value-driven agent capability subset dynamic recommendation device according to claim 9, characterized in that: The recommendation module includes: The first acquisition unit is configured to run the value function of the overall V and each U instance function based on trace+ast to obtain a usage attribute counter and a change attribute counter of the overall V value function and each U instance function with respect to an Infostate object; a construction unit, configured to construct a UV map based on the overlap between the usage attribute name of the usage attribute counter and the change attribute name of the change attribute counter; The second acquisition unit is configured to calculate the sum of the input edge weights of the U instance function nodes connected to the value function node of the overall V according to the UV graph to obtain a correlation calculation result; A recommendation unit is used to recommend the relevant U instance function according to the correlation calculation result.

11. The value-driven agent capability subset dynamic recommendation device according to claim 10, characterized in that: The first acquisition unit includes: Establish a subunit for establishing a node class StackNode for each call stack during a function call process; wherein the node class StackNode for each call stack includes at least an ast function definition node, all ast nodes indexed by code lines, and a parsed Infostate variable name; and establish a data structure StackInfo for each call stack; wherein the data structure StackInfo for each call stack includes at least a mapping relationship between an Infostate variable ID and an Infostate variable name, a mapping relationship between a local Infostate variable and an Infostate variable name, a flag indicating that an Infostate variable has changed, a usage attribute counter, and a change attribute counter; The first acquisition subunit is used to parse the source code of the UV function using Python's ast and inspect modules to obtain an ast-based tree structure; The statistics subunit is used to recursively count the usage and changes of Infostate variables in a single call stack using a tree structure; The second acquisition subunit is used to use the trace module to trace the usage and change of the Infostate variable in multiple call stacks to obtain a total usage attribute counter and a change attribute counter.

12. The value-driven agent capability subset dynamic recommendation device according to claim 10, characterized in that: The building blocks include: The third acquisition subunit, for the overall V value function and each U instance function, has a total usage attribute counter and a change attribute counter of the Infostate object, and uses the overall V value function and each U instance function as nodes in the graph; A construction subunit is used to establish a directed edge between two nodes when the same Infostate object attribute is used or changed between the two nodes, and the edge weight is the sum of the counts of all overlapping Infostate object attributes, thereby constructing the UV map.

13. The value-driven agent capability subset dynamic recommendation device according to claim 12, characterized in that: The recommendation unit is also used to calculate the sum of the edge weights of each incoming edge of the U instance function node connected to the value function node of the overall V according to the UV graph as the relevance score of the U instance function node; sort the relevance scores of all U instance function nodes, and recommend the TopN related U instance functions.

14. The value-driven dynamic recommendation device for agent capability subsets according to any one of claims 10 to 13, characterized in that: The device further comprises: A maintenance module, configured to maintain one or more U instance functions; wherein each U instance function corresponds to a specific capability of the agent; The modification module is used to modify one or more state parameters in an Infostate object when a U instance function is configured to be executed.

15. An electronic device comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.

17. A computer program product, characterized in that The computer program product comprises instructions which, when executed, cause a computer to perform the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Q-learning-based multi-agent initiative recommendation method for agriculture capital electronic commerce

    CN103914560A

  • MOM service code retrieval and recommendation method based on abstract syntax tree, computer program product and terminal

    CN118820396A