Software file generation method and device, storage medium and electronic device
By using a hierarchical agent framework and long-term memory information summarization, the problems of incoherent context and unsmooth interaction in multi-agent collaborative systems are solved, achieving contextual coherence and robust interaction in complex software development tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING CHANGAN AUTOMOBILE CO LTD
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies in multi-agent collaborative systems suffer from problems such as long-term context memory loss, non-smooth interaction patterns, fragile integration of tools and services, and limited agent architecture, leading to incoherent context and fragmented interactive experiences in complex software development tasks.
A hierarchical agent framework is adopted, which obtains long-term memory information through the main agent, decomposes the task into multiple intelligent agents for execution, and extracts the dialogue history into a summary through a summary generation model. Combined with dynamic toolsets and real-time verification, a complete closed loop is formed from long-term memory to intelligent planning and execution.
It effectively overcomes the limitations of language model context windows, achieves contextual coherence in long development sessions, improves the ability to plan and solve complex problems, and provides a robust interactive experience and tool integration.
Smart Images

Figure CN121858083B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a method and apparatus for generating software files, a storage medium, and an electronic device. Background Technology
[0002] In related technologies, with the rapid development of large language models (LLM), automated task processing systems based on multi-agent collaboration have become a research hotspot, aiming to address the limitations of a single agent in handling complex problems.
[0003] Existing technologies have primarily explored the following directions: Multi-agent collaboration frameworks based on task decomposition and delegation: The core idea of this type of technology is to analyze and decompose the user's initial task through a master agent or scheduling agent, and then assign different sub-tasks to sub-agents with specific capabilities for execution. Enhanced interactive and intervention-based task execution processes: To address the "black box" problem of automated task flows, some technologies have introduced manual intervention mechanisms. Iterative optimization combining external knowledge and internal verification: To improve the accuracy of generated content, some solutions have introduced external knowledge bases or internal verification loops.
[0004] Despite advancements in task decomposition, manual intervention, and iterative correction, existing technologies still commonly suffer from one or more of the following technical problems: Long-term contextual memory loss: Most existing systems fail to effectively address the inherent context window length limitations of large language models. In complex software engineering tasks involving multiple rounds and long durations, systems easily "forget" early critical decisions and contextual information, leading to inconsistent subsequent behaviors. Rigid, interruptible interaction patterns: User interaction and intervention largely rely on interruptible processes such as "pause-operate-resume," which are not smooth or natural and lack a unified, consistent asynchronous communication mechanism to transmit status and results. Static, fragile tool and service integration: Existing systems often rely on hard-coded or statically configured dependencies on external tools and services, which are unreliable in complex real-world development environments. Limited agent architecture: Most multi-agent systems have a relatively flat hierarchical structure, with one scheduler managing multiple executors. They lack a recursive, hierarchical architecture capable of re-encapsulating a complete agent with its own set of capabilities into a capability unit (Tool) for another upper-level agent, limiting their ability to handle nested complex problems.
[0005] No efficient and accurate solution has yet been found to address the aforementioned issues in the relevant technologies. Summary of the Invention
[0006] This invention provides a method and apparatus for generating software files, a storage medium, and an electronic device to solve technical problems in related technologies.
[0007] According to an embodiment of the present invention, a method for generating a software file is provided, comprising: receiving software development instructions in a session window; activating the main agent of a hierarchical proxy framework, wherein the hierarchical proxy framework includes the main agent and multiple layers of agents, each layer being called by the parent agent of the upper layer and calling the child agent of the lower layer, and each agent being encapsulated as a capability unit that can be called by the upper layer agent; obtaining long-term memory information of the software development instructions through the main agent; calling multiple agents in the hierarchical proxy framework for the software development instructions according to the long-term memory information; executing the multiple agents and outputting the software file corresponding to the software development instructions.
[0008] Optionally, obtaining the long-term memory information of the software development instruction through the main agent includes: obtaining the summary message field of the current session record of the session window through the main agent; determining whether the summary message field is empty; if the summary message field is empty, obtaining all historical messages of the session window to obtain a historical message list; adding a system instruction to the end of the historical message list, wherein the system instruction is used to instruct the generation of a summary of key information required to continue the current dialogue of the software development instruction; inputting the historical message list and the system instruction into the summary generation model, outputting the long-term memory information of the software development instruction, and generating a field identifier of the long-term memory information in the summary message field, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
[0009] Optionally, after determining whether the summary message field is empty, the method further includes: if the summary message field is not empty, locating the start position pointer of the valid context of the current session record based on the field identifier in the summary message field; reading historical summary messages from the position pointed to by the start position pointer, and reading the latest historical message after the position pointed to by the start position pointer; and generating long-term memory information of the software development instructions using the historical summary messages and the latest historical messages.
[0010] Optionally, before obtaining the long-term memory information of the software development instructions through the main agent, the method further includes: counting the total number of tokens for all historical messages of the session window, and monitoring the pause duration of the session window after the end of the last interaction round; determining whether the total number of tokens exceeds the safety threshold of the language model context window capacity, and determining whether the pause duration exceeds a preset duration; if the total number of tokens exceeds the safety threshold of the language model context window capacity, or the pause duration exceeds the preset duration, generating and storing the long-term memory information.
[0011] Optionally, invoking multiple agents in the layered proxy framework for the software development instructions based on the long-term memory information includes: parsing the macro-task corresponding to the software development instructions based on the long-term memory information; decomposing the macro-task into multiple first sub-tasks of the highest level that are executed sequentially; iteratively executing the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or execution failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks of the next level; and invoking agents in the layered proxy framework for sub-tasks at all levels respectively.
[0012] Optionally, invoking the agents in the hierarchical proxy framework for each subtask at all levels includes: for the first subtask at the highest level, searching for a matching agent in the hierarchical proxy framework; determining a target subtask that includes multiple lower-level subtasks in the first subtask, and determining a second subtask of the target subtask, wherein the second subtask is a lower-level subtask of the target subtask; controlling the agent of the target subtask to send a call request to the lower-level subtask, wherein the call request contains a description string of the task to be executed by the agent of the lower-level proxy; for each lower-level subtask of the target subtask, creating a task session between the target subtask and the lower-level subtask, wherein the task session is used to return the output of the lower-level subtask to the corresponding parent agent, and read the computational cost generated by the lower-level subtask, and add the computational cost to the total cost field of the corresponding parent agent; activating the child agent matched by the lower-level subtask in the hierarchical proxy framework, and passing the call request and the session identifier of the task session to the child agent.
[0013] Optionally, executing the plurality of intelligent agents to output the software file corresponding to the software development instructions includes: constructing a dynamic toolset for the software development instructions based on the long-term memory information; determining the target intelligent agent to be executed according to the execution order of the plurality of intelligent agents; after the target intelligent agent completes its execution, obtaining the task result output by the target intelligent agent; controlling the main agent to call a third-party service from the dynamic toolset to verify the task result in real time, and determining whether the task result has passed the verification; if the task result fails the verification, controlling the target intelligent agent to re-execute the task until the task result passes the verification; after the task result passes the verification, passing the task result to the next intelligent agent, until the last intelligent agent, and determining the task result output by the last intelligent agent as the software file corresponding to the software development instructions.
[0014] Optionally, after determining the target agent to be executed according to the execution order of the plurality of agents, the method further includes: triggering the state update function of the state machine of the target agent and updating the current state of the target agent; publishing the current state to the central event bus; and controlling the central event bus to transmit the current state to the associated agents of the target agent through a publish-subscribe communication link.
[0015] According to another embodiment of the present invention, a software file generation apparatus is provided, comprising: a receiving module for receiving software development instructions in a session window; an activation module for activating the main agent of a layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer being called by the parent agent of the upper layer and calling the child agent of the lower layer, and each agent being encapsulated as a capability unit that can be called by the upper layer agent; an acquisition module for acquiring long-term memory information of the software development instructions through the main agent; an invocation module for invoking multiple agents in the layered proxy framework according to the long-term memory information for the software development instructions; and an output module for executing the multiple agents and outputting the software file corresponding to the software development instructions.
[0016] Optionally, the acquisition module includes: a first acquisition unit, configured to acquire the summary message field of the current session record of the session window through the main agent; a judgment unit, configured to determine whether the summary message field is empty; a second acquisition unit, configured to acquire all historical messages of the session window if the summary message field is empty, and obtain a historical message list; an addition unit, configured to add a system instruction to the end of the historical message list, wherein the system instruction is used to instruct the generation of a summary of key information required to continue the current dialogue of the software development instruction; and an output unit, configured to input the historical message list and the system instruction into the summary generation model, output the long-term memory information of the software development instruction, and generate a field identifier of the long-term memory information in the summary message field, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
[0017] Optionally, the acquisition module further includes: a positioning unit, configured to locate the start position pointer of the valid context of the current session record based on the field identifier in the summary message field if the summary message field is not empty after the judgment unit determines whether the summary message field is empty; a reading unit, configured to read historical summary messages from the position pointed to by the start position pointer, and read the latest historical messages after the position pointed to by the start position pointer; and a generation unit, configured to generate long-term memory information of the software development instructions using the historical summary messages and the latest historical messages.
[0018] Optionally, the device further includes: a processing module, configured to count the total number of tokens for all historical messages of the session window and monitor the pause duration of the session window after the last interaction round before the acquisition module acquires the long-term memory information of the software development instructions through the main agent; a judgment module, configured to determine whether the total number of tokens exceeds a safety threshold of the language model context window capacity and whether the pause duration exceeds a preset duration; and a generation module, configured to generate and store the long-term memory information if the total number of tokens exceeds the safety threshold of the language model context window capacity or the pause duration exceeds the preset duration.
[0019] Optionally, the invocation module includes: a parsing unit, configured to parse the macro-task corresponding to the software development instruction based on the long-term memory information; a decomposition unit, configured to decompose the macro-task into multiple first sub-tasks of the highest level executed sequentially; an iteration unit, configured to iteratively execute the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or execution failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks at the next level; and an invocation unit, configured to invoke the agent in the hierarchical proxy framework for each sub-task at all levels.
[0020] Optionally, the invocation unit includes: a search subunit, used to search for a matching agent in the hierarchical proxy framework for the first subtask at the highest level; a determination subunit, used to determine a target subtask that includes multiple lower-level subtasks in the first subtask, and to determine a second subtask of the target subtask, wherein the second subtask is a lower-level subtask of the target subtask; a control subunit, used to control the agent of the target subtask to send an invocation request to the lower-level subtask, wherein the invocation request contains a description string of the task to be executed by the agent of the lower-level proxy; a creation subunit, used to create a task session between the target subtask and the lower-level subtask for each lower-level subtask of the target subtask, wherein the task session is used to return the output result of the lower-level subtask to the corresponding parent agent, and read the computational cost generated by the lower-level subtask, and add the computational cost to the total cost field of the corresponding parent agent; and an input subunit, used to activate the child agent matched by the lower-level subtask in the hierarchical proxy framework, and input the invocation request and the session identifier of the task session to the child agent.
[0021] Optionally, the output module includes: a construction unit, configured to construct a dynamic toolset for the software development instructions based on the long-term memory information; a determination unit, configured to determine the target agent currently executing according to the execution order of the multiple agents; an acquisition unit, configured to acquire the task result output by the target agent after the target agent completes execution; a verification unit, configured to control the main agent to call a third-party service from the dynamic toolset to verify the task result in real time, and determine whether the task result passes verification; and an output unit, configured to control the target agent to re-execute the task if the task result fails verification, until the task result passes verification; after the task result passes verification, the task result is passed to the next agent, until the last agent, and the task result output by the last agent is determined as the software file corresponding to the software development instructions.
[0022] Optionally, the output module further includes: an update unit, configured to trigger the state update function of the state machine of the target intelligent agent and update the current state of the target intelligent agent after the determining unit determines the target intelligent agent to be executed according to the execution order of the plurality of intelligent agents; a publishing unit, configured to publish the current state to the central event bus; and a transmission unit, configured to control the central event bus to transmit the current state to the associated intelligent agents of the target intelligent agent through a publish-subscribe communication link.
[0023] According to another aspect of the embodiments of this application, a storage medium is also provided, the storage medium including a stored program that executes the above steps when the program is run.
[0024] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the programs stored in the memory.
[0025] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the above-described method.
[0026] The beneficial effects of this invention are:
[0027] 1. This paper presents a hierarchical proxy architecture where a master proxy can delegate complex tasks to one or more specialized sub-proxies. Each sub-proxygen is itself a fully functional AI instance, but it is encapsulated as a "capability unit" that can be invoked by the parent proxy. This recursive and composable structure enables the method to effectively decompose large and fuzzy tasks into specific and executable sub-tasks, thereby significantly improving its ability to plan and solve complex problems.
[0028] 2. Provides an advanced conversation summarization mechanism, which serves as an efficient long-term memory solution. It can extract a concise summary containing key contextual information from a lengthy conversation history and inject it as a "memory" into subsequent conversations. This effectively overcomes the limitations of the language model's context window, enabling the AI assistant to maintain contextual coherence during long development conversations.
[0029] 3. Provides a collaborative software development assistance system. Long-term memory information provides historical basis for the planning of layered agents. Layered agents decompose the planning into actions executed by dynamic toolsets. The real-time verification capability of the toolsets provides immediate feedback on the agent's actions. The unified event architecture binds all of this together asynchronously and decoupledly, forming a complete intelligent closed loop from long-term memory -> intelligent planning -> robust execution -> real-time verification. This fundamentally solves the core pain points of inconsistent context, fragile toolchains, and fragmented interactive experience in complex software development tasks. Attached Figure Description
[0030] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0031] Figure 1 This is a hardware structure block diagram of a computer according to an embodiment of the present invention;
[0032] Figure 2 This is a flowchart of a method for generating software files according to an embodiment of the present invention;
[0033] Figure 3 This is a flowchart of context recovery in an embodiment of the present invention;
[0034] Figure 4 This is a flowchart of layered proxy invocation in an embodiment of the present invention;
[0035] Figure 5 This is a flowchart of the collaborative working mechanism in an embodiment of the present invention;
[0036] Figure 6This is a structural block diagram of a software file generation apparatus according to an embodiment of the present invention. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0039] Example 1
[0040] The method embodiment provided in Embodiment 1 of this application can be executed in a server, processor, computer, or similar processing device. Taking running on a computer as an example, Figure 1 This is a hardware structure block diagram of a computer according to an embodiment of the present invention. For example... Figure 1 As shown, a computer may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the computer may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer described above. For example, the computer may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0041] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a method for generating computer software files in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0042] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a computer's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0043] This embodiment provides a method for generating software files. Figure 2 This is a flowchart of a software file generation method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0044] Step S201: Receive software development instructions in the session window;
[0045] Optionally, the session window can be a session window of AI assistants, browsers, or other human-computer interaction software.
[0046] Step S202: Activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent;
[0047] In this embodiment, the main agent is the top-level agent in the hierarchical proxy framework, used to coordinate and manage lower-level multi-layered proxies.
[0048] The layered proxy architecture in this embodiment allows a fully functional AI agent to be encapsulated into a capability unit (agent) that can be invoked by other agents. This architecture is implemented through a module that encapsulates the agent's capabilities into units. The agent's capability unit encapsulation is specifically implemented as a capability unit structure. This structure conforms to a common capability unit interface within the system, and therefore can be seamlessly integrated into any agent's capability unit set. Internally, this structure holds a reference to another independent, fully functional AI agent service.
[0049] Step S203: Obtain the long-term memory information of the software development instructions through the main agent;
[0050] The long-term memory information in this embodiment is a summary of all historical information of software development instructions in the session window. It can extract a concise summary containing key contextual information from a lengthy dialogue history and inject it as "memory" into subsequent dialogues related to software development instructions. This effectively overcomes the limitations of the language model context window.
[0051] Step S204: Invoke multiple agents in the layered agent framework for the software development instructions based on the long-term memory information;
[0052] Step S205: Execute the plurality of intelligent agents and output the software file corresponding to the software development instructions.
[0053] Through the above steps, software development instructions are received in the session window; the main agent of the hierarchical proxy framework is activated, wherein the hierarchical proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent; the long-term memory information of the software development instructions is obtained through the main agent; multiple agents in the hierarchical proxy framework are called for the software development instructions according to the long-term memory information; the multiple agents are executed, and the software file corresponding to the software development instructions is output. Through the hierarchical proxy framework, large and fuzzy tasks can be recursively and composably decomposed into specific and executable sub-tasks, thereby improving the ability to plan and solve complex problems. This solves the technical problem of incoherent context in complex software development tasks in the prior art, enabling the AI assistant to maintain contextual coherence in long development sessions.
[0054] In one example, obtaining the long-term memory information of the software development instruction through the main agent includes: obtaining the summary message field of the current session record of the session window through the main agent; determining whether the summary message field is empty; if the summary message field is empty, obtaining all historical messages of the session window to obtain a historical message list; adding a system instruction to the end of the historical message list, wherein the system instruction is used to instruct the generation of a summary of key information required to continue the current dialogue of the software development instruction; inputting the historical message list and the system instruction into the summary generation model, outputting the long-term memory information of the software development instruction, and generating a field identifier of the long-term memory information in the summary message field, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
[0055] The summary generation model in this example is a language model service for generating high-quality summaries. This service is configured with a powerful language model that has a large context window and excellent understanding capabilities.
[0056] In one example, after determining whether the summary message field is empty, the method further includes: if the summary message field is not empty, locating the start position pointer of the valid context of the current session record based on the field identifier in the summary message field; reading historical summary messages from the position pointed to by the start position pointer, and reading the latest historical messages after the position pointed to by the start position pointer; and generating long-term memory information of the software development instructions using the historical summary messages and the latest historical messages.
[0057] This example retrieves the entire message history of the current session from the database via a messaging service and appends a specific, pre-defined system instruction to the language model. This instruction explicitly instructs the language model to generate a summary focused on the "key information needed to continue the conversation." The prepared list of historical messages is then sent to a dedicated summary language model service for processing, generating a concise summary of the entire conversation.
[0058] The periodically generated summary text is packaged into a new system message and stored in the database. The unique ID of this new summary message is updated in a dedicated field (e.g., `summary_message_id`) in the current session record, which serves as a pointer to the start of the valid context. In future interactions, when the agent needs to load historical messages for new user input, it first checks the `summary_message_id` field in the current session record. If this field is not empty, the method will not load the complete conversation history from the beginning, but instead load only the portion starting from the summary message pointed to by that ID as the initial context.
[0059] In one embodiment of this example, before obtaining the long-term memory information of the software development instructions through the main agent, the method further includes: counting the total number of tokens for all historical messages of the session window, and monitoring the pause duration of the session window after the end of the last interaction round; determining whether the total number of tokens exceeds the safety threshold of the language model context window capacity, and determining whether the pause duration exceeds a preset duration; if the total number of tokens exceeds the safety threshold of the language model context window capacity, or the pause duration exceeds the preset duration, generating and storing the long-term memory information.
[0060] The summary generation process is initiated in a separate concurrent task and can publish a "summary start" event to notify the user interface to update its state. This process can be triggered based on one or more preset conditions, such as when the total number of tokens in the session history exceeds a safety threshold (e.g., 75%) of the language model context window capacity, or when a long pause is detected after a user interaction round.
[0061] Figure 3 This is a flowchart of context recovery in an embodiment of the present invention, including: a new task arrives, and the context needs to be loaded; check if the 'summary_messageid' field exists; if not, load the complete session history from the beginning; if yes, start loading the subsequent history from the message pointed to by the summary message id; and inject the loaded context into the LLM.
[0062] In one embodiment of this example, invoking multiple agents in the layered proxy framework for the software development instruction based on the long-term memory information includes: parsing the macro-task corresponding to the software development instruction based on the long-term memory information; decomposing the macro-task into multiple first sub-tasks of the highest level that are executed sequentially; iteratively executing the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or execution failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks of the next level; and invoking agents in the layered proxy framework for each sub-task at all levels.
[0063] The core of the layered proxy framework in this embodiment is a centralized application instance, which acts as the central coordinator (master proxy) for all submodules and services. This core application instance manages all core components of the device, ensuring smooth communication and efficient collaboration among them. This centralized application instance aggregates multiple core services, including a session service for managing session state, a message service for persisting messages, a history service for tracking interaction history, and a permission management service for controlling sensitive operations. The master proxy initializes and manages one or more AI agent instances. The master proxy is the core intelligence of the device, responsible for parsing user intent, planning tasks, invoking capability units, and ultimately generating responses. This proxy interacts with different underlying large models through a pluggable language model supply layer. The master proxy manages connections to external services, primarily including standardized language service clients for interacting with the code editing environment, and standardized model context clients for dynamically discovering and invoking external capabilities, and provides robust lifecycle management for these clients. The master proxy decouples all components through a central event bus based on a publish / subscribe (Pub / Sub) model. During the initialization phase, an event subscription configuration module establishes event subscription relationships for each service.
[0064] The main agent's initialization process is carefully designed to ensure efficiency and robustness. It first initializes the local database and services, then concurrently starts an independent initialization coroutine for each external service client in the background, avoiding blocking the main process. The main agent also provides a resource release and program termination module to orderly shut down all components when the application exits, ensuring proper resource release.
[0065] In one example, invoking agents in the hierarchical proxy framework for subtasks at all levels includes: for the first subtask at the highest level, searching for a matching agent in the hierarchical proxy framework; determining a target subtask that includes multiple subordinate subtasks in the first subtask, and determining a second subtask of the target subtask, wherein the second subtask is a subordinate subtask of the target subtask; controlling the agent of the target subtask to send an invocation request to the subordinate subtask, wherein the invocation request contains a description string of the task to be executed by the agent of the lower-level proxy; for each subordinate subtask of the target subtask, creating a task session between the target subtask and the subordinate subtask, wherein the task session is used to return the output of the subordinate subtask to the corresponding parent agent, and read the computational cost generated by the subordinate subtask, and add the computational cost to the total cost field of the corresponding parent agent; activating the child agent matched by the subordinate subtask in the hierarchical proxy framework, and passing the invocation request and the session identifier of the task session to the child agent.
[0066] Figure 4 This is a flowchart of a layered proxy invocation in an embodiment of the present invention. When an upper-layer (parent) proxy decides to invoke a certain "proxy capability unit" in its capability unit set, the execution method of that capability unit is triggered and performs the following steps: Parameter parsing: Parses the invocation request from the parent proxy, which is essentially a string containing a task description that needs to be executed by the lower-layer (child) proxy service. Creating an isolated task session: Through the session service, a new, temporary session record is created in the backend database for this subtask. This task session is independent at the database level and has its own message history, but it is associated with the parent proxy's session ID through a foreign key. Executing the child proxy: After creating the isolated session, the child proxy service encapsulated within it is activated, and the task instructions and the newly created isolated session ID are provided to it. Synchronous waiting and result return: The execution method of this proxy capability unit waits for the child proxy to complete execution in a synchronous blocking manner and extracts its final output text. After the child proxy finishes running, the computational cost generated is read from the temporary task session and added to the total cost field of the parent session to achieve unified cost accounting. Finally, the output of the sub-agent is packaged into a standard capability unit response format and returned to the parent agent.
[0067] In this embodiment, executing the plurality of intelligent agents to output the software file corresponding to the software development instructions includes: constructing a dynamic toolset for the software development instructions based on the long-term memory information; determining the target intelligent agent to be executed according to the execution order of the plurality of intelligent agents; after the target intelligent agent completes its execution, obtaining the task result output by the target intelligent agent; controlling the main agent to call a third-party service from the dynamic toolset to verify the task result in real time, and determining whether the task result passes the verification; if the task result fails the verification, controlling the target intelligent agent to re-execute the task until the task result passes the verification; after the task result passes the verification, passing the task result to the next intelligent agent, until the last intelligent agent, and determining the task result output by the last intelligent agent as the software file corresponding to the software development instructions.
[0068] The dynamic toolset is a set of tools that corresponds to the development requirements of the software development instructions. During the initialization phase, all tools defined in the configuration file are traversed, and the dynamic toolset that matches the development requirements of the software development instructions is selected from the long-term memory information.
[0069] Optionally, after determining the target agent to be executed according to the execution order of the plurality of agents, the method further includes: triggering the state update function of the state machine of the target agent and updating the current state of the target agent; publishing the current state to the central event bus; and controlling the central event bus to transmit the current state to the associated agents of the target agent through a publish-subscribe communication link.
[0070] Optionally, the associated intelligent agent can be an upstream or downstream intelligent agent in the entire software development task of the target intelligent agent.
[0071] Optionally, the central event bus can also be controlled to transmit the current state to the user interface module via a publish-subscribe communication link, so as to display the real-time progress of the software development instructions on the user interface module.
[0072] The solution in this embodiment can also implement a highly robust and scalable framework for integration with external tools and services. This framework is primarily implemented through two standardized service protocols: a language service protocol for code analysis and diagnostics, and a model context protocol for discovering and invoking external capabilities.
[0073] The language service protocol is used to communicate with the language server in the development environment to obtain real-time diagnostic information such as syntax errors and code warnings. This provides the device with the ability to perform strong grammatical accuracy checks on the generated code, ensuring the correctness of the generated content. The core features of this framework are dynamism, lifecycle awareness, and self-healing capabilities. Concurrent and asynchronous initialization: When the application starts, an external service initialization module traverses all services defined in the configuration file and starts an independent concurrent task for each service to initialize, ensuring the device's rapid response. Unified state management and event notification: The device maintains independent but structurally similar state machines for different types of external services (such as language services and model context services). The connection state of each external service is stored in a mapping that supports concurrent access. Any change in state triggers a corresponding state update function and is published to the global event bus as a specific type of event.
[0074] Dynamic Capability Discovery and Registration (using Model Context Protocol as an example): After successfully initializing a client conforming to the Model Context Protocol and establishing a connection, the system queries the service for its list of capabilities. Then, the system iterates through the returned capability list, dynamically encapsulating each remote capability into a local proxy object that conforms to the device's internal generic capability unit interface, and completes the registration. Health Monitoring and Automatic Reconnection: To ensure the stability of long-running sessions, this framework implements a self-healing mechanism. Before executing a remote capability call, a connection management logic performs health status monitoring. This logic sends a lightweight probe request to the target server. Specifically, this probe request can be a low-overhead operation conforming to the target service protocol, such as a ping request to a language server or a HEAD request to an HTTP service. If no successful response is received within a preset timeout period (e.g., 500 milliseconds), the connection is considered unhealthy. If the request fails or times out, the logic catches the error, updates the client status to "disconnected," and automatically triggers a reconnection task to attempt to re-establish the connection in the background. Integrated access control: Whether the capability is provided locally or remotely, it must be authorized through the device's access control service before execution, and the user must give explicit permission.
[0075] This embodiment also provides a unified, asynchronous event-driven approach that coordinates all independent modular components through a central event message broker. This loosely coupled design is key to the device's high responsiveness, scalability, and maintainability. Central Event Message Broker: Upon startup, the device instantiates a publish / subscribe (Pub / Sub) broker, serving as the central hub for all asynchronous communication. Specific Event Structures: To achieve type-safe and clear communication, the method defines various specific event structures as data carriers, such as "broker message events," "language service status events," and "model context service events." Subscription and Distribution Mechanism: Through a generic subscription registration mechanism, the device creates subscriptions for multiple services. Each subscription runs in an independent concurrent task. All subscribers forward their received events to a unified, buffered central event channel. Finally, a main event processing loop continuously reads events from this channel and distributes them to the appropriate processing module (e.g., the terminal user interface) based on the event type. Workflow Example: When a client conforming to the language service protocol successfully connects, its status update logic publishes a "language service status event." The event is captured by the subscriber and placed into the central event channel. The main event handling loop retrieves the event from the channel and forwards it to the user interface module, which then updates the status indicators on the interface upon receiving the message. The entire process is completely asynchronous and non-blocking.
[0076] Figure 5 This is a flowchart of the collaborative working mechanism in an embodiment of the present invention, including:
[0077] Task Input and Context Initialization: When a user inputs a complex task (e.g., "Refactor the logging method of the payment module"), the master agent in the hierarchical agent architecture is activated. Before making any planning, the master agent first uses a session digest mechanism to access long-term memory. It loads the valid context determined by the digest pointer, ensuring it understands the previous discussion history and decisions regarding "payment module" or "logging," avoiding duplication of work or contradictions with historical decisions.
[0078] Task Planning and Decomposition: Based on user instructions and long-term memory, the main agent begins task planning. It decomposes the macro-level task into a series of specific sub-tasks (e.g., 1. Locate all payment-related code files; 2. Analyze existing logging implementations; 3. Design a new logging format; 4. Modify files one by one; 5. Verify the correctness of the modifications). This decomposition capability is the core manifestation of the layered agent architecture. For more complex sub-steps (such as step 1), the main agent can decide to call a sub-agent specifically for code searching to complete the task.
[0079] Capability Invocation and Real-Time Verification: The main agent executes its planned sub-steps through a dynamic tools and service integration framework. It invokes a series of capability units, such as "file search," "file read," and "file write." Crucially, after executing the critical "file write" step, the main agent can immediately invoke the capability units integrated through the language service protocol to perform real-time syntax and type checks on the modified code. This forms an internal "proposal-verification" micro-loop, ensuring the correctness of each step. If verification fails, the main agent can immediately receive feedback and correct its solution without waiting for all steps to complete.
[0080] Asynchronous Communication and Status Feedback: Throughout the execution of all the above steps, a unified event-driven architecture continuously operates as the "neural network" of the entire system. Whenever the main agent invokes a capability unit, or the status of an external service changes (e.g., a successful connection to the language server), a corresponding event is published to the central event bus. The user interface module subscribes to these events and displays the current progress to the user in real time (e.g., "Searching for files...", "3 syntax errors found...", "Attempting to reconnect to the service..."). This makes the complex background task processing transparent and responsive to the user, greatly enhancing the user experience.
[0081] In summary, the session summary mechanism provides the layered agent with "memory," making its planning more intelligent; the layered agent decomposes the plan into actions, which are then executed by a dynamic toolset; the validation capabilities in the dynamic toolset provide real-time feedback on the layered agent's actions; and the event-driven architecture asynchronously and decouples all of this, providing users with a smooth interaction. It is this close collaboration that forms a complete intelligent closed loop from understanding and planning to execution and validation, thereby achieving efficient automation of complex software development tasks.
[0082] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0083] Example 2
[0084] This embodiment also provides a software file generation apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0085] Figure 6 This is a structural block diagram of a software file generation apparatus according to an embodiment of the present invention, such as... Figure 6 As shown, the device includes:
[0086] Receiver module 61 is used to receive software development instructions in the session window;
[0087] Activation module 62 is used to activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent;
[0088] The acquisition module 63 is used to acquire the long-term memory information of the software development instructions through the main agent;
[0089] Module 64 is used to invoke multiple intelligent agents in the layered agent framework for the software development instructions based on the long-term memory information.
[0090] Output module 65 is used to execute the plurality of intelligent agents and output the software file corresponding to the software development instructions.
[0091] Optionally, the acquisition module includes: a first acquisition unit, configured to acquire the summary message field of the current session record of the session window through the main agent; a judgment unit, configured to determine whether the summary message field is empty; a second acquisition unit, configured to acquire all historical messages of the session window if the summary message field is empty, and obtain a historical message list; an addition unit, configured to add a system instruction to the end of the historical message list, wherein the system instruction is used to instruct the generation of a summary of key information required to continue the current dialogue of the software development instruction; and an output unit, configured to input the historical message list and the system instruction into the summary generation model, output the long-term memory information of the software development instruction, and generate a field identifier of the long-term memory information in the summary message field, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
[0092] Optionally, the acquisition module further includes: a positioning unit, configured to locate the start position pointer of the valid context of the current session record based on the field identifier in the summary message field if the summary message field is not empty after the judgment unit determines whether the summary message field is empty; a reading unit, configured to read historical summary messages from the position pointed to by the start position pointer, and read the latest historical messages after the position pointed to by the start position pointer; and a generation unit, configured to generate long-term memory information of the software development instructions using the historical summary messages and the latest historical messages.
[0093] Optionally, the device further includes: a processing module, configured to count the total number of tokens for all historical messages of the session window and monitor the pause duration of the session window after the last interaction round before the acquisition module acquires the long-term memory information of the software development instructions through the main agent; a judgment module, configured to determine whether the total number of tokens exceeds a safety threshold of the language model context window capacity and whether the pause duration exceeds a preset duration; and a generation module, configured to generate and store the long-term memory information if the total number of tokens exceeds the safety threshold of the language model context window capacity or the pause duration exceeds the preset duration.
[0094] Optionally, the invocation module includes: a parsing unit, configured to parse the macro-task corresponding to the software development instruction based on the long-term memory information; a decomposition unit, configured to decompose the macro-task into multiple first sub-tasks of the highest level executed sequentially; an iteration unit, configured to iteratively execute the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or execution failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks at the next level; and an invocation unit, configured to invoke the agent in the hierarchical proxy framework for each sub-task at all levels.
[0095] Optionally, the invocation unit includes: a search subunit, used to search for a matching agent in the hierarchical proxy framework for the first subtask at the highest level; a determination subunit, used to determine a target subtask that includes multiple lower-level subtasks in the first subtask, and to determine a second subtask of the target subtask, wherein the second subtask is a lower-level subtask of the target subtask; a control subunit, used to control the agent of the target subtask to send an invocation request to the lower-level subtask, wherein the invocation request contains a description string of the task to be executed by the agent of the lower-level proxy; a creation subunit, used to create a task session between the target subtask and the lower-level subtask for each lower-level subtask of the target subtask, wherein the task session is used to return the output result of the lower-level subtask to the corresponding parent agent, and read the computational cost generated by the lower-level subtask, and add the computational cost to the total cost field of the corresponding parent agent; and an input subunit, used to activate the child agent matched by the lower-level subtask in the hierarchical proxy framework, and input the invocation request and the session identifier of the task session to the child agent.
[0096] Optionally, the output module includes: a construction unit, configured to construct a dynamic toolset for the software development instructions based on the long-term memory information; a determination unit, configured to determine the target agent currently executing according to the execution order of the multiple agents; an acquisition unit, configured to acquire the task result output by the target agent after the target agent completes execution; a verification unit, configured to control the main agent to call a third-party service from the dynamic toolset to verify the task result in real time, and determine whether the task result passes verification; and an output unit, configured to control the target agent to re-execute the task if the task result fails verification, until the task result passes verification; after the task result passes verification, the task result is passed to the next agent, until the last agent, and the task result output by the last agent is determined as the software file corresponding to the software development instructions.
[0097] Optionally, the output module further includes: an update unit, configured to trigger the state update function of the state machine of the target intelligent agent and update the current state of the target intelligent agent after the determining unit determines the target intelligent agent to be executed according to the execution order of the plurality of intelligent agents; a publishing unit, configured to publish the current state to the central event bus; and a transmission unit, configured to control the central event bus to transmit the current state to the associated intelligent agents of the target intelligent agent through a publish-subscribe communication link.
[0098] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0099] Example 3
[0100] Embodiments of the present invention also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0101] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0102] S1, receive software development instructions in the session window;
[0103] S2, activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent;
[0104] S3, obtain the long-term memory information of the software development instructions through the main agent;
[0105] S4, based on the long-term memory information, invoke multiple intelligent agents in the layered agent framework for the software development instructions;
[0106] S5, execute the multiple intelligent agents and output the software file corresponding to the software development instructions.
[0107] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0108] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0109] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0110] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0111] S1, receive software development instructions in the session window;
[0112] S2, activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent;
[0113] S3, obtain the long-term memory information of the software development instructions through the main agent;
[0114] S4, based on the long-term memory information, invoke multiple intelligent agents in the layered agent framework for the software development instructions;
[0115] S5, execute the multiple intelligent agents and output the software file corresponding to the software development instructions.
[0116] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0118] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0119] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0120] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for generating software files, characterized in that, include: Receive software development instructions in the session window; Activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents, each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer, and each agent is encapsulated as a capability unit that can be called by the upper layer agent; The long-term memory information of the software development instructions is obtained through the main agent; Based on the long-term memory information, the software development instructions are used to invoke multiple intelligent agents in the layered agent framework; Execute the plurality of intelligent agents and output the software file corresponding to the software development instructions; The process of invoking multiple agents in the hierarchical proxy framework for the software development instructions based on the long-term memory information includes: parsing the macro-task corresponding to the software development instructions based on the long-term memory information; decomposing the macro-task into multiple first sub-tasks of the highest level that are executed sequentially; iteratively executing the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks of the next level; and invoking agents in the hierarchical proxy framework for sub-tasks at all levels respectively; wherein invoking agents in the hierarchical proxy framework for sub-tasks at all levels respectively includes: for the first sub-task of the highest level, in the... The process involves:
1. Locating a matching agent within the hierarchical proxy framework; 2. Determining a target subtask that includes multiple subordinate subtasks within the first subtask, and 3. Identifying a second subtask of the target subtask, where the second subtask is a subordinate subtask of the target subtask; 4. Controlling the agent of the target subtask to send a call request to the subordinate subtask, where the call request contains a description string of the task to be executed by the agent of the lower-level proxy; 5. For each subordinate subtask of the target subtask, creating a task session between the target subtask and the subordinate subtask, where the task session is used to return the output of the subordinate subtask to the corresponding parent agent, read the computational cost generated by the subordinate subtask, and add the computational cost to the total cost field of the corresponding parent agent; 6. Activating the child agent matched by the subordinate subtask in the hierarchical proxy framework, and passing the call request and the session identifier of the task session to the child agent. The process of executing the multiple agents and outputting the software file corresponding to the software development instructions includes: during the initialization phase, traversing all tools defined in the configuration file and selecting a dynamic toolset that matches the development requirements of the software development instructions based on long-term memory information; determining the target agent to be executed according to the execution order of the multiple agents; after the target agent completes its execution, obtaining the task result output by the target agent; controlling the main agent to call a third-party service from the dynamic toolset to verify the task result in real time and determine whether the task result passes the verification; if the task result fails the verification, controlling the target agent to re-execute the task until the task result passes the verification; after the task result passes the verification, passing the task result to the next agent until the last agent, and determining the task result output by the last agent as the software file corresponding to the software development instructions.
2. The method according to claim 1, characterized in that, Obtaining the long-term memory information of the software development instructions through the main agent includes: The main agent obtains the summary message field of the current session record of the session window; Determine whether the summary message field is empty; If the summary message field is empty, retrieve all historical messages of the session window to obtain a historical message list; Add a system instruction to the end of the historical message list, wherein the system instruction is used to indicate the generation of a summary of key information required to continue the current dialogue of the software development instruction; The historical message list and the system instructions are input into the summary generation model, the long-term memory information of the software development instructions is output, and a field identifier of the long-term memory information in the summary message field is generated, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
3. The method according to claim 2, characterized in that, After determining whether the summary message field is empty, the method further includes: If the summary message field is not empty, locate the start position pointer of the valid context of the current session record based on the field identifier in the summary message field; Read the historical summary message from the position pointed to by the starting position pointer, and read the latest historical message after the position pointed to by the starting position pointer; The long-term memory information of the software development instructions is generated using the historical summary messages and the latest historical messages.
4. The method according to claim 1, characterized in that, Before obtaining the long-term memory information of the software development instructions through the main agent, the method further includes: The total number of tokens in all historical messages of the session window is counted, and the pause duration of the session window after the end of the last interaction round is monitored. Determine whether the total number of tokens exceeds the safety threshold of the language model context window capacity, and determine whether the pause duration exceeds the preset duration; If the total number of tokens exceeds the safety threshold of the language model context window capacity, or the pause duration exceeds the preset duration, the long-term memory information is generated and stored.
5. The method according to claim 1, characterized in that, After determining the target agent to be executed according to the execution order of the plurality of agents, the method further includes: Trigger the state update function of the target agent's state machine and update the current state of the target agent; The current status is published to the central event bus; The central event bus controls the transmission of the current state to the associated intelligent agents of the target intelligent agent via a publish-subscribe communication link.
6. A software file generation apparatus, characterized in that, include: The receiving module is used to receive software development instructions in the session window; The activation module is used to activate the main agent of the layered proxy framework, wherein the layered proxy framework includes the main agent and multiple layers of agents. Each layer is called by the parent agent of the upper layer and calls the child agent of the lower layer. Each agent is encapsulated as a capability unit that can be called by the upper layer agent. The acquisition module is used to acquire the long-term memory information of the software development instructions through the main agent; The invocation module is used to invoke multiple intelligent agents in the layered agent framework based on the long-term memory information for the software development instructions. The output module is used to execute the multiple intelligent agents and output the software files corresponding to the software development instructions; The invocation module includes: a parsing unit, used to parse the macro-task corresponding to the software development instruction based on the long-term memory information; a decomposition unit, used to decompose the macro-task into multiple first sub-tasks of the highest level executed sequentially; an iteration unit, used to iteratively execute the following steps for each of the multiple first sub-tasks until the complexity of all sub-tasks at the current level is lower than a preset threshold: parsing the complexity of the first sub-task, wherein the complexity is used to indicate the execution time and / or execution failure rate of the corresponding sub-task; selecting a target sub-task with a complexity higher than the preset threshold from the multiple first sub-tasks; decomposing the target sub-task into multiple second sub-tasks of the next level; and an invocation unit, used to invoke the agent in the hierarchical proxy framework for each sub-task at all levels; wherein the invocation unit includes: a search sub-unit, used to search for a matching agent in the hierarchical proxy framework for the first sub-task of the highest level; and a determination sub-unit. The system is configured to: determine a target subtask comprising multiple subordinate subtasks in the first subtask, and determine a second subtask of the target subtask, wherein the second subtask is a subordinate subtask of the target subtask; a control subunit, configured to control the agent of the target subtask to send a call request to the subordinate subtask, wherein the call request contains a description string of the task to be executed by the agent of the lower-level agent; a creation subunit, configured to create a task session between the target subtask and the subordinate subtask for each subordinate subtask of the target subtask, wherein the task session is used to return the output result of the subordinate subtask to the corresponding parent agent, and read the computational cost generated by the subordinate subtask, and add the computational cost to the total cost field of the corresponding parent agent; and an input subunit, configured to activate the child agent matched by the subordinate subtask in the hierarchical agent framework, and input the call request and the session identifier of the task session to the child agent. The output module includes: a construction unit, used during the initialization phase to traverse all tools defined in the configuration file and select a dynamic toolset that matches the development requirements of the software development instructions based on long-term memory information; a determination unit, used to determine the target agent to be executed according to the execution order of the multiple agents; an acquisition unit, used to acquire the task result output by the target agent after the target agent has completed execution; a verification unit, used to control the main agent to call a third-party service from the dynamic toolset to verify the task result in real time and determine whether the task result has passed verification; and an output unit, used to control the target agent to re-execute the task if the task result fails verification, until the task result passes verification; after the task result passes verification, the task result is passed to the next agent, until the last agent, and the task result output by the last agent is determined as the software file corresponding to the software development instructions.
7. The apparatus according to claim 6, characterized in that, The acquisition module includes: The first acquisition unit is used to acquire the summary message field of the current session record of the session window through the main agent; The judgment unit is used to determine whether the summary message field is empty; The second acquisition unit is used to acquire all historical messages of the session window and obtain a historical message list if the summary message field is empty. An adding unit is used to add a system instruction to the end of the historical message list, wherein the system instruction is used to indicate the generation of a summary of key information required to continue the current dialogue of the software development instruction; The output unit is used to input the historical message list and the system instructions into the summary generation model, output the long-term memory information of the software development instructions, and generate the field identifier of the long-term memory information in the summary message field, wherein the field identifier is used to mark the start position pointer of the summary message of the current session record.
8. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 5 when it is run.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 5.