Dynamic evolution multi-agent project code question answering method, system and device
By generating temporary intelligent agents through semantic parsing of the target problem and dynamically evolving them, the problem of poor agent adaptability in existing systems is solved, and efficient processing of complex projects is achieved.
Patent Information
- Application Number
- CN202511508640.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-10-22
AI Technical Summary
Existing multi-agent project code question-answering systems cannot dynamically generate customized agents based on project context and question intent, resulting in poor agent adaptability and weak ability to handle specific problems in complex projects.
By semantically parsing the target question input by the user to generate task information, a temporary intelligent agent is dynamically generated and registered to the multifunctional sub-intelligent agent module. The agent executes the task instructions and determines whether the task has been fully executed. If the task has not been fully executed, the agent is dynamically evolved to update the module until the task is completed.
It improves the adaptability of intelligent agents and enhances their ability to handle specific problems in complex projects, ensuring that task instructions can be fully executed.
Smart Images

Figure CN120996206A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and particularly relates to a dynamic evolution multi-agent project code question and answer method, system and device. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, artificial intelligence technology is rapidly moving from experiments to applications at an astonishing speed and is profoundly changing various industries. Applying artificial intelligence technology in project development, developers only need to input project code questions, and intelligent agents can quickly generate corresponding project code answers, improving development efficiency.
[0003] At present, the existing multi-agent project code question and answer system supports multi-agent task decomposition and distribution, and can realize simple agent collaboration, but each agent is a predefined fixed type, cannot dynamically generate customized agents according to project context and problem intention, and only relies on text similarity retrieval to realize information reuse, and has limited cross-module semantic understanding ability.
[0004] Therefore, the predefined fixed type of multi-agent is prone to poor agent adaptability and weak special problem processing ability of complex projects. SUMMARY
[0005] The main purpose of the present application is to provide a dynamic evolution multi-agent project code question and answer method, system and device, which aims to solve the problems of poor agent adaptability and weak special problem processing ability of complex projects.
[0006] To achieve the above purpose, the present application provides a dynamic evolution multi-agent project code question and answer method, which comprises: performing semantic analysis on a target question input by a user to obtain task information, and sending the task information to an agent generator; obtaining a plurality of temporary agents generated by the agent generator according to the task information, and registering the plurality of temporary agents to a multi-functional sub-agent module; generating a task instruction according to the task information, and sending the task instruction to the multi-functional sub-agent module; obtaining an intermediate result generated by the multi-functional sub-agent module according to the task instruction; determining whether the task instruction is completely executed according to the intermediate result; when the task instruction is not completely executed, notifying the agent generator to dynamically evolve to update the multi-functional sub-agent module, and re-executing the step of sending the task instruction to the multi-functional sub-agent module; When the task instruction is completely executed, a target answer of the target question is generated according to the intermediate result.
[0007] In some embodiments, the semantic analysis of the target question input by the user obtains task information, including: Obtaining a target question input by a user; Inputting the target question into a routing agent; Receiving the task information obtained and output by the routing agent through semantic analysis of the target question.
[0008] In some embodiments, the generation of the task instruction according to the task information and the sending of the task instruction to the multi-functional sub-agent module include: Sending the task information to a central dispatcher; Obtaining the task instruction generated by the central dispatcher according to the task information; Sending the task instruction to the multi-functional sub-agent module.
[0009] In some embodiments, the multi-functional sub-agent module includes a plurality of resident agents, and the task instruction includes a plurality of sub-task instructions; the obtaining of the intermediate result generated by the multi-functional sub-agent module according to the task instruction includes: Obtaining the intermediate result generated by the multi-functional sub-agent module, wherein the intermediate result is generated by a plurality of temporary agents and a plurality of resident agents respectively executing corresponding sub-task instructions, or is generated by a plurality of temporary agents respectively executing corresponding sub-task instructions.
[0010] In some embodiments, the intermediate result includes a plurality of sub-intermediate results; the determination of whether the task instruction is completely executed according to the intermediate result includes: Determining whether each of the sub-task instructions has a corresponding sub-intermediate result; If there is a sub-task instruction without a corresponding sub-intermediate result, there is an unexecuted sub-task instruction, and it is determined that the task instruction is not completely executed; If all of the sub-task instructions have corresponding sub-intermediate results, there is no unexecuted sub-task instruction, and it is determined that the task instruction is completely executed.
[0011] In some embodiments, the notification of the agent generator to dynamically evolve to update the multi-functional sub-agent module includes: Generating a dynamic evolution instruction according to the unexecuted sub-task instruction; Sending the dynamic evolution instruction to the agent generator; obtaining a target temporary agent generated by the agent generator based on the dynamic evolution instruction; registering the target temporary agent to the multi-functional sub-agent module to update the multi-functional sub-agent module.
[0012] In some embodiments, the generating the target answer of the target question according to the intermediate result comprises: sending the intermediate result to a question and answer generation agent; obtaining the target answer generated by the question and answer generation agent based on the intermediate result.
[0013] In some embodiments, after the generating the target answer of the target question according to the intermediate result, the method further comprises: generating a visual reasoning report according to the intermediate result and the target answer.
[0014] The application further proposes a dynamic evolution multi-agent project code question and answer system, which comprises a control module, an agent generator and a multi-functional sub-agent module; the dynamic evolution multi-agent project code question and answer system can perform the dynamic evolution multi-agent project code question and answer method described in any of the above.
[0015] The application further proposes a dynamic evolution multi-agent project code question and answer device, which comprises: at least one processor; and a memory in communication connection with the at least one processor; wherein The memory stores instructions executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the dynamic evolution multi-agent project code question and answer method described in any of the above.
[0016] The technical scheme of the application generates a plurality of temporary agents corresponding to the task information obtained by the semantic analysis of the target question, registers the plurality of temporary agents to the multi-functional sub-agent module, generates a task instruction from the task information, and uses the task instruction to instruct the multi-functional sub-agent module to execute the task to obtain an intermediate result, and then determines whether the temporary agent needs to be dynamically evolved according to the intermediate result, so as to determine whether the temporary agent needs to be dynamically evolved when the task instruction is not completely executed. The multi-functional sub-agent module is updated to enable the multi-functional sub-agent module to completely execute the task instruction, thereby improving the adaptability of the agent and enhancing the special problem processing capability of the agent for complex projects. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1Flowchart of an embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 2 Flowchart of another embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 3 Flowchart of another embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 4 Flowchart of another embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 5 Flowchart of another embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 6 Flowchart of another embodiment of the method for answering questions about dynamically evolving multi-agent project code of the present application; Figure 7 Structure diagram of the system for answering questions about dynamically evolving multi-agent project code according to the embodiment of the present application; Figure 8 Structure diagram of the device for answering questions about dynamically evolving multi-agent project code according to the embodiment of the present application. DETAILED DESCRIPTION
[0018] The scheme in the embodiments of the present application will be described in detail below with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.
[0019] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present application are only used to explain the relative positional relationship, movement condition, etc. between components in a certain posture (as shown in the drawings), and if the certain posture changes, the directional indications will also change accordingly.
[0020] It should also be noted that when an element is referred to as being “fixed to” or “set on” another element, it can be directly on the other element or there can be a middle element. When an element is referred to as being “connected” to another element, it can be directly connected to the other element or there can be a middle element.
[0021] In addition, the descriptions involving "first", "second", and the like in the present application are only for the purpose of description, and cannot be understood as indicating or implying the relative importance of the technical features indicated or implying the number of technical features indicated. Therefore, the features defined as "first", "second" can be explicitly or implicitly included at least one of the features. In addition, the technical solutions of various embodiments can be combined with each other, but it must be based on the realization of ordinary skilled in the art, when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, nor within the protection scope required by the present application.
[0022] The present application proposes a dynamic evolution of multi-agent project code question and answer method, referring to Figure 1 and Figure 7 , Figure 1 The flowchart of an embodiment of the dynamic evolution of multi-agent project code question and answer method of the present application, Figure 7 The structural diagram of the dynamic evolution of multi-agent project code question and answer system involved in the embodiment scheme of the present application, in some embodiments, the dynamic evolution of multi-agent project code question and answer method includes: Step S110, the semantic analysis of the target problem input by the user is carried out to obtain task information, and the task information is sent to the agent generator; Step S120, a plurality of temporary agents generated by the agent generator according to the task information are obtained, and the plurality of temporary agents are registered to the multifunctional sub-agent module; Step S130, the task instruction is generated according to the task information, and the task instruction is sent to the multifunctional sub-agent module; Step S140, the intermediate result generated by the multifunctional sub-agent module according to the task instruction is obtained; Step S150, whether the task instruction is completely executed is judged according to the intermediate result; Step S160, when the task instruction is not completely executed, the agent generator is notified to dynamically evolve to update the multifunctional sub-agent module, and the step of sending the task instruction to the multifunctional sub-agent module is re-executed; Step S170, when the task instruction is completely executed, the target answer of the target problem is generated according to the intermediate result.
[0023] In the present embodiment, as shown in Figure 1 and Figure 7 The dynamic evolution of multi-agent project code question and answer method can be applied to the dynamic evolution of multi-agent project code question and answer system. The dynamic evolution of multi-agent project code question and answer system includes a control module, an agent generator and a multifunctional sub-agent module; the agent generator and the multifunctional sub-agent module are connected with the control module. In the present embodiment, the execution subject of the method steps is the control module.
[0024] It can be understood that the dynamically evolving multi-agent project code Q&A system also includes a routing agent, a central dispatcher and a Q&A generation agent; the routing agent, the central dispatcher and the Q&A generation agent are also connected with the control module. The control module is used to control the agent generator, the multifunctional sub-agent module, the routing agent, the central dispatcher and the Q&A generation agent. The agent generator can select a basic template from an agent template library based on task information, generate a temporary agent with customized functions, and support dynamic updating of the role of the agent. The multifunctional sub-agent module is used to register the temporary agent generated by the agent generator.
[0025] The dynamically evolving multi-agent project code Q&A system can also include a user interaction module, which is also connected with the control module; the user interaction module can provide two interactive modes of Web (webpage) and API (Application Programming Interface, application programming interface), the Web supports developers to input natural language questions, view Q&A results and reasoning reports, and feedback answer accuracy; the API supports integration of third-party tools (such as integrated development environment plug-ins), receives JSON format question requests, and returns JSON format answers and reasoning report links. The JSON format is a lightweight, easy-to-read and easy-to-write data exchange format, and the core role is to efficiently transfer and store data between different systems (such as front-end and back-end, different software).
[0026] When the user needs to use the dynamically evolving multi-agent project code Q&A system to ask questions about the code of the target project, the user can input the target question through the user interaction module, wherein the target question can be a question related to the code of the target project. After the user inputs the target question through the user interaction module, the control module can obtain the target question input by the user, and at this time, the control module can perform semantic analysis on the target question input by the user, thereby obtaining task information. After the control module obtains the task information, the control module can send the task information to the agent generator.
[0027] After the agent generator receives the task information, it can generate a customized temporary agent based on the task information. The agent generator can include an agent template library. The agent generator can query the agent template library according to the task information, so that the agent template library queries the corresponding basic template; and based on the basic template, the customized parameters are supplemented, thereby generating a temporary agent.
[0028] The agent generator can generate a plurality of temporary agents based on the task information. For example, the task information can include a plurality of steps (which can be regarded as sub-tasks) required to implement a task, and the agent generator can generate a temporary agent for each step in the task information to perform the step. That is, the number of temporary agents can be related to the number of steps in the task information, and the number of temporary agents can be less than or equal to the number of steps in the task information. For example, one temporary agent can perform two similar steps.
[0029] After the agent generator generates a plurality of temporary agents, the agent generator can output the plurality of temporary agents. At this time, the control module can obtain the plurality of temporary agents generated by the agent generator based on the task information. After obtaining the plurality of temporary agents, the control module can register the plurality of temporary agents in the multifunctional sub-agent module.
[0030] The control module can also generate a task instruction based on the task information and send the task instruction to the multifunctional sub-agent module to instruct the plurality of temporary agents in the multifunctional sub-agent module to perform corresponding tasks through the task instruction.
[0031] After the plurality of temporary agents in the multifunctional sub-agent module perform the corresponding tasks, an intermediate result can be obtained, and the multifunctional sub-agent module can output the intermediate result. At this time, the control module can obtain the intermediate result generated by the multifunctional sub-agent module based on the task instruction.
[0032] After the control module obtains the intermediate result, the control module can determine whether the task instruction is completely executed based on the intermediate result. For example, the task instruction can include a plurality of sub-task instructions (for example, the control module can generate corresponding sub-task instructions based on each step in the task information), and the intermediate result can include a plurality of sub-intermediate results. The control module can determine whether the task instruction is completely executed by determining whether each sub-task instruction has a corresponding sub-intermediate result. If all sub-task instructions have corresponding sub-intermediate results, it can be determined that the task instruction is completely executed. If not all sub-task instructions have corresponding sub-intermediate results, it can be determined that there are unexecuted sub-task instructions, and thus the task instruction is not completely executed.
[0033] When the task instruction is not completely executed, the control module can notify the agent generator to dynamically evolve to update the multifunctional sub-agent module and re-execute the step of sending the task instruction to the multifunctional sub-agent module. For example, when the task instruction is not completely executed, the control module can notify the agent generator to dynamically evolve according to the unexecuted sub-task instruction, so that the agent generator generates a new temporary agent, registers the temporary agent to the multifunctional sub-agent module to update the multifunctional sub-agent module, and finally re-executes the step of sending the task instruction to the multifunctional sub-agent module, so that the task instruction can be completely executed.
[0034] When the task instruction is completely executed, the control module can generate the target answer of the target question according to the intermediate result. For example, the control module can process each sub-intermediate result in the intermediate result by using a weighted aggregation algorithm to generate the target answer of the target question.
[0035] The technical scheme of the present application generates a plurality of temporary agents corresponding to the task information obtained by semantic analysis of the target question, registers the plurality of temporary agents to the multifunctional sub-agent module, generates a task instruction from the task information, and uses the task instruction to instruct the multifunctional sub-agent module to execute the task to obtain an intermediate result, and then determines whether the temporary agent needs to be dynamically evolved according to the intermediate result, so as to determine whether the temporary agent needs to be dynamically evolved when the task instruction is not completely executed, and update the multifunctional sub-agent module so that the multifunctional sub-agent module can completely execute the task instruction, thereby improving the adaptability of the agent and enhancing the agent's ability to process special problems of complex projects.
[0036] Reference Figure 2 , Figure 2 is a flowchart of another embodiment of the dynamic evolution multi-agent project code question and answer method of the present application. In some embodiments, the aforementioned semantic analysis of the target question input by the user to obtain task information includes: Step S180, obtaining a target question input by a user; Step S181, inputting the target question to a routing agent; Step S182, receiving task information obtained by the routing agent by semantic analysis of the target question and outputted by the routing agent.
[0037] In this embodiment, as Figure 2As shown, the control module can first acquire the target question input by the user when performing semantic analysis on the target question input by the user in step S110 to obtain task information. The router agent can be used for question semantic analysis, intent recognition and core entity extraction, thereby generating task information. The router agent can be configured with an LLM (Large Language Model). The control module can first acquire the target question input by the user, and then input the target question into the router agent.
[0038] After the router agent receives the target question, the router agent can call the LLM to perform semantic analysis on the target question. For example, if the target question is “config.yaml in the db_url parameter modification, which module configuration needs to be adjusted synchronously”, the router agent can call the LLM to perform semantic analysis on the target question from the question type, core entity, associated technology stack and question complexity, thereby obtaining: question type: configuration item influence range query; core entity: db_url parameter (entity type: configuration item), config.yaml file (entity type: configuration file); associated technology stack: Spring Boot (based on “config.yaml” and “module configuration” inference); question complexity: medium (cross-module tracing is required, involving configuration reference and dependency relationship); the integration of these data can obtain the question analysis result. In addition, the router agent can also call the project knowledge graph interface to query the association information of the core entities “db_url parameter” and “config.yaml file” in the project, such as “config.yaml belongs to Spring Boot configuration file, stored in the project root directory / config, and has been referenced by 3 Java files”, thereby obtaining the project knowledge association result. The router agent can encapsulate the question analysis result and the project knowledge association result into structured task information; and finally output the task information.
[0039] After the router agent outputs the task information, the control module can receive the task information obtained by the router agent by performing semantic analysis on the target question and outputted.
[0040] In a preferred embodiment, after the control module sends the task information to the agent generator, the agent generator can generate a plurality of temporary agents according to the task information.
[0041] For example, the agent generator can include an agent template library, and the agent template library can include a plurality of basic function templates, each basic function template including an applicable scenario, a core capability and an input / output format. For example, the basic function templates can include a configuration reference path analysis template and a module dependency tracking template.
[0042] Configuration reference path analysis template: applicable scenario "locate the reference position of the configuration item in the code", core capability "parse YAML / Properties configuration files and identify reference code files", input "configuration item name + configuration file path", output "list of reference files + reference position".
[0043] Module dependency tracking template: applicable scenario "analyze module dependencies", core capability "construct a module dependency graph based on Maven / Gradle dependency files and code call relationships", input "target file / class", output "module + dependent modules + dependent modules".
[0044] The agent generator matches two basic function templates based on the "problem type + core entity + associated technology stack" in the task information: "YAML configuration reference path analysis template" (adapted to YAML configuration file parsing) and "Spring Boot module dependency tracking template" (adapted to module dependency analysis for the Spring Boot technology stack).
[0045] The agent generator can generate two temporary agents based on the two matched basic function templates and additional customized parameters. For example, for the "YAML configuration reference path analysis template", the parameters "target configuration item: db_url", "configuration file path: config / config.yaml", and "supported file types:.java / .xml" are supplemented to generate the "db_url-YAML reference analysis agent". For the "Spring Boot module dependency tracking template", the parameters "target entity: Java file referencing db_url" and "dependency analysis depth: 2 levels (direct dependencies + indirect dependencies)" are supplemented to generate the "db_url-module dependency tracking agent".
[0046] After the agent generator generates the db_url-YAML reference analysis agent and the db_url-module dependency tracking agent, it can output these two temporary agents. At this time, the control module can obtain the two temporary agents generated by the agent generator based on the task information, and then register these two temporary agents in the multi-functional sub-agent module. For example, after obtaining the two temporary agents, the control module can assign unique IDs (Identifier, Identifier) to the db_url-YAML reference analysis agent and the db_url-module dependency tracking agent, and then register these two temporary agents in the available agent list in the multi-functional sub-agent module.
[0047] Referring to Figure 3 , Figure 3This is a flowchart illustrating another embodiment of the dynamically evolving multi-agent project code question-answering method of this application. In some embodiments, the aforementioned generation of task instructions based on task information and sending the task instructions to the multi-functional sub-agent module includes: Step S190: Send the task information to the central scheduler; Step S191: Obtain the task instructions generated by the central scheduler based on the task information; Step S192: Send the task instruction to the multifunctional sub-agent module.
[0048] In this embodiment, as Figure 3 As shown, when executing step S130, the control module can first send the task information to the central scheduler. The control module can also send the task information to the central scheduler, allowing the central scheduler to generate task instructions. The central scheduler can dynamically adjust the agent's calling, generation, and memory query strategies based on reinforcement learning, thereby optimizing task completion efficiency and answer accuracy.
[0049] The central scheduler can be pre-configured with a scheduling strategy model, which can be trained by the user and then configured onto the central scheduler. For example, users can collect "task information - scheduling information - feedback information" data from historical projects. Each data entry includes "system state (problem type, project size, agent state, memory state), execution action (invoked agent, whether a new agent is generated, memory query strategy), and reward value (task time, user feedback, resource consumption)". Then, the PPO (Proximal Policy Optimization) algorithm is used to train the scheduling strategy model. The input is a system state vector, and the output is an action probability distribution (e.g., "probability of calling agent A is 60%, probability of calling agent B is 30%, probability of generating a new agent is 10%"). During training, gradient descent is used to minimize the gap between "actual reward and expected reward," allowing the model to gradually learn optimal strategies such as "prioritizing the calling of configuration reference analysis agents and module dependency tracking agents for configuration item influence range queries". Finally, the trained model is deployed to the central scheduler, and the model configured on the central scheduler supports real-time inference and incremental training (the model is periodically updated with new "task information - scheduling information - feedback information" data).
[0050] After the central dispatcher receives the task information, it can call the scheduling strategy model to process the task information, thereby obtaining the task instruction. For example, the central dispatcher can also collect the current system state while receiving the task information: the problem type is "configuration item influence range query" (complexity medium), the project size is "5 modules, the number of files is greater than 100", the agent state is "available agents include db_url-YAML reference analysis Agent (low load, historical success rate 90%) and db_url-module dependency tracking Agent (low load, historical success rate 85%)", the memory bank state is "db_url related memory anchor point integrity 100%, recent query frequency low", and then the current system state is converted into a system state vector; then the system state vector is input into the scheduling strategy model, and the model outputs the optimal action: "invoke db_url-YAML reference analysis Agent and db_url-module dependency tracking Agent (parallel execution), and preferentially query the project memory bank structure graph layer and semantic understanding layer"; then the corresponding task instruction is generated according to these agents and the calling relationship, and the task instruction is output. At this time, the control module can obtain the task instruction generated by the central dispatcher according to the task information.
[0051] After the control module obtains the task instruction, it can send the task instruction to the multifunctional sub-agent module. The multifunctional sub-agent module is instructed to execute the task instruction by invoking the db_url-YAML reference analysis agent and the db_url-module dependency tracking agent registered in the multifunctional sub-agent module.
[0052] The central dispatcher can also monitor the task progress (such as "db_url-YAML reference analysis agent has completed 30%").
[0053] In some embodiments, the multifunctional sub-agent module includes a plurality of resident agents, and the task instruction includes a plurality of sub-task instructions; the aforementioned intermediate result generated by the multifunctional sub-agent module according to the task instruction includes: The intermediate result generated by the multifunctional sub-agent module, wherein the intermediate result is generated by a plurality of temporary agents and a plurality of resident agents respectively executing corresponding sub-task instructions, or is generated by a plurality of temporary agents respectively executing corresponding sub-task instructions.
[0054] In this embodiment, the control module can obtain the intermediate result generated by the multifunctional sub-agent module when executing step S140. The multifunctional sub-agent module can include a plurality of resident agents and a plurality of temporary agents, and the task instruction includes a plurality of sub-task instructions. The dynamically evolved multi-agent project code question and answer system further includes a project memory bank, and the multifunctional sub-agent module can directly query the project memory bank.
[0055] Among them, the project memory library can be a structured memory storage module dedicated to the target project, including a structural graph layer (graph database), a semantic understanding layer (vector database), and an interaction history layer (relational database), each layer containing memory anchors and associated relationships.
[0056] Temporary agents in the multifunctional sub-agent module cooperate with basic resident agents to execute task instructions, or temporary agents in the multifunctional sub-agent module execute task instructions. When the agents in the multifunctional sub-agent module execute task instructions, they need to query the "project memory library" (such as obtaining module dependency relationships and configuration reference paths). When the project memory library receives a query request from an agent, it can traverse the cross-layer graph of memory anchors (structural graph layer → semantic understanding layer → interaction history layer), and then return the matching structured memory data (such as the list of affected modules and configuration associated files); After the agent gets the memory data, it can analyze the memory data to generate intermediate results.
[0057] For example, when the target project accesses the dynamic evolution of the multi-agent project code question and answer system, it can trigger the construction task of the project memory library, and the basic resident agent can execute it. For example, the basic resident agent can include a structural graph construction agent and a semantic description generation agent.
[0058] Structural graph construction agent: parse the code of the target project to generate class inheritance graph, method call graph, and module dependency graph, such as: parsing the user-management project, identifying that the "user module contains UserService class, User Dao class, UserService class inherits BaseService class, User Dao class calls getUserById method", and storing these relationships in Neo4j graph database, each node (class, method, module) is assigned a memory anchor (such as "user.module.UserService").
[0059] Semantic description generation agent: generate natural language descriptions for core code entities, such as: for the "getUserById (Long id)" method of the User Dao class, generate "input user ID, query user table, return User object, dependent on db_url configuration data source", and convert the description to a vector through the CodeBERT model, and store it in the Milvus vector database, the vector is associated with the corresponding memory anchor.
[0060] For example, "which modules are affected by the query db_url parameter", the process is as follows: The "db_url-YAML reference analysis intelligent agent" sends a query request to the project memory bank, carrying the core entity "db_url" and the entity type "configuration item". The project memory bank matches the memory anchor point (config.item.db_url) of "db_url" at the semantic understanding layer and returns the associated information of the anchor point (associated configuration file anchor point: config.file.config.yaml; associated reference file anchor point: user.dao.UserDao, order.dao.OrderDao). After receiving the associated information, the "db_url-module dependency tracking intelligent agent" queries the module to which the "user.dao.UserDao" anchor point belongs. The memory bank traverses the "module edge" of the "user.dao.UserDao" anchor point at the structural graph layer and returns the "module anchor point: user.module". Similarly, the "order.dao.OrderDao" anchor point is queried, and the "module anchor point: order.module" is returned. The project memory bank further queries the dependent modules of "user.module" and "order.module" and returns "user.module has no dependent modules, and order.module depends on payment.module". Finally, a complete influence range memory chain is formed: "db_url→config.yaml→UserDao / OrderDao→user.module / order.module→payment.module".
[0061] When the temporary intelligent agents and the resident intelligent agents execute the corresponding sub-task instructions and generate corresponding sub-intermediate results, the multifunctional sub-intelligent agent module can integrate these sub-intermediate results to form an intermediate result. Or when the temporary intelligent agents execute the corresponding sub-task instructions and generate corresponding sub-intermediate results, the multifunctional sub-intelligent agent module can integrate these sub-intermediate results to form an intermediate result. Then the multifunctional sub-intelligent agent module outputs the intermediate result, at which time the control module can obtain the intermediate result generated by the multifunctional sub-intelligent agent module.
[0062] When the code of the target project is modified (such as adding a configuration file or modifying a method call relationship) or a new question and answer session is generated, the control module can trigger the project memory bank to update. When the code is modified: the structural graph construction intelligent agent and the semantic description generation intelligent agent reparse the modified files and update the corresponding memory anchor points and associated relationships. When a new question and answer session is generated: the interaction history layer automatically stores the session record and associates the relevant memory anchor points.
[0063] Referring to Figure 4 , Figure 4This is a flowchart illustrating another embodiment of the dynamically evolving multi-agent project code question-answering method of this application. In some embodiments, intermediate results include multiple sub-intermediate results; the aforementioned determination of whether the task instruction has been fully executed based on the intermediate results includes: Step S200: Determine whether each subtask instruction has a corresponding intermediate sub-result; Step S201: If there is a subtask instruction that does not have a corresponding intermediate result, then there is an unexecuted subtask instruction, and it is determined that the task instruction has not been fully executed. Step S202: If all subtask instructions have corresponding intermediate results, then there are no unexecuted subtask instructions, and the task instructions are determined to be fully executed.
[0064] In this embodiment, as Figure 4 As shown, when the control module executes step S150, it can first determine whether each subtask instruction has a corresponding intermediate result. If a subtask instruction does not have a corresponding intermediate result, the control module can determine that there are unexecuted subtask instructions, thus determining that the task instruction has not been fully executed. If all subtask instructions have corresponding intermediate results, the control module can determine that there are no unexecuted subtask instructions, thus determining that the task instruction has been fully executed.
[0065] For example, if the "db_url-YAML reference analysis agent" returns a message after executing a subtask instruction stating "Three Java files referencing db_url have been located, among which UserDao.java and OrderDao.java involve MyBatis data source configuration, and the 'db_url-YAML reference analysis agent' cannot parse the MyBatis configuration logic," then it cannot output the intermediate sub-result. When the control module determines whether each subtask instruction has a corresponding intermediate sub-result, it can determine that the subtask instruction executed by the "db_url-YAML reference analysis agent" does not have a corresponding intermediate sub-result, thus confirming that there are unexecuted subtask instructions and that the task instruction has not been fully executed.
[0066] Reference Figure 5 , Figure 5 This is a flowchart illustrating another embodiment of the dynamically evolving multi-agent project code question-answering method of this application. In some embodiments, the aforementioned notification agent generator dynamically evolves to update the multi-functional sub-agent module, including: Step S210: Generate dynamic evolution instructions based on the unexecuted subtask instructions; Step S211: Send the dynamic evolution command to the agent generator; Step S212, the agent generator generates the target temporary agent based on the dynamic evolution instruction; Step S213, the target temporary agent is registered to the multi-functional sub-agent module to update the multi-functional sub-agent module.
[0067] In this embodiment, as shown in Figure 5 When the control module executes the step S160 of notifying the agent generator to dynamically evolve to update the multi-functional sub-agent module, the control module can first generate the dynamic evolution instruction according to the unexecuted sub-task instruction. The control module can first generate the dynamic evolution instruction according to the unexecuted sub-task instruction; and then send the dynamic evolution instruction to the agent generator. For example, the control module can generate the dynamic evolution instruction according to the sub-task instruction corresponding to the unexecuted “db_url-YAML reference analysis agent”, and the dynamic evolution instruction can include the instruction of expanding the “db_url-YAML reference analysis agent” capability to the technology of locating the db_url reference position + identifying the technical type (such as MyBatis / ordinary Java) of the reference file, and the instruction of generating the “MyBatis data source configuration analysis agent”. After the control module generates the dynamic evolution instruction, the control module can send the dynamic evolution instruction to the agent generator.
[0068] After the agent generator receives the dynamic evolution instruction, the agent generator can execute the dynamic evolution instruction to generate the target temporary agent. For example, the agent generator can dynamically evolve the “db_url-YAML reference analysis agent” according to the instruction of expanding the “db_url-YAML reference analysis agent” capability to the technology of locating the db_url reference position + identifying the technical type (such as MyBatis / ordinary Java) of the reference file, so as to update the configuration parameters of the “db_url-YAML reference analysis agent” to obtain a new “db_url-YAML reference analysis agent”. The agent generator can also generate the “MyBatis data source configuration analysis agent” according to the instruction of generating the “MyBatis data source configuration analysis agent”; and then output the new “db_url-YAML reference analysis agent” and the “MyBatis data source configuration analysis agent” as the target temporary agent.
[0069] After the agent generator outputs the target temporary agent, the control module can obtain the target temporary agent generated by the agent generator based on the dynamic evolution instruction; and then register the target temporary agent to the multi-functional sub-agent module to update the multi-functional sub-agent module.
[0070] After the multi-functional sub-agent module is updated, the control module can re-execute the step of sending the task instruction to the multi-functional sub-agent module. So that the "db_url-YAML reference analysis agent", "db_url-module dependency tracking agent" and "MyBatis data source configuration analysis agent" in the multi-functional sub-agent module can re-execute the task instruction, and finally output the complete intermediate result.
[0071] Referring to Figure 6 , Figure 6 The flowchart of another embodiment of the dynamic evolution multi-agent project code question and answer method of the present application, in some embodiments, the aforementioned target answer generated according to the intermediate result includes: Step S220, sending the intermediate result to the question and answer generation agent; Step S221, obtaining the target answer generated by the question and answer generation agent based on the intermediate result.
[0072] In this embodiment, as shown in Figure 6 , when the control module executes step S170, it can first send the intermediate result to the question and answer generation agent. The question and answer generation agent can receive the intermediate result and the memory library query result, and generate a structured target answer according to the explainable inference report template. The control module can also obtain the memory library query result obtained by the agent in the multi-functional sub-agent module when querying the project memory library; and then send the memory library query result and the intermediate result to the question and answer generation agent.
[0073] The question and answer generation agent can generate the target answer according to the memory bank query result and the intermediate result. For example, the intermediate result includes "db_url is referenced in UserDao.java (line 23), OrderDao.java (line 18), and PaymentDao.java (line 25)" output by the db_url-YAML reference analysis agent, and "UserDao belongs to the user module, OrderDao belongs to the order module, PaymentDao belongs to the payment module, and the order module depends on the payment module" output by the db_url-module dependency tracking agent. The memory bank query result includes the association of db_url with the Spring Boot data source configuration, and the application needs to be restarted after modification. The question and answer generation agent can generate the target answer "after the modification of the db_url parameter, the affected modules are the user module (associated with UserDao), the order module (associated with OrderDao), and the payment module (associated with PaymentDao and dependent on the order module), and the Spring Boot application needs to be restarted after modification" through a weighted aggregation algorithm (intermediate result weight 0.7, memory query result weight 0.3).
[0074] After the question and answer generation agent generates the target answer, the target answer can be output. At this time, the control module can obtain the target answer generated by the question and answer generation agent based on the intermediate result.
[0075] In some embodiments, after the aforementioned generation of the target answer of the target question according to the intermediate result, the method further includes: generating a visual reasoning report according to the intermediate result and the target answer.
[0076] In this embodiment, after the control module performs step S170, the control module can further generate a visual reasoning report according to the intermediate result and the target answer. The control module can generate a visual reasoning report according to the intermediate result and the target answer.
[0077] For example, the control module can call the visualization tool to generate an agent collaboration flowchart, the nodes are "routing agent", "db_url-YAML reference analysis agent", "db_url-module dependency tracking agent", "question and answer generation agent", and the edges are the calling relationship, and each agent is marked with execution time (such as "db_url-YAML reference analysis agent execution time 3 seconds") and contribution degree (such as "db_url-module dependency tracking agent contribution degree 60%"); then a memory anchor traversal flowchart is generated to show the association path of "db_url anchor→config.yaml file anchor→UserDao / OrderDao / PaymentDao class anchor→user / order / payment module anchor", and each anchor is marked with a query result (such as "UserDao class anchor: 23rd line references db_url"); the result fusion logic is explained: the fusion process is described in natural language, such as "intermediate result (weight 0.7) and memory bank query result (weight 0.3), wherein, the intermediate result determines the affected module list, the memory bank query result applies the restart requirement, and finally a visual reasoning report is generated.
[0078] The technical scheme of the application generates a plurality of temporary agents according to the task information obtained by semantic analysis of the target problem, registers the plurality of temporary agents to the multifunctional sub-agent module, generates a task instruction from the task information, and uses the task instruction to instruct the multifunctional sub-agent module to execute the task to obtain an intermediate result, and then determines whether the temporary agent needs to be dynamically evolved according to the intermediate result, so as to determine whether the temporary agent needs to be dynamically evolved when the task instruction is not completely executed, and update the multifunctional sub-agent module to enable the multifunctional sub-agent module to completely execute the task instruction, thereby improving the adaptability of the agent and enhancing the special problem processing capability of the agent for complex projects.
[0079] The application further provides a dynamically evolved multi-agent project code question and answer system, which is described in detail in the embodiments of the application. Figure 7 , Figure 7 The application further provides a dynamically evolved multi-agent project code question and answer system, which is described in detail in the embodiments of the application.
[0080] In this embodiment, the dynamically evolved multi-agent project code question and answer system is described in detail in the embodiments of the application. Figure 7, the dynamic evolution multi-agent project code Q & A system includes a control module, an agent generator and a multifunctional sub-agent module; the agent generator and the multifunctional sub-agent module are connected with the control module. The dynamic evolution multi-agent project code Q & A system further includes a routing agent, a central dispatcher and a Q & A generation agent; the routing agent, the central dispatcher and the Q & A generation agent are also connected with the control module. The control module is used to control the agent generator, the multifunctional sub-agent module, the routing agent, the central dispatcher and the Q & A generation agent. The agent generator can select a basic template from an agent template library based on task information, generate a temporary agent with customized functions, and support dynamic updating of the role of the agent. The multifunctional sub-agent module is used to register the temporary agent generated by the agent generator.
[0081] The application further provides a dynamic evolution multi-agent project code Q & A device, referring to Figure 8 , Figure 8 The application further provides a dynamic evolution multi-agent project code Q & A device, referring to at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the dynamic evolution multi-agent project code Q & A method described in any one of the above.
[0082] In this embodiment, referring to Figure 8 , the dynamic evolution multi-agent project code Q & A device of the application embodiment can be a processor capable of running the dynamic evolution multi-agent project code Q & A method; the processor has at least one. As Figure 8As shown, the dynamic evolving multi-agent project code Q&A device can include a processor 1001 (such as a CPU), a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the components. The user interface 1003 can include a display screen (Display), an input unit such as a keyboard (Keyboard), and can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1005 can be a high-speed RAM memory, or a stable memory (non-volatile memory) such as a disk memory. The memory 1005 can also be a storage device independent of the aforementioned processor 1001.
[0083] Those skilled in the art can understand that Figure 8 The dynamic evolving multi-agent project code Q&A device structure shown in the figure does not constitute a limitation on the dynamic evolving multi-agent project code Q&A device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.
[0084] As Figure 8 As shown, the memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a computer program.
[0085] In Figure 8 In the dynamic evolving multi-agent project code Q&A device shown, the network interface 1004 is mainly used to connect the background server and communicate data with the background server; the user interface 1003 is mainly used to connect the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program stored in the memory 1005, and the computer program is executed by the processor 1001 to realize the steps of the dynamic evolving multi-agent project code Q&A method described above.
[0086] The above only describes some or preferred embodiments of the present application, neither the text nor the drawings can limit the scope of protection of the present application, any equivalent structural transformation using the contents of the present application specification and drawings, or direct / indirect application in other related technical fields are included in the scope of protection of the present application.
Claims
1. A dynamically evolving multi-agent project code question-answering method, characterized in that, The dynamically evolving multi-agent project code question-and-answer method includes: The user-input target question is semantically parsed to obtain task information, and the task information is sent to the intelligent agent generator; Obtain several temporary intelligent agents generated by the intelligent agent generator based on the task information, and register the several temporary intelligent agents to the multi-functional sub-intelligent agent module; Based on the task information, a task instruction is generated and sent to the multifunctional sub-intelligent agent module; Obtain the intermediate results generated by the multifunctional sub-agent module according to the task instructions; Based on the intermediate results, determine whether the task instruction has been fully executed; If the task instruction is not fully executed, the agent generator is notified to dynamically evolve in order to update the multifunctional sub-agent module, and the step of sending the task instruction to the multifunctional sub-agent module is re-executed. When the task instruction is fully executed, the target answer to the target question is generated based on the intermediate results.
2. The dynamically evolving multi-agent project code question-answering method according to claim 1, characterized in that, The process of semantically parsing the user-input target question to obtain task information includes: The target problem for obtaining user input; Input the target problem into the routing agent; The task information is received by the routing agent after semantic parsing of the target problem.
3. The dynamically evolving multi-agent project code question-answering method according to claim 1, characterized in that, The step of generating a task instruction based on the task information and sending the task instruction to the multifunctional sub-agent module includes: The task information is sent to the central scheduler; Obtain the task instructions generated by the central scheduler based on the task information; The task instruction is sent to the multifunctional sub-smart agent module.
4. The dynamically evolving multi-agent project code question-answering method according to claim 1, characterized in that, The multifunctional sub-agent module includes several resident agents, and the task instruction includes multiple sub-task instructions; obtaining the intermediate results generated by the multifunctional sub-agent module according to the task instruction includes: Obtain the intermediate results generated by the multifunctional sub-agent module, wherein the intermediate results are generated by a plurality of temporary agents and a plurality of permanent agents respectively executing the corresponding sub-task instructions, or by a plurality of temporary agents respectively executing the corresponding sub-task instructions.
5. The dynamically evolving multi-agent project code question-answering method according to claim 4, characterized in that, The intermediate results include multiple sub-intermediate results; determining whether the task instruction has been fully executed based on the intermediate results includes: Determine whether each of the subtask instructions has a corresponding sub-intermediate result; If there is a subtask instruction that does not have a corresponding intermediate result, then there is an unexecuted subtask instruction, and it is determined that the task instruction has not been fully executed. If all the subtask instructions have corresponding intermediate results, then there are no unexecuted subtask instructions, and the task instructions are determined to be fully executed.
6. The dynamically evolving multi-agent project code question-answering method according to claim 5, characterized in that, The notification to the agent generator to dynamically evolve in order to update the multifunctional sub-agent module includes: Generate dynamic evolution instructions based on the unexecuted subtask instructions; The dynamic evolution command is sent to the agent generator; Obtain the target temporary intelligent agent generated by the intelligent agent generator based on the dynamic evolution instruction; The target temporary agent is registered to the multifunctional sub-agent module to update the multifunctional sub-agent module.
7. The dynamically evolving multi-agent project code question-answering method according to claim 1, characterized in that, The step of generating the target answer to the target question based on the intermediate results includes: The intermediate results are sent to the question-answering generation agent; Obtain the target answer generated by the question-and-answer generation agent based on the intermediate results.
8. The dynamically evolving multi-agent project code question-answering method according to claim 7, characterized in that, After generating the target answer to the target question based on the intermediate results, the process further includes: A visual reasoning report is generated based on the intermediate results and the target answer.
9. A dynamically evolving multi-agent project code question-answering system, characterized in that, The dynamically evolving multi-agent item code question-answering system includes a control module, an agent generator, and a multi-functional sub-agent module; the dynamically evolving multi-agent item code question-answering system is capable of executing the dynamically evolving multi-agent item code question-answering method according to any one of claims 1 to 8.
10. A dynamically evolving multi-agent project code question-and-answer device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that are executed by the at least one processor to enable the at least one processor to perform the dynamically evolving multi-agent project code question-answering method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Interactive question and answer task processing method based on multi-agent cooperation and related device
CN119537542A
Multi-agent internal biochemical model training method and system
CN120654765A
Multi-agent system-based information processing method and multi-agent system
WO2025148684A1