Multi-agent collaborative query response method based on state dependency graph and related device
Through a multi-agent collaborative query response method based on a state dependency graph, the response delay and redundancy problems of a single-agent system under high-dimensional and highly dynamic user demands are solved, and efficient and flexible responses to personalized services are achieved.
Patent Information
- Application Number
- CN202510807071.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-12
AI Technical Summary
Existing single-agent systems have difficulty coping with high-dimensional and highly dynamic user needs and are unable to flexibly adjust generation strategies, resulting in problems such as response delays, single content, and resource redundancy.
A multi-agent collaborative query response method based on a state dependency graph is adopted. Through the collaborative work of global collaborative agents, semantic parsing agents, intention recognition agents, preference matching agents, resource retrieval agents and response generation agents, automatic adaptation of personalized services is achieved by utilizing global state cache and state dependency graph.
It realizes automatic adaptation of personalized services according to actual interaction scenarios, improves response efficiency and system flexibility, avoids redundant calculations, and ensures efficient and consistent responses.
Smart Images

Figure 79AXPZ4KGF7U8MIBD6PLBYVA4ZHFY6TKSNKWMMRC 
Figure CBOSTKJHUYCSUQONXPZM4SI2G8TNWZDC9GCPE80E 
Figure HC04IHKABETWOR88VT4TWOXF91MPYHIQLEPOONJU
Abstract
Description
Technical Field
[0001] The present application relates to the field of large language models and multi-agent technology, and specifically to a multi-agent collaborative query response method and related devices based on a state dependency graph. Background Art
[0002] In open AI (Artificial Intelligence) dialogue and AI response service scenarios, users are increasingly demanding dynamic, personalized, and real-time responses due to the diversity of their needs, task objectives, interaction styles, and behavioral preferences. Users may rapidly switch between roles across multiple domains, such as knowledge query, technical support, and document polishing. The system must provide accurate, personalized feedback based on diverse information, including their real-time context, long-term preference tags, and current task objectives. This high-dimensional, dynamic demand requires the system to deeply integrate task semantics, user profiles, resource context, and other information to achieve cross-domain adaptive collaboration. However, currently widely used single-agent systems struggle to cope with these high-dimensional, dynamic real-world demands and are unable to flexibly adjust generation strategies based on changes in domain tasks and scenario roles. Common multi-agent systems have a single, fixed execution process, which is prone to response delays, monotonous and rigid content, and resource redundancy. Summary of the Invention
[0003] The embodiments of the present application provide a multi-agent collaborative query response method and related devices based on a state dependency graph, which can automatically adapt to the personalized service corresponding to the query text currently input by the user according to the actual interaction scenario, and realize responsive and efficient intelligent assistance.
[0004] A first aspect of an embodiment of the present application provides a multi-agent collaborative query response method based on a state dependency graph, which is applied to a multi-agent collaborative query response system based on a state dependency graph. The multi-agent collaborative query response system based on a state dependency graph includes: a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent. The method includes: The global collaborative agent receives the query text input by the user; The semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent calls the preference matching agent to generate preference information; The global collaborative agent calls the resource retrieval agent to obtain the query resource information corresponding to the query text according to the query complexity; The response generation agent generates query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information.
[0005] In a possible implementation, the global collaborative agent calls the preference matching agent to generate preference information, including: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
[0006] In a possible implementation, the global collaborative agent calls the resource retrieval agent to obtain query usage resource information corresponding to the query text according to the query complexity, including: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
[0007] In one possible implementation, the global state cache is used to cache a global state dependency graph, which includes the collaborative states of a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global state cache is used to cache the historical context of the text to be queried, the text to be queried, the parsed text to be queried, domain structure information, domain index, preference information, query resource information and query response information; The global state cache implements differentiated lifecycle management based on state classification.
[0008] In one possible implementation, the global state dependency graph is used to represent the agents and collaboration states in a multi-agent collaborative query response system; Each node in the global state dependency graph represents a collaborative state, and each directed edge represents the necessary dependency of the collaborative state on the execution of the intelligent agent.
[0009] A second aspect of an embodiment of the present application provides a multi-agent collaborative query response system based on a state dependency graph, the multi-agent collaborative query response system comprising: a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global collaborative agent is used to receive the query text input by the user; The semantic parsing agent is used to perform query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent is used to determine that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmit the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent is also used to call the preference matching agent to generate preference information; The global collaborative agent is also used to call the resource retrieval agent to obtain the query usage resource information corresponding to the query text according to the query complexity; The response generation agent is used to generate query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information.
[0010] In a possible implementation, the global collaborative agent is specifically used to: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
[0011] In a possible implementation, the global collaborative agent is specifically used to: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
[0012] In one possible implementation, the global state cache is used to cache a global state dependency graph, which includes the collaborative states of a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global state cache is used to cache the historical context of the text to be queried, the text to be queried, the parsed text to be queried, domain structure information, domain index, preference information, query resource information and query response information; The global state cache implements differentiated lifecycle management based on state classification.
[0013] In one possible implementation, the global state dependency graph is used to represent the agents and collaboration states in a multi-agent collaborative query response system; Each node in the global state dependency graph represents a collaborative state, and each directed edge represents the necessary dependency of the collaborative state on the execution of the intelligent agent.
[0014] A third aspect of an embodiment of the present application provides a terminal, comprising a processor, an input device, an output device, and a memory, wherein the processor, input device, output device, and memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions and execute the step instructions in the first aspect of the embodiment of the present application.
[0015] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application.
[0016] A fifth aspect of the embodiments of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0017] The implementation of the embodiments of the present application has the following beneficial effects: The global collaborative agent receives the query text input by the user, and the semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity. If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines the current domain structure information as the domain structure information corresponding to the query text, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index. Otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index. The global state cache includes a global state dependency graph. The global collaborative agent calls the preference matching agent to generate preference information. The global collaborative agent calls the resource retrieval agent to obtain the query usage resource information corresponding to the text to be queried based on the query complexity. The response generation agent generates query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information. Therefore, the system can automatically adapt to the personalized service corresponding to the text to be queried currently input by the user according to the actual interaction scenario, and realize responsive and efficient intelligent assistance. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] Figure 1 A flow chart of a multi-agent collaborative query response method based on a state dependency graph is provided for an embodiment of the present application; Figure 2 A schematic diagram of the structure of a terminal provided in an embodiment of the present application; Figure 3 A structural diagram of a multi-agent collaborative query response system based on a state dependency graph is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0021] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0022] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0023] See also Figure 1 , Figure 1 The present invention provides a flow chart of a multi-agent collaborative query response method based on a state dependency graph. Figure 1 As shown, the method is applied to a multi-agent collaborative query response system based on a state dependency graph, wherein the multi-agent collaborative query response system based on a state dependency graph includes: a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent. The method includes: 101. The global collaborative agent receives the query text input by the user.
[0024] The text to be queried input by the user may be received through the user terminal.
[0025] 102. The semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity.
[0026] 103. If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph.
[0027] In one possible implementation, the global state cache is used to cache a global state dependency graph, which includes the collaborative states of a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global state cache is used to cache the historical context of the text to be queried, the text to be queried, the parsed text to be queried, domain structure information, domain index, preference information, query resource information and query response information; The global state cache implements differentiated lifecycle management based on state classification.
[0028] In one possible implementation, the global state dependency graph is used to represent the agents and collaboration states in a multi-agent collaborative query response system; Each node in the global state dependency graph represents a collaborative state, and each directed edge represents the necessary dependency of the collaborative state on the execution of the intelligent agent.
[0029] 104. The global collaborative agent calls the preference matching agent to generate preference information.
[0030] Specifically, a method for a global collaborative agent to call a preference matching agent to generate preference information includes: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
[0031] 105. The global collaborative agent calls the resource retrieval agent to obtain the query usage resource information corresponding to the query text according to the query complexity.
[0032] In one possible implementation, a method in which a global collaborative agent calls a resource retrieval agent to obtain query usage resource information corresponding to a query text based on query complexity includes: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
[0033] 106. The response generation agent generates query response information based on at least the historical context of the query text, the query text, the parsed query text, the domain structure information, the domain index, the preference information, and the query usage resource information.
[0034] In this example, the global collaborative agent receives the query text input by the user, and the semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity. If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines the current domain structure information as the domain structure information corresponding to the query text, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index. Otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index. The global state cache includes a global state dependency graph, the global collaborative agent calls the preference matching agent to generate preference information, the global collaborative agent calls the resource retrieval agent to obtain the query usage resource information corresponding to the text to be queried according to the query complexity query, and the response generation agent generates query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information. Therefore, the system can automatically adapt to the personalized service corresponding to the text to be queried currently input by the user according to the actual interaction scenario, and realize responsive and efficient intelligent assistance.
[0035] In a specific implementation, this application aims to solve the problems of slow response, module redundancy and lack of personalization in the current multi-agent service system when dealing with complex service scenarios such as multi-domain, multi-preference and multi-resource requirements. It proposes a state dependency graph-driven multi-agent collaboration method and device based on a large language model. By constructing a unified global state cache (GSC), introducing state dependency graph-driven collaboration logic, and integrating multiple types of functional agents, it realizes dynamic analysis, preference adaptation, resource matching and precise generation of service requests, and ultimately realizes personalized and context-consistent intelligent services.
[0036] The core of this system lies in a collaborative approach among agents centered on a "state dependency graph." This approach eschews traditional linear module triggering mechanisms and instead models the semantic and behavioral variables involved in services through structured state objects. The system's core is a Global Collaboration Agent (GCA), responsible for reading, determining, and uniformly updating all collaborative states, coordinating the execution order and input and output of other functional agents. All states are uniformly encapsulated in a GSC, with the GCA exercising sole write control to ensure state consistency, contextual continuity, and behavioral interpretability. The device, which includes a computer device deploying the multi-agent system, completes the service loop by receiving a terminal input, current_query, and returning a current_response.
[0037] Each agent not only possesses independent structured input and output specifications but also comes equipped with task-specific prompt templates and a highly adaptable open-source language model sub-base. The system configures different open-source models for each agent based on the required reasoning complexity, retrieval capabilities, or generation quality of each task. For example, SPA and IRA utilize instruction-tuned models with strong structure understanding capabilities (such as ChatGLM instruction version and Mistral-Instruct), RRA utilizes lightweight models with entity recognition and keyword extraction capabilities (such as the GTE small model), and RGA utilizes large-scale conversational models with multi-turn context integration capabilities (such as the Qwen2.5-72B-128k large language model). Furthermore, a detailed system prompt and input template structure is designed for each agent to ensure clear task intent and stable and targeted semantic generation. This integrated "task-model-prompt" agent design concept is the key technical support for achieving high-performance personalized responses in this invention.
[0038] The Global Collaboration Agent (GCA) is the collaborative hub of the entire multi-agent system. It coordinates the execution order of each agent, determines the availability of collaborative state, and manages the reading and updating of all state variables. The model selected is the open-source Qwen2.5-7B-Instruct (instruction fine-tuning model, used for state management and scheduling decisions). At the beginning of each conversation, the GCA receives the user's natural language query, writes it to cache["current_query"], and appends it to cache["context"].history with the structure { "role": "user", "content": current_query} . After adding the history record, the system immediately checks the context's constraints, max_chat_length and max_token_length, to ensure that they do not exceed the configured limits, performing forward pruning if necessary. Before each agent invocation, the GCA reads the relevant state variables and determines whether the state is reusable based on its freshness and the system-maintained GSC hit rate. If the conditions are not met, the corresponding agent is triggered to regenerate the information. All collaborative states—including context, queries, domains, preferences, resources, and responses—are centrally created and written by the GCA. Its control logic and coordination capabilities are the foundation of the entire state-driven architecture. Furthermore, to support consistent recognition of domain states across rounds of dialogue, the GCA writes the domain index to cache["previous_domain_index"] after each round's domain_index.index update. This serves as a record of the previous round's domain index, enabling subsequent decision-making regarding whether to reuse preference and resource states. If the system detects that the domain index matches the previous round's (domain_index.index == previous_domain_index), it can skip the Preference Matching Agent (PMA) and re-retrieval of some resource states, directly proceeding to resource retrieval or response generation, provided the logical prerequisites are met. This mechanism significantly improves the system's responsiveness in continuous query scenarios while maintaining contextual consistency within the service domain's semantics. It is a key manifestation of the core capabilities of the global collaborative agent and demonstrates the system's ability to perceive domain coherence.
[0039] The system also includes the following five functional agents: The Semantic Parsing Agent (SPA) is primarily responsible for structured parsing and optimizing the original user-entered query. The model selected is the open-source ChatGLM3-6B model (suitable for Chinese semantic expansion and context awareness). The SPA retrieves the current query and its context from cache["current_query"] and cache["context"].history passed in by the GCA. Based on a pre-defined prompt word template and semantic embedding model, the SPA converts ambiguous, incomplete, or highly context-dependent queries into clear and specific text. The parsed result consists of two parts: the text field records the optimized complete natural language query, and the complexity field indicates the query's complexity, with an enumeration value of "low" or "high" and is used to determine whether resource retrieval is required. This parsed result is directly passed back to the GCA, which writes it to the cache["parsed_query"] state, forming an important foundation for subsequent intent recognition and resource retrieval.
[0040] The Intent Recognition Agent (IRA) identifies the service domain corresponding to the parsed query, supporting preference matching and subsequent content generation. The selected model combination includes the open-source ChatGLM3-6B-Instruct domain classification model (which accurately classifies parsed queries into their corresponding domain modules and outputs domain indexes); and the open-source m3e-base knowledge base retrieval and embedding model (which uses the RAG method to re-retrieve and update domain structure information from the knowledge base when the cache is invalidated (freshness timeout or insufficient GSC hit rate). Before triggering the IRA, the GCA first checks the validity of the cache["domain_info"] state. If its entry field is not empty and its freshness has not expired, and the current system-maintained GSC hit rate (calculated by hit statistics between domain_info and preference_profile) exceeds a set threshold (typically 80%), the GCA will pass the existing domain_info.entry and parsed_query.text to the IRA. At this point, IRA does not need to call the knowledge base for retrieval; it only uses the domain classification model to complete the judgment and output domain_index.index. If any of the above conditions are not met, GCA only passes parsed_query.text. IRA must access the domain knowledge base based on RAG technology, retrieve and generate a new domain_info.entry, and update the domain index based on the search results. IRA output data is written uniformly by GCA: if there is new domain information, cache["domain_info"].entry and freshness are updated; regardless of whether the cache is hit, cache["domain_index"].index and the corresponding freshness are updated.
[0041] The Preference Matching Agent (PMA) is responsible for determining the user's personalized preference profile for the current domain, such as preference labels like "prioritizing cost-effectiveness" or "prioritizing technical depth." The selected model is the open-source Qwen2.5-14B-Chat model (based on the Qwen2.5 series, which excels in tool invocation capabilities, reasoning, and decision logic, making it particularly suitable for interacting with external databases through function call interfaces). Before activating the PMA, the GCA evaluates the validity of cache["preference_profile"]. If user_preferences is not empty, its freshness has not expired, and its GSC hit rate meets the required criteria, the PMA directly matches the preference list with the current domain index (domain_index.index). The PMA extracts the preference information for the current domain from the preference list and returns the string value current_preference. If a match fails, the GCA only passes domain_index.index. The PMA then calls the database to retrieve the user's preference information for each domain, generates a new user_preferences, and extracts the current preference. Finally, GCA writes the returned current_preference to cache["current_preference"] and updates cache["preference_profile"].user_preferences and freshness when there is a new list.
[0042] The Resource Retrieval Agent (RRA) is the system's module responsible for assisting with resource matching. It executes only when the parsed query is marked as complex (complexity == "high"). Select the open-source model: Alibaba-NLP / gte-large-zh (Chinese keyword extraction and semantic search model). GCA passes parsed_query.text and resources.content as input parameters to the RRA. The RRA first uses the keyword extraction module to identify query terms and searches for matching entries in the existing resource cache. If the number of matching resources exceeds a system-defined threshold (e.g., three), these entries are directly written to cache["resources"].current_content, representing the set of resources that can be directly reused by the current query. If the number of matching resources is insufficient, the RRA performs external search tasks through a tool call mechanism, such as accessing an API interface to obtain new resources, and writes the returned results to current_content. GCA then updates resources.content to a cumulative resource pool. GCA then checks the overall length of resources.content. If it exceeds the max_length limit, it performs resource pruning and retains the latest entries to control memory usage.
[0043] The Response Generation Agent (RGA) is responsible for generating the final response. Its core capability lies in integrating all collaborative states into personalized feedback that is context-aware, preference-adapted, and domain-matched. The selected model is the open-source Qwen2.5-72B-128K model (suitable for generating complex multi-turn conversations that integrate domains, preferences, and context). The RGA receives the following state inputs from the GCA: conversation context context.history, current query current_query, parsed query text parsed_query.text, domain structure information domain_info.entry, domain index domain_index.index, current preference current_preference, and, if the query is complex, the resource collection resources.current_content. By integrating domain semantics, user preferences, and personalized features, the RGA generates detailed response text tailored to the current service objective. This response may include explanations of specialized content, strategic suggestions, or resource recommendations. After the response content is returned to GCA, it is written into cache["current_response"] and appended to context.history, becoming a new round of assistant role speech, completing a complete interactive closed loop.
[0044] The coordination and execution of all agents is no longer triggered serially by a fixed, pre-set process. Instead, they are dynamically driven by a uniformly modeled state dependency graph within the system. By establishing explicit state data dependencies between agents, the system only calls necessary agent modules on demand, avoiding redundant steps. In other words, the system determines whether to trigger a specific agent based on "state validity," enabling on-demand activation, path skipping (skipping unnecessary processing paths), and efficient coordination. This design ensures that multiple agents can autonomously collaborate based on their current state, improving system responsiveness and stability.
[0045] All states in the system are uniformly encapsulated as structured state objects and centrally stored in the Global State Cache (GSC). Each state object contains the data content of the corresponding information as well as metadata such as its validity identifier and update timestamp, which are used to determine whether the state needs to be updated or processed. The global state cache is read and written by the system's only global collaborative agent (Global Collaboration Agent, GCA). As the central coordinator, GCA is responsible for managing the update and extraction of states in the GSC and determining the execution order of each agent based on the changes in state. By having the GCA arbitrate reads and writes uniformly, each agent's access to shared states is guaranteed to be consistent and controlled, thereby avoiding concurrency conflicts and data inconsistencies and improving the reliability of system operation.
[0046] GCA maintains dependency mappings between collaborative states (for example, which agent generates a certain state object, and which subsequent agents depend on this state, etc.). When the collaborative state changes, GCA can select the appropriate subsequent agent to execute based on pre-defined dependency rules. Each agent implements its own specific functional module but does not call each other directly; they obtain input by reading the relevant state in GSC and write the output results back to GSC after completing the processing. In this way, the interaction between agents is completely driven by the collaborative state: GCA triggers the execution of an agent only when the prerequisite state required to execute a certain agent is ready and the output state expected to be produced by the agent is judged to be invalid or missing in the current global state. This state validity-based collaboration mechanism ensures that each time a user request is processed, the process only executes the necessary modules and automatically skips unnecessary parts, achieving the effect of on-demand execution and efficient collaboration of the system.
[0047] Under this collaborative mechanism, when a user submits a query, the system is coordinated by the GCA, and each agent dynamically cooperates based on the state dependency graph-driven mechanism to complete the service response. An exemplary workflow is shown below: After a user enters a natural language query on the terminal, the Global Collaboration Agent (GCA) first initializes the conversation state. The GCA writes the current query to cache["current_query"] and encapsulates it as a structured history record { "role": "user", "content": current_query} , appending it to cache["context"].history . The GCA also checks whether the conversation history exceeds the system-defined max_chat_length (maximum number of rounds) and max_token_length (maximum number of tokens). If so, the history record is automatically pruned from the beginning to the end. After preparing the conversation state for the current round, the GCA triggers the Semantic Parsing Agent (SPA) to initiate question resolution.
[0048] SPA receives two state inputs from GCA: cache["current_query"] and cache["context"].history. Using a pre-set prompt word template and semantic embedding model, SPA performs semantic expansion and contextual completion on the current query, outputting a structured parsed query object. The text attribute represents the optimized natural language question, and the complexity attribute is an enumeration type ("low" or "high"), which is used to determine whether resource retrieval is required. After receiving the SPA output, GCA writes it to cache["parsed_query"] to support the execution logic of modules such as intent recognition, preference matching, and resource recommendation.
[0049] After question parsing is complete, GCA triggers the Intent Recognition Agent (IRA) to identify the domain module to which the query belongs. During this phase, GCA first evaluates the validity of domain_info , based on criteria including whether cache["domain_info"].freshness is still within the validity window and whether the global state hit rate (GSC hit rate) calculated during the current system operation exceeds a set threshold (e.g., 80%). If domain_info.entry is not empty, its freshness has not expired, and the hit rate meets the threshold, GCA passes domain_info.entry and parsed_query.text as input to IRA. In this case, IRA does not perform a knowledge base query. Instead, it uses a classification model based on the existing domain classification structure to determine the domain index to which the question belongs and outputs domain_index.index. If domain_info is deemed invalid, GCA only passes parsed_query.text to IRA. IRA then uses RAG technology to retrieve the domain information from the knowledge base, generating a new domain_info.entry and providing the corresponding domain_index.index. GCA updates cache["domain_info"].entry and cache["domain_info"].freshness (if updated) accordingly, always writing a new domain_index object, including the domain index and freshness timestamp. At the same time, the current round's domain_index.index is copied to previous_domain_index.
[0050] GCA then checks whether domain_index.index matches the previous_domain_index recorded in the previous round. If they match, the current query is still within the previous domain context. The system can skip the preference matching process without re-triggering the Preference Matching Agent (PMA) or updating the preference state current_preference, thus speeding up the process. If they differ, the PMA is triggered normally to perform preference determination. At this point, GCA triggers the Preference Matching Agent (PMA) to match the user's preferences for the current domain. GCA then performs another two-conditional check: if cache["preference_profile"].user_preferences is not empty, cache["preference_profile"].freshness is not expired, and the GSC hit rate exceeds the threshold, the preference configuration is considered valid. In this case, GCA passes user_preferences and domain_index.index to the PMA, which directly extracts the corresponding user preferences for the current domain based on the domain index and outputs them as a string, current_preference. If a preference configuration is deemed invalid, GCA only passes domain_index.index . PMA then uses the database query API to retrieve the user's preferences for the current domain and returns the complete list for update. Regardless of cache hits, GCA updates cache["current_preference"] and, if a database access is required, refreshes cache["preference_profile"].user_preferences and freshness simultaneously.
[0051] If the complexity of the parsed query output by the SPA is marked as "high," indicating that the query has high resource requirements, the GCA triggers the Resource Retrieval Agent (RRA) to perform the resource matching process. The GCA is passed two parameters: parsed_query.text (for keyword extraction) and resources.content (the total number of resource entries currently cached by the system). The RRA first extracts the keywords from the parsed query and performs a match check in resources.content. If a sufficient number of relevant resources already exist (e.g., containing three or more highly matched entries), these entries are directly selected and written to cache["resources"].current_content, representing the set of resources that can be directly reused by the current query. If the matching results are insufficient, RRA will call an external search tool (such as accessing an external API through an HTTP request), obtain new resource entries based on the keywords, and then write them to resources.current_content for subsequent answer generation. GCA will then append the newly retrieved resource entries to resources.current_content and determine whether it exceeds max_length. If so, it will trim the entries from the earliest entry backwards to keep the total amount of resources within a control range.
[0052] After all dependent states are prepared, the GCA triggers the Response Generation Agent (RGA) to generate the final response. The GCA passes the following state variables as input to the RGA: context.history (for context understanding), current_query (original query), parsed_query (parsed query), domain_info.entry (domain structure information), domain_index.index (domain index), current_preference (user preference), and resources.current_content (the resource corresponding to the current query, available only when complexity is "high"). Based on the domain context, user preferences, and contextual information, the RGA generates a structured and personalized response text, including knowledge-based answers, preference-oriented suggestions, and (if applicable) external resource recommendations. The GCA writes this text to cache["current_response"] and encapsulates it as a historical record of the assistant response type and appends it to context.history. After appending, the round number and token limit are again determined, and necessary history pruning is performed. This completes the current round of the agent collaborative response process, and the system is ready to enter the next round of input monitoring and state-driven cycles.
[0053] Throughout the collaborative process, each agent's execution path is dynamically determined by the dependencies and validity of collaborative states, rather than a fixed pipeline order. This collaborative state-driven mechanism eliminates the need to execute all agent modules during every interaction. Instead, the corresponding module is triggered on demand only when a state is deemed invalid or missing; otherwise, it is skipped. This on-demand collaboration significantly improves the efficiency of multi-agent collaboration, avoids unnecessary redundant computation, and ensures clear and controllable execution logic. Each decision point (such as whether to invoke IRA, PMA, or RRA) is based on a clear state, making system behavior transparent and easy to maintain.
[0054] Furthermore, because GCA centrally manages state reading and writing and agent collaboration, the entire process is highly stable. The system ensures the consistency and integrity of state data at each step: when a module generates a new state update, other modules operate based on the latest state, eliminating errors caused by state desynchronization. This invention, through a state dependency graph-driven multi-agent collaboration method and apparatus, achieves efficient, stable, and intelligent service process collaboration in an open multi-agent service system, significantly enhancing the system's on-demand responsiveness and collaborative capabilities.
[0055] The device uses computer equipment to achieve real-time maintenance of the state dependency graph and agent collaboration, ensuring state consistency in multi-user concurrent scenarios. The system uses distributed caching technology to achieve efficient access to GSCs and supports horizontal scalability to meet service needs of varying scales.
[0056] Furthermore, the present invention provides a global state cache mechanism (GSC) for uniformly storing all collaborative states in a multi-agent system. Collaborative states include, but are not limited to, ten core states: the conversation context, the original query (current_query), the parsed query (parsed_query), the domain structure information (domain_info), the domain index (domain_index), the domain index of the previous conversation (previous_domain_index), the user preference list (preference_profile), the current preference (current_preference), the resource collection (resources), and the resulting response (current_response).
[0057] Each state object in GSC has a well-defined data structure and lifecycle management strategy: Conversational state such as context, current_query, parsed_query, and current_response is refreshed during each conversation. Domain state such as domain_info, domain_index, previous_domain_index, preference_profile, current_preference, and resources can be reused across turns and include a freshness field for invalidation control. All state is written and pruned by GCA, ensuring semantic and structural consistency across the globe, effectively supporting contextual consistency and efficient agent collaboration.
[0058] (1) Session State 1.1. Dialogue context state (context): Used to store historical information during multiple rounds of dialogue, using a dictionary (Dict) data structure, including attributes: history (historical dialogue list): The type is List[Dict[str,str]], which records the content of each round of interaction between the user and the system.
[0059] max_chat_length (maximum number of rounds): type is int, used to limit the maximum number of rounds of historical records to be stored.
[0060] max_token_length (maximum number of tokens): type is int, which controls the maximum total number of tokens in the historical records.
[0061] Update rules: At the end of each round of conversation, the latest round of queries and responses are automatically appended to the end of the history list. If the history records exceed the limit, GCA will automatically prune them and delete the earliest history records to ensure a reasonable scale of context storage.
[0062] 1.2. Current input query state (current_query): Records the query text originally input by the user in each round of dialogue. The data structure is a string (str).
[0063] Update rules: Written directly by the global collaborative agent (GCA) at the beginning of each round of dialogue, overwriting the state of the previous round.
[0064] 1.3. Parsed query state (parsed_query): Stores the clear and clearly structured query after being processed by the semantic parsing agent (SPA), using a dictionary (Dict) data structure, including the following attributes: text (parsed query text): type is str.
[0065] complexity (query complexity): type is str, value is "low" or "high".
[0066] Update rules: After SPA generates the optimization problem and complexity evaluation, GCA immediately writes it to overwrite the original state and updates it once per round of dialogue.
[0067] 1.4. Current round response status (current_response): Records the final response content generated by the response generation agent (RGA), and the data structure is a string (str).
[0068] Update rules: After RGA generates a response, GCA immediately writes the state and appends it to context.history to maintain conversation continuity and historical record integrity. It is updated once per round.
[0069] (2) Domain Status 2.1. Domain structure information state (domain_info): Stores the domains and details of common queries in a dictionary (Dict) data structure. Attributes include: entry (domain structure): type is Any, describing the knowledge structure involved in the domain.
[0070] freshness (last updated time): type is float.
[0071] Update rules: After being generated or updated by the Intent Recognition Agent (IRA), the GCA determines whether it is valid and writes it into the cache. If it exceeds the validity period, it is marked as invalid and triggers an update.
[0072] 2.2. Current query domain number status (domain_index): Specifies the specific index of the current query in the domain structure. The data structure is a dictionary (Dict), and the attributes include: index (field index value): type is int.
[0073] freshness (last updated time): type is float.
[0074] Update rules: Each time IRA outputs a domain index, GCA immediately writes it into the cache for reference by subsequent agents in this round of dialogue. The state is reusable across rounds.
[0075] 2.3. Previous domain number status (previous_domain_index): Stores the domain index determined in the previous round of dialogue. The data structure is an integer (int).
[0076] Update rules: At the end of each round of dialogue, GCA automatically copies the domain_index.index of the current round and updates it to this state. At the beginning of the next round of dialogue, GCA uses this state for reference to determine the continuity of questions and the trend of domain changes, and thus decide whether to skip the preference matching.
[0077] 2.4. User preference list status (preference_profile): Stores the user preference list corresponding to each field, represented by a dictionary (Dict) data structure. Attributes include: user_preferences (preference list): type is List[str].
[0078] freshness (last updated time): type is float.
[0079] Update rules: The preference matching agent (PMA) calls the database and updates it, and the GCA writes it to the cache. When the validity period expires, it is marked as invalid and triggers an update.
[0080] 2.5. Current preference state (current_preference): Stores the user preference determined by PMA in this round, represented by a string (str), defining the answer style and expression of this round.
[0081] Update rules: Each time PMA outputs a preference matching result, GCA immediately writes the result into the state to ensure that the conversation style of this round is stable and effective across rounds.
[0082] 2.6. Resource Collection Status (resources): Stores the resource information pool obtained by the Resource Retrieval Agent (RRA) and the resources matched to the current question. It is managed in a dictionary (Dict) data structure. The attributes include: content (all cached resources): type is List[Dict].
[0083] current_content (resources used by the current query): type is List[Dict].
[0084] max_length (maximum number of characters in the cache): type is int.
[0085] Update rules: After each resource retrieval by RRA, GCA writes it into the cache. GCA is responsible for automatically trimming the resource list according to max_length to ensure that the resource cache size is controlled and allows cross-round reuse.
[0086] All of these state objects are centrally written and lifecycle-managed by the Global Collaborative Agent (GCA). At the end of each conversation round, the GCA automatically triggers a state cleanup routine to purge all state objects that are limited to a single round (such as current_query, parsed_query, and current_response). It also performs invalidation detection and updates for cross-round state objects (such as domain_info, domain_index, previous_domain_index, preference_profile, current_preference, and resources) based on freshness. This automated lifecycle management mechanism ensures that the GSC's state remains valid and semantically consistent, avoiding redundant state object accumulation and ensuring data consistency and efficient collaboration between agents. The device achieves efficient access to the GSC through computing devices, employs in-memory database technology to ensure state access performance, and supports distributed deployment to meet state consistency requirements in high-concurrency scenarios.
[0087] The unified global state caching mechanism brings the following significant advantages: Unified state management and redundancy elimination: Through a centralized state storage architecture, the redundancy and conflict problems caused by multiple agents independently maintaining state variables are eliminated. Each agent only needs to focus on the core functional logic, and the system complexity is greatly reduced.
[0088] The consistency of information sharing between modules is significantly improved: all intelligent agents obtain and update data through unified standardized state objects, effectively eliminating the collaboration barriers caused by information differences between different modules and improving overall collaborative efficiency.
[0089] Highly interpretable data trajectories and collaborative transparency: Each state object carries clear metadata, recording the source agent, update timestamp, and validity period of the state. GCA dynamically drives the agent based on the state dependency chain, forming a transparent and interpretable processing path and data change trajectory, greatly enhancing the system's maintainability and debugging convenience.
[0090] Achieving cross-turn dialogue continuity: In personalized service scenarios, user preferences, domain context, and service resources are maintained across multiple rounds of conversation. During ongoing interactions, users no longer need to repeatedly specify domains or preferences; the system automatically adapts to their personalized service needs, truly achieving an intelligent, assisted experience with "memory."
[0091] The State Dependency Graph (SDG), with collaborative states as nodes, is used to clearly model and dynamically manage the interdependencies between state objects, effectively replacing the traditional static process control model. Each node in the SDG represents a clear collaborative state in the system, and the directed edges between nodes represent the transfer and update relationship of states during the execution of the agent module, forming a dynamically scalable Directed Acyclic Graph (DAG). For example: the execution of the intent recognition agent IRA depends on parsed_query and domain_info.entry; the preference matching agent PMA depends on domain_index.index and preference_profile.user_preferences; if any dependent state fails, the system will actively skip the module or reactivate its upstream agent refresh state.
[0092] The state dependency graph specifically includes the following five state dependency paths: (1) Generation and update of query parsing status: The Global Collaborative Agent (GCA) obtains the dialogue context state (context.history) and the current input query state (current_query) from the Global State Cache (GSC) and passes them to the Semantic Parsing Agent (SPA); SPA performs semantic parsing based on the above two states and generates a parsed query state (parsed_query), which is then returned to GCA and written into GSC.
[0093] (2) Generation and update of intent recognition status: GCA first obtains and determines the validity (freshness) of the domain structure state (domain_info.entry) in GSC; If the status is valid, GCA passes the existing domain_info.entry, context.history and parsed_query.text to the Intent Recognition Agent (IRA). At this time, IRA only determines the domain index status (domain_index.index) based on the existing domain structure entry and returns it to GCA. If the status is invalid, GCA only passes context.history and parsed_query.text to IRA. IRA dynamically retrieves the latest domain structure entry (domain_info.entry) by performing external enhanced retrieval (RAG, Retrieval-Augmented Generation), and then determines the domain index status (domain_index.index) based on this structure. Finally, the two newly generated statuses are returned to GCA, and GCA updates GSC.
[0094] (3) Generation and updating of preference matching status: GCA first determines the validity of the preference list state (preference_profile.user_preferences); If the status is valid, GCA passes the existing preference_profile.user_preferences and the latest domain_index.index to the preference matching agent (PMA). PMA only performs preference matching and returns the current preference status (current_preference). If the status is invalid, GCA only passes the latest domain_index.index to PMA. PMA executes the tool call, queries the preference information corresponding to the current domain through the database interface, generates the current preference status (current_preference), and then returns it to GCA, which further updates the preference list status in GSC.
[0095] (4) Generation and update of resource retrieval status: GCA makes judgments based on the generated parsed_query.complexity status; If the complexity is high (complexity="high"), GCA passes parsed_query.text and the existing resource collection state (resources.content) to the Resource Retrieval Agent (RRA). RRA performs enhanced resource retrieval, updates the resource collection state, and returns it to GCA, which writes it to GSC. If the complexity is low (complexity="low"), GCA directly skips the execution of RRA, the resource collection status is not updated, and the system keeps the existing resource cache unchanged.
[0096] (5) Final generation and update of service response status: GCA integrates the conversation context state (context.history), current query state (current_query), parsed query state (parsed_query), domain structure state (domain_info.entry), domain index state (domain_index.index) and current preference state (current_preference); If the query complexity is previously determined to be high, the GCA will also pass the resource collection state (resources.content) to the response generation agent (RGA) to generate a service response state (current_response) with resource recommendations; If the complexity is previously judged to be low, GCA does not pass the resource collection status, and the service response status generated by RGA does not include additional resource recommendations; Finally, the current_response status returned by RGA is written by GCA to GSC and updated to the context history status (context.history), completing the status update of this round of dialogue.
[0097] The aforementioned state dependency graph mechanism clearly expresses the precise dependencies between collaborative states. Through GCA's dynamic assessment of state validity and query complexity, it enables module path selection and dynamic step-by-step execution. This mechanism not only ensures effective state reuse and updates in multi-round interactions for personalized services, but also significantly reduces redundant module execution, significantly improving overall system response efficiency and conversation continuity, thus achieving the core goal of this invention: intelligent dynamic collaboration driven by collaborative states.
[0098] A state validity judgment mechanism that combines freshness and hit rate. When determining whether a collaborative state is reusable, the system no longer uses freshness (timestamp) as the sole criterion, but also considers the hit rate indicators of key states in GSC. The GSC hit rate provides a global perspective, indicating the overall reliability of the cache system. The dynamic calculation process of the hit rate is limited to the domain_info and preference_profile in the task-class state, and counts whether they have been effectively reused in recent accesses. GCA can only reuse the state if the freshness has not expired and the hit rate is greater than the set threshold (such as 80%). Otherwise, it triggers the upstream intelligent weight execution and updates the state data.
[0099] To dynamically evaluate the overall reliability and availability of the Global State Cache (GSC), this paper proposes the following hit rate evaluation mechanism. Specifically, it performs joint statistics on two key task-specific state variables, domain_info and preference_profile, which have the characteristics of freshness and cross-round reuse.
[0100] Define symbols: : Cumulative number of visits to domain_info : Cumulative hit count of domain_info : Cumulative number of visits to preference_profile : The cumulative number of hits of preference_profile Then, the global collaborative state cache hit rate The calculation formula is: in: The hit condition is defined as: the state freshness is valid and actually reused by GCA; Access is defined as: GCA makes a validity check on the state (regardless of whether it is reused).
[0101] Instructions for use: like ,The overall cache state of the system is reliable and can continue to execute according to the current collaborative path; like , the system will consider the cache credibility too low, and GCA will force the upstream agent to re-execute the refresh status. Recommended default threshold: This hit rate indicator is a global reference for GCA to judge collaborative stability and control state refresh. It is suitable for service scenarios with multiple rounds of conversations, frequent domain switching, or large fluctuations in cache quality. It is an important foundation for the system to achieve responsive and refined collaboration.
[0102] To ensure the timeliness of the cached status, this system introduces a freshness field to mark the last update time of each task class collaboration status. The system compares this value with the current time to determine whether it is expired.
[0103] Define symbols: Current system timestamp (unit: seconds); The freshness field of the state, which is the last updated timestamp; The maximum effective retention time of the status (system preset threshold); freshness A boolean value indicating whether the freshness has expired.
[0104] The judgment formula is as follows: Or in mathematical expression form: Parameter Description: This freshness determination formula applies to all state variables with freshness fields in the system, such as domain_info, domain_index, and preference_profile, and serves as the fundamental logic for GCA state determination and path scheduling. It can be combined with the GSC hit rate determination mechanism to form a composite determination condition, ensuring state reliability and timeliness.
[0105] In the present invention, to determine whether a task-type collaboration state (such as domain_info or preference_profile) is valid, two conditions must be met simultaneously: ① Freshness: not expired; ② The GSC hit rate is higher than the threshold.
[0106] set up: : Current system timestamp (seconds) : The timestamp of the last update of the state (i.e., freshness value) : Maximum effective duration of the status :The status is recently Hit rate per visit : The minimum hit rate threshold set by the system (such as 0.80) : Status validity (Boolean value, True indicates the status is valid) The joint judgment formula is as follows: Parameter Description: This mechanism maintains the fundamental control of freshness over time validity while also introducing a global perspective to determine the actual usage of state. This solves the problem of frequently accessed but no longer applicable state remaining unresolved, significantly improving the overall system state reliability and call efficiency. All state update operations—including freshness refresh, variable writing, context pruning, and resource list maintenance—are executed by the GCA, while other agents can only read. This unified management logic ensures the consistency and correctness of state updates across any round of dialogue.
[0107] A global collaborative agent (GCA) provides sole control and domain coherence awareness. The GCA is the only core agent in the system with state read / write permissions and collaborative control. Its responsibilities include receiving user input, updating context, pruning history, maintaining GSC hit rate statistics, triggering functional agents, determining state validity, deciding module execution, executing writes, refreshing, and appending response results. The GCA serves not only as an information coordinator but also as the sole updater of the execution chain, ensuring that each collaborative process operates within a unified semantic structure.
[0108] After each round of execution, GCA copies the current domain_index.index to the previous_domain_index, which is used in subsequent rounds to determine domain continuity. If the domain_index in a new round of conversation is the same as the previous_domain_index, the system assumes that the user is asking consecutive questions within the same domain context. GCA skips the redundant updates to the PMA's preference matching and resource structure and directly enters the response phase or resource replenishment phase. This enables domain-aware, step-by-step execution, significantly reducing duplicate calls and response delays. This mechanism, based solely on the state of variables in GSC, demonstrates the high autonomy and data-awareness of state-driven systems.
[0109] A structured preference matching mechanism is provided, executed by the Preference Matching Agent (PMA). The PMA extracts user preference information for the domain based on domain_index.index and preference_profile.user_preferences. Before invoking the PMA, the GCA determines the validity of the preference list, based on freshness and GSC hit rate. If the list is invalid or the hit rate is insufficient, the PMA retrieves the preference list from the database and updates the GSC, ensuring that preference targeting for the current domain remains accurate.
[0110] In terms of service response, this mechanism generates differentiated service response strategies based on user preferences within specific service scenarios (e.g., prioritizing technical depth or cost-effectiveness), enabling personalized service solutions that "match content to preferences." For example, technically oriented users receive more professional explanations and resources, while cost-effective users prioritize practicality and cost-benefit analysis. Through preference-driven intelligent judgment, the system provides personalized service paths while maintaining semantic consistency, serving as one of the core mechanisms for achieving deep adaptation of AI services.
[0111] The provided Response Generation Agent (RGA) generates responses based on the complete state view provided by the system. Its input includes: conversation history context.history, current query current_query, parsed query parsed_query, domain structure domain_info.entry (covering the entire service domain division information), domain index domain_index.index (specifically corresponding to the domain number of the current query), current preference current_preference, and recommended resources resources.current_content under complex query conditions.
[0112] By integrating the above-mentioned structured states, the RGA agent comprehensively considers context continuity, query semantic parsing results, clear user preferences and multi-domain associations, and outputs structured, hierarchical, and personalized AI service responses. The system design does not encourage unified template output, but emphasizes diversified responses guided by multi-dimensional states. The responses generated by RGA are not limited to basic content, but also include service progress suggestions, cross-domain knowledge association reminders, comments from preferred perspectives, and resource recommendation embeddings, which can effectively adapt to the actual needs of users at different domain nodes, preference configurations, and demand levels. This structural and personalized multi-domain comprehensive consideration mechanism is a fundamental upgrade of traditional question-answering AI systems in service scenarios, ensuring that each round of feedback has context continuity, domain integrity, and scenario adaptability.
[0113] In a specific embodiment, the following implementation is also provided: Solution 1: Domain Identification and Preference-Driven Intelligent Services The user enters the query: "How should I choose a database solution for this project?" The Global Collaborative Agent (GCA) first receives this natural language query, writes it to cache["current_query"], and appends it to the context cache["context"].history. The GCA then triggers the Semantic Parsing Agent (SPA) to perform query parsing, generating a parsed query: "How should I choose a suitable database solution for project development?" It evaluates its complexity as "high" and writes it to parsed_query.
[0114] The GCA then determines whether domain_info is reusable. Since its freshness hasn't expired and the cache hit rate is 85%, it's deemed valid and directly passes it along with the parsed query to the Intent Recognition Agent (IRA). The IRA identifies the query as belonging to "Database Schema Design" and outputs domain index 3. The GCA then updates domain_index.index.
[0115] GCA then checks whether the domain in the previous round is index 3. Finding a difference, the preference matching process must be re-executed. Because preference_profile.freshness has expired, GCA triggers the Preference Matching Agent (PMA). The PMA queries the database for the user's preference list under each domain and discovers that the user prefers "High Performance First" in domain 3. Based on this information, GCA updates current_preference and preference_profile.user_preferences and resets preference_profile.freshness.
[0116] Because the query complexity is high, GCA triggers the Resource Retrieval Agent (RRA). The RRA extracts the keywords "database, solution selection" and doesn't find enough entries in the existing resources. Therefore, it triggers an external API call, retrieves three technical document resource entries, and updates resources.current_content and resources.content.
[0117] Finally, GCA triggers the Response Generation Agent (RGA), which takes the context, current_query, parsed_query, domain_info, domain_index, current_preference, and resources.current_content as input. RGA generates a structured response with technical solution suggestions, hints related to high-performance preferences, and recommended technical documentation. GCA updates current_response and writes it into the context, completing a preference-aware service response loop.
[0118] Solution 2: Hit cache to accelerate path skipping The user performed two consecutive queries: the first asking "How should system API interface specifications be designed?" and the second asking "How should interface permissions be controlled?" After GCA completed the first round, it generated domain_index = 4 and wrote it to previous_domain_index.
[0119] At the start of the second round, GCA receives a new query and writes it to current_query. It then appends it to the context and calls SPA to resolve the query, which is "How to design access control based on the RESTful API specification." The complexity is still "high." At this point, GCA determines that domain_info.freshness has not expired, maintaining a hit rate of 90%, indicating successful reuse. The IRA outputs domain index 4.
[0120] GCA immediately compares domain_index with previous_domain_index. If a match is found, it determines that the user is performing consecutive queries within the same domain context. Therefore, GCA skips the PMA preference matching process and reuses the previous round's current_preference ("security first"), avoiding the need to re-retrieve preference or resource information.
[0121] Because the query complexity is high, GCA still calls RRA, but finds that the resources retrieved in the previous round of retrieval can be used as matching resources for the current query keywords. It directly uses resources.current_content from the previous round, eliminating the need to call the external API again, saving delays and costs.
[0122] Finally, RGA generates a personalized response based on the current context and the previous round of states, which is structurally consistent, semantically coherent, and includes security design recommendations. This realizes "state inheritance and step-by-step execution" in continuous domain scenarios, demonstrating the efficiency of the state-driven mechanism.
[0123] Solution 3: Forced refresh and structure update after state failure The user enters the query "How do I perform API performance testing?" After receiving the query, GCA triggers the SPA normally, interprets it as "How do I design an API performance testing solution?", and assesses its complexity as low. GCA then checks the domain status freshness value and finds that domain_info.freshness has exceeded its maximum validity window. The hit rate has also dropped to 65%, failing to meet the reusability criteria.
[0124] GCA decides to trigger the RAG retrieval process of IRA. IRA retrieves the service domain division information from the knowledge base and recognizes that the query belongs to the "performance testing" domain, corresponding to the domain index 4. The system updates domain_info.entry, domain_index.index, and related freshness.
[0125] GCA then evaluates the preference list. Although freshness hasn't expired, the GSC hit rate is below 80%. This triggers PMA to retrieve the latest preference information from the database. PMA identifies the user's preference as "high precision first" in the current domain and updates preference_profile and current_preference accordingly.
[0126] Because the query complexity is low, GCA skips resource retrieval and only passes context, current_query, parsed_query, domain_info, domain_index, and current_preference to RGA. Based on the "high accuracy first" preference, RGA generates test plan designs, tool configuration recommendations, and optimized parameter settings. GCA writes current_response and appends it to the context.
[0127] This example demonstrates the system's state reconstruction mechanism when freshness exceeds the limit and hit rate fails, ensuring that the final output is current, preference consistent, and domain-adaptive.
[0128] Solution 4: Concurrent processing of different tasks and reuse of state slices The user issues three queries in succession in one round: First query: "How to optimize image processing performance?" Second query: "How to configure system security policy?" The third query: "Recommend several high-availability database solutions" GCA receives the three queries sequentially and writes the corresponding current_query and context.history segments, executing three rounds of state scheduling concurrently through multi-threading. Each domain will independently maintain a GSC state snapshot, which is managed synchronously under the multi-threaded concurrent structure: The first query triggers SPA and is identified as the "image processing optimization" domain, with domain index 5, preference "performance first", and complexity high, triggering RRA to retrieve optimization technical documents.
[0129] The second query identifies the "System Security Configuration" domain, domain index 2, preference "Security First", complexity low, and directly skips RRA.
[0130] The third query identifies the "Database Selection" domain, with a domain index of 6, a preference of "Reliability First," and a complexity of high, and searches for technical white paper resources.
[0131] The execution processes of the three agents are independently controlled by GCA, using an asynchronous thread scheduling mechanism. Each domain executes a minimal workflow per state, mobilizing resources and updating state on demand. Ultimately, the system concurrently completes the multi-goal execution of domain identification, preference perception, and resource generation within three rounds of dialogue, significantly improving throughput and response parallelism.
[0132] The four schemes described above fully demonstrate the intelligent expressiveness of the system of the present invention in terms of state-driven, dynamic collaboration, domain preference perception and resource adaptation. Each embodiment not only demonstrates the practical application advantages of the present invention in intelligent service scenarios, but also verifies its technical capabilities of efficient execution and personalized response in large-scale service requests. Any technician familiar with this profession can perform functional expansion, state structure adjustment or intelligent body function reuse under the technology of the present invention. Any equivalent improvements that do not deviate from the essence of the technology of the present invention should fall within the scope of protection of the present invention.
[0133] A specific implementation process is also provided as follows: Workflow In this system, after each round of a user entering a natural language query at the terminal, the Global Collaboration Agent (GCA) first initializes the conversation state. The GCA writes the current query to cache["current_query"] and encapsulates it as a structured history record { "role": "user", "content": current_query} , appending it to cache["context"].history. The GCA also checks whether the conversation history exceeds the system-defined max_chat_length (maximum number of rounds) and max_token_length (maximum number of tokens). If so, the history record is automatically pruned from the beginning to the end. After preparing the conversation state for the current round, the GCA triggers the Semantic Parsing Agent (SPA) to initiate question resolution.
[0134] SPA receives two state inputs from GCA: cache["current_query"] and cache["context"].history. Using a pre-set prompt word template and semantic embedding model, SPA performs semantic expansion and contextual completion on the current query, outputting a structured parsed query object. The text attribute represents the optimized natural language question, and the complexity attribute is an enumeration type ("low" or "high"), which is used to determine whether resource retrieval is required. After receiving the SPA output, GCA writes it to cache["parsed_query"] to support the execution logic of modules such as intent recognition, preference matching, and resource recommendation.
[0135] After question parsing is complete, GCA triggers the Intent Recognition Agent (IRA) to identify the domain module to which the query belongs. During this phase, GCA first evaluates the validity of domain_info , based on criteria including whether cache["domain_info"].freshness is still within the validity window and whether the global state hit rate (GSC hit rate) calculated during the current system operation exceeds a set threshold (e.g., 80%). If domain_info.entry is not empty, its freshness has not expired, and the hit rate meets the threshold, GCA passes domain_info.entry and parsed_query.text as input to IRA. In this case, IRA does not perform a knowledge base query. Instead, it uses a classification model based on the existing domain classification structure to determine the domain index to which the question belongs and outputs domain_index.index. If domain_info is deemed invalid, GCA only passes parsed_query.text to IRA. IRA then uses RAG technology to retrieve the domain information from the knowledge base, generating a new domain_info.entry and providing the corresponding domain_index.index. GCA updates cache["domain_info"].entry and cache["domain_info"].freshness (if updated) accordingly, always writing a new domain_index object, including the domain index and freshness timestamp. At the same time, the current round's domain_index.index is copied to previous_domain_index.
[0136] GCA then checks whether domain_index.index matches the previous_domain_index recorded in the previous round. If they match, the current query is still within the previous domain context. The system can skip the preference matching process without re-triggering the Preference Matching Agent (PMA) or updating the preference state current_preference, thus speeding up the process. If they differ, the PMA is triggered normally to perform preference determination. At this point, GCA triggers the Preference Matching Agent (PMA) to match the user's preferences for the current domain. GCA then performs another two-conditional check: if cache["preference_profile"].user_preferences is not empty, cache["preference_profile"].freshness is not expired, and the GSC hit rate exceeds the threshold, the preference configuration is considered valid. In this case, GCA passes user_preferences and domain_index.index to the PMA, which directly extracts the corresponding user preferences for the current domain based on the domain index and outputs them as a string, current_preference. If a preference configuration is deemed invalid, GCA only passes domain_index.index . PMA then uses the database query API to retrieve the user's preferences for the current domain and returns the complete list for update. Regardless of cache hits, GCA updates cache["current_preference"] and, if a database access is required, refreshes cache["preference_profile"].user_preferences and freshness simultaneously.
[0137] If the complexity of the parsed query output by the SPA is marked as "high," indicating that the query has high resource requirements, the GCA triggers the Resource Retrieval Agent (RRA) to perform the resource matching process. The GCA is passed two parameters: parsed_query.text (for keyword extraction) and resources.content (the total number of resource entries currently cached by the system). The RRA first extracts the keywords from the parsed query and performs a match check in resources.content. If a sufficient number of relevant resources already exist (e.g., containing three or more highly matched entries), these entries are directly selected and written to cache["resources"].current_content, representing the set of resources that can be directly reused by the current query. If the matching results are insufficient, RRA will call an external search tool (such as accessing an external API through an HTTP request), obtain new resource entries based on the keywords, and then write them to resources.current_content for subsequent answer generation. GCA will then append the newly retrieved resource entries to resources.current_content and determine whether it exceeds max_length. If so, it will trim the entries from the earliest entry backwards to keep the total amount of resources within a control range.
[0138] After all dependent states are prepared, the GCA triggers the Response Generation Agent (RGA) to generate the final response. The GCA passes the following state variables as input to the RGA: context.history (for context understanding), current_query (original query), parsed_query (parsed query), domain_info.entry (domain structure information), domain_index.index (domain index), current_preference (user preference), and resources.current_content (the resource corresponding to the current query, available only when complexity is "high"). Based on the domain context, user preferences, and contextual information, the RGA generates a structured and personalized response text, including knowledge-based answers, preference-oriented suggestions, and (if applicable) external resource recommendations. The GCA writes this text to cache["current_response"] and encapsulates it as a historical record of the assistant response type and appends it to context.history. After appending, the round number and token limit are again determined, and necessary history pruning is performed. This completes the current round of the agent collaborative response process, and the system is ready to enter the next round of input monitoring and state-driven cycles.
[0139] Each agent not only possesses independent structured input and output specifications but also comes equipped with task-specific prompt templates and a highly adaptable open-source language model sub-base. The system configures different open-source models for each agent based on the required reasoning complexity, retrieval capabilities, or generation quality of each task. For example, SPA and IRA utilize instruction-tuned models with strong structure understanding capabilities (such as ChatGLM instruction version and Mistral-Instruct), RRA utilizes lightweight models with entity recognition and keyword extraction capabilities (such as the GTE small model), and RGA utilizes large-scale conversational models with multi-turn context integration capabilities (such as the Qwen2.5-72B-128k large language model). Furthermore, a detailed system prompt and input template structure is designed for each agent to ensure clear task intent and stable and targeted semantic generation. This integrated "task-model-prompt" agent design concept is the key technical support for achieving high-performance personalized responses in this invention.
[0140] The Global Collaboration Agent (GCA) is the collaborative hub of the entire multi-agent system. It coordinates the execution order of each agent, determines the availability of collaborative state, and manages the reading and updating of all state variables. The model selected is the open-source Qwen2.5-7B-Instruct (instruction fine-tuning model for state management and collaborative decision-making). At the beginning of each conversation, the GCA receives the user's natural language query, writes it to cache["current_query"], and appends it to cache["context"].history with the structure { "role": "user", "content": current_query} . After adding the history record, the system immediately checks the context's constraints, max_chat_length and max_token_length, to ensure that the configured limits are not exceeded, performing forward pruning if necessary. Before each agent invocation, the GCA reads the relevant state variables and determines whether the state is reusable based on its freshness and the system-maintained GSC hit rate. If the conditions are not met, the corresponding agent is triggered to regenerate the information. All collaborative states—including context, queries, domains, preferences, resources, and responses—are centrally created and written by the GCA. Its control logic and coordination capabilities are the foundation of the entire state-driven architecture. Furthermore, to support consistent recognition of domain states across rounds of dialogue, the GCA writes the domain index to cache["previous_domain_index"] after each round's domain_index.index update. This serves as a record of the previous round's domain index, enabling subsequent decision-making regarding whether to reuse preference and resource states. If the system detects that the domain index matches the previous round's (domain_index.index == previous_domain_index), it can skip the Preference Matching Agent (PMA) and re-retrieval of some resource states, directly proceeding to resource retrieval or response generation, provided the logical prerequisites are met. This mechanism significantly improves the system's responsiveness in continuous query scenarios while maintaining contextual consistency within the service domain's semantics. It is a key manifestation of the core capabilities of the global collaborative agent and demonstrates the system's ability to perceive domain coherence.
[0141] The Semantic Parsing Agent (SPA) is primarily responsible for structured parsing and optimizing the original user-entered query. The model used is the open-source ChatGLM3-6B model (suitable for Chinese semantic expansion and context awareness). The SPA retrieves the current query and its context from cache["current_query"] and cache["context"].history passed in by the GCA. Based on a pre-defined prompt word template and semantic embedding model, the SPA converts ambiguous, incomplete, or highly context-dependent queries into clear and specific text. The parsed result consists of two parts: the text field records the optimized complete natural language query, and the complexity field indicates the query's complexity, with an enumeration value of "low" or "high" and is used to determine whether resource retrieval is required. This parsed result is directly passed back to the GCA, which writes it to the cache["parsed_query"] state, forming an important foundation for subsequent intent recognition and resource retrieval.
[0142] The Intent Recognition Agent (IRA) identifies the service domain corresponding to the parsed query, supporting preference matching and subsequent content generation. The selected model combination includes the open-source ChatGLM3-6B-Instruct domain classification model (which accurately classifies parsed queries into their corresponding domain modules and outputs domain indexes); and the open-source m3e-base knowledge base retrieval and embedding model (which uses the RAG method to re-retrieve and update domain structure information from the knowledge base when the cache is invalidated (freshness timeout or insufficient GSC hit rate). Before triggering the IRA, the GCA first checks the validity of the cache["domain_info"] state. If its entry field is not empty and its freshness has not expired, and the current system-maintained GSC hit rate (calculated by hit statistics between domain_info and preference_profile) exceeds a set threshold (typically 80%), the GCA will pass the existing domain_info.entry and parsed_query.text to the IRA. At this point, IRA does not need to call the knowledge base for retrieval; it only uses the domain classification model to complete the judgment and output domain_index.index. If any of the above conditions are not met, GCA only passes parsed_query.text. IRA must access the domain knowledge base based on RAG technology, retrieve and generate a new domain_info.entry, and update the domain index based on the search results. IRA output data is written uniformly by GCA: if there is new domain information, cache["domain_info"].entry and freshness are updated; regardless of whether the cache is hit, cache["domain_index"].index and the corresponding freshness are updated.
[0143] The Preference Matching Agent (PMA) is responsible for determining the user's personalized preference profile for the current domain, such as preference labels like "prioritizing cost-effectiveness" or "prioritizing technical depth." The selected model is the open-source Qwen2.5-14B-Chat model (based on the Qwen2.5 series, which excels in tool invocation capabilities, reasoning, and decision logic, making it particularly suitable for interacting with external databases through function call interfaces). Before activating the PMA, the GCA evaluates the validity of cache["preference_profile"]. If user_preferences is not empty, its freshness has not expired, and its GSC hit rate meets the required criteria, the PMA directly matches the preference list with the current domain index (domain_index.index). The PMA extracts the preference information for the current domain from the preference list and returns the string value current_preference. If a match fails, the GCA only passes domain_index.index. The PMA then calls the database to retrieve the user's preference information for each domain, generates a new user_preferences, and extracts the current preference. Finally, GCA writes the returned current_preference to cache["current_preference"] and updates cache["preference_profile"].user_preferences and freshness when there is a new list.
[0144] The Resource Retrieval Agent (RRA) is the system's module responsible for assisting with resource matching. It executes only when the parsed query is marked as complex (complexity == "high"). Select the open-source model: Alibaba-NLP / gte-large-zh (Chinese keyword extraction and semantic search model). GCA passes parsed_query.text and resources.content as input parameters to the RRA. The RRA first uses the keyword extraction module to identify query terms and searches for matching entries in the existing resource cache. If the number of matching resources exceeds a system-defined threshold (e.g., three), these entries are directly written to cache["resources"].current_content, representing the set of resources that can be directly reused by the current query. If the number of matching resources is insufficient, the RRA performs external search tasks through a tool call mechanism, such as accessing an API interface to obtain new resources, and writes the returned results to current_content. GCA then updates resources.content to a cumulative resource pool. GCA then checks the overall length of resources.content. If it exceeds the max_length limit, it performs resource pruning and retains the latest entries to control memory usage.
[0145] The Response Generation Agent (RGA) is responsible for generating the final response. Its core capability lies in integrating all collaborative states into personalized feedback that is context-aware, preference-adapted, and domain-matched. The selected model is the open-source Qwen2.5-72B-128K model (suitable for generating complex multi-turn conversations that integrate domains, preferences, and context). The RGA receives the following state inputs from the GCA: conversation context context.history, current query current_query, parsed query text parsed_query.text, domain structure information domain_info.entry, domain index domain_index.index, current preference current_preference, and, if the query is complex, the resource collection resources.current_content. By integrating domain semantics, user preferences, and personalized features, the RGA generates detailed response text tailored to the current service objective. This response may include explanations of specialized content, strategic suggestions, or resource recommendations. After the response content is returned to GCA, it is written into cache["current_response"] and appended to context.history, becoming a new round of assistant role speech, completing a complete interactive closed loop.
[0146] For the same example as above, please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a terminal provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the system comprises a processor, an input device, an output device and a memory, which are connected to each other, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions, and the program includes instructions for executing the following steps; The global collaborative agent receives the query text input by the user; The semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent calls the preference matching agent to generate preference information; The global collaborative agent calls the resource retrieval agent to obtain the query resource information corresponding to the query text according to the query complexity; The response generation agent generates query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information.
[0147] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to implement the above functions, the terminal includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of the various examples described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0148] The embodiment of the present application can divide the terminal into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.
[0149] In line with the above, please see Figure 3 , Figure 3 The present invention provides a schematic diagram of a multi-agent collaborative query response system based on a state dependency graph. Figure 3As shown, the multi-agent collaborative query response system includes: a global collaborative agent 301, a semantic parsing agent 302, an intention recognition agent 303, a preference matching agent 304, a resource retrieval agent 305 and a response generation agent 306, as follows: The global collaborative agent 301 is used to receive the query text input by the user; The semantic parsing agent 302 is used to perform query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent 301 is used to determine that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmit the current domain structure information and the parsed query text to the intent recognition agent 303, instructing the intent recognition agent 303 to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent 303 to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent 301 is also used to call the preference matching agent 304 to generate preference information; The global collaborative agent 301 is also used to call the resource retrieval agent to obtain the query usage resource information corresponding to the query text according to the query complexity; The response generation agent 306 is used to generate query response information based on at least the historical context of the query text, the query text, the parsed query text, the domain structure information, the domain index, the preference information, and the query resource information.
[0150] In a possible implementation, the global collaborative agent 301 is specifically configured to: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
[0151] In a possible implementation, the global collaborative agent 301 is specifically configured to: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
[0152] In one possible implementation, the global state cache is used to cache a global state dependency graph, which includes the collaborative states of a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global state cache is used to cache the historical context of the text to be queried, the text to be queried, the parsed text to be queried, domain structure information, domain index, preference information, query resource information and query response information; The global state cache implements differentiated lifecycle management based on state classification.
[0153] In one possible implementation, the global state dependency graph is used to represent the agents and collaboration states in a multi-agent collaborative query response system; Each node in the global state dependency graph represents a collaborative state, and each directed edge represents the necessary dependency of the collaborative state on the execution of the intelligent agent.
[0154] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables the computer to execute part or all of the steps of any multi-agent collaborative query response method based on a state dependency graph as recorded in the above method embodiments.
[0155] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program enables a computer to execute part or all of the steps of any multi-agent collaborative query response method based on a state dependency graph as recorded in the above method embodiments.
[0156] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0157] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0158] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0159] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0160] In addition, the functional units in the various embodiments of the application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software program modules.
[0161] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, magnetic disk, or optical disk, etc., various media that can store program code.
[0162] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
[0163] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A multi-agent collaborative query response method based on a state dependency graph, characterized in that: The method is applied to a multi-agent collaborative query response system based on a state dependency graph, wherein the multi-agent collaborative query response system based on a state dependency graph includes: a global collaborative agent, a semantic parsing agent, an intent recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent. The global collaborative agent receives the query text input by the user; The semantic parsing agent performs query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent determines that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmits the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent calls the preference matching agent to generate preference information; The global collaborative agent calls the resource retrieval agent to obtain the query resource information corresponding to the query text according to the query complexity; The response generation agent generates query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information.
2. The multi-agent collaborative query response method based on state dependency graph according to claim 1 is characterized in that: The global collaborative agent calls the preference matching agent to generate preference information, including: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
3. The multi-agent collaborative query response method based on state dependency graph according to claim 2 is characterized in that: The global collaborative agent calls the resource retrieval agent to obtain the query resource information corresponding to the query text according to the query complexity, including: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
4. The multi-agent collaborative query response method based on a state dependency graph according to any one of claims 1 to 3, characterized in that: The global state cache is used to cache the global state dependency graph, which includes the collaborative states of the global collaborative agent, the semantic parsing agent, the intention recognition agent, the preference matching agent, the resource retrieval agent and the response generation agent; The global state cache is used to cache the historical context of the text to be queried, the text to be queried, the parsed text to be queried, domain structure information, domain index, preference information, query resource information and query response information; The global state cache implements differentiated lifecycle management based on state classification.
5. The multi-agent collaborative query response method based on state dependency graph according to claim 4 is characterized in that: The global state dependency graph is used to characterize the agents and collaboration states in the multi-agent collaborative query response system; Each node in the global state dependency graph represents a collaborative state, and each directed edge represents the necessary dependency of the collaborative state on the execution of the intelligent agent.
6. A multi-agent collaborative query response system based on a state dependency graph, characterized in that: The multi-agent collaborative query response system includes: a global collaborative agent, a semantic parsing agent, an intention recognition agent, a preference matching agent, a resource retrieval agent, and a response generation agent; The global collaborative agent is used to receive the query text input by the user; The semantic parsing agent is used to perform query semantic parsing on the query text to obtain the parsed query text and query complexity; If the last update time is valid and the overall hit rate of the global state cache is higher than the preset hit rate threshold, the global collaborative agent is used to determine that the current domain structure information is the domain structure information corresponding to the text to be queried, and transmit the current domain structure information and the parsed query text to the intent recognition agent, instructing the intent recognition agent to generate a domain index; otherwise, the parsed query text is transmitted to the intent recognition agent, instructing the intent recognition agent to generate a domain index, and the global state cache includes a global state dependency graph; The global collaborative agent is also used to call the preference matching agent to generate preference information; The global collaborative agent is also used to call the resource retrieval agent to obtain the query resource information corresponding to the query text according to the query complexity; The response generation agent is used to generate query response information based on at least the historical context of the text to be queried, the text to be queried, the parsed text to be queried, the domain structure information, the domain index, the preference information, and the query usage resource information.
7. The multi-agent collaborative query response system based on state dependency graph according to claim 6 is characterized in that: The global collaborative intelligent agent is specifically used to: The global collaborative agent determines whether the user preference list status is valid. If the last update time is within the validity period and the hit rate is higher than the preset hit rate threshold, the user preference list is reused and the preference matching agent is called to generate preference information. Otherwise, the preference matching agent accesses the database to obtain preference information and updates the preference information.
8. The multi-agent collaborative query response method based on state dependency graph according to claim 7 is characterized in that: The global collaborative agent is specifically used for: If the query complexity is high, the global collaborative agent calls the resource retrieval agent to determine whether the resources exceed the preset threshold based on all cached resources and the query keywords in the query text. If so, the matching results are written to the current query usage resources to obtain the query usage resource information corresponding to the text to be queried; otherwise, the external API interface is called to retrieve the query usage resource information corresponding to the text to be queried through the query keyword.
9. A terminal, characterized in that: It includes a processor, an input device, an output device and a memory, and the processor, input device, output device and memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the multi-agent collaborative query response method based on the state dependency graph as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the multi-agent collaborative query response method based on a state dependency graph as described in any one of claims 1 to 5.
Citation Information
Cited By
Task complexity driven graph semantic multi-agent collaborative decision-making method and system
CN120950220A
Interaction method and device based on intelligent agent, intelligent agent and storage medium
CN121434453A
Multi-agent collaborative reasoning voice search system based on user characteristics
CN121479017A
Question and answer retrieval method and device based on multiple agents
CN121722864A