A multi-agent task data processing method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-08-11
AI Technical Summary
[0007]本发明要解决的技术问题是提供一种多智能体任务数据处理方法和系统,以解决单智能体在异步任务数据结构性残缺的语义碎片化状态下,盲目推理造成的计算资源无效损耗以及全量回滚重算代价过高的问题;所述结构性残缺是指当前已到达的异步任务数据在语义结构上缺少返回结构、异常分支或依赖字段等结构要素,而非数据在时间上延迟到达或在到达顺序上存在先后
本发明通过在目标智能体内部构建语义完整度评估、虚拟分支上下文生成、前瞻推理、真实上下文校验以及局部重算的连续处理链路,能够有效缓解单智能体在处理碎片化异步任务数据时面临的资源利用率与处理准确性难以兼顾的问题。目标智能体在接收到待处理的异步任务数据后,并不直接启动完整解析和推理流程,而是先通过语义完整度评估模型计算当前数据具备继续处理条件的概率评分,并将该概率评分作为语义完整度水位。通过这种方式,目标智能体可以先判断当前数据是否已经具备基本语义结构,避免在上下文明显不足时盲目推理,也避免在已有数据具备处理价值时长期等待。
Smart Images

Figure CN122548673A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer data processing, and more specifically, to a multi-agent task data processing method and system. Background Technology
[0002] With the evolution of distributed computing architectures, multi-agent collaborative processing models have been widely applied in complex business systems. In multi-agent systems, individual agent nodes interact with data and delegate tasks asynchronously. In currently widely adopted data processing logic, the target agent typically passively receives task fragments sent by other associated agents and performs aggregation, parsing, and inference tasks locally.
[0003] Among the published patent documents, the invention patent CN110851248B, entitled "Asynchronous Task Data Processing Method, Apparatus, and Computer-Readable Storage Medium," proposes a processing scheme that inputs asynchronous task data to be processed into a pre-built asynchronous message server containing producers, managers, and consumers for aggregation and consumption subscription. Another invention patent, CN111831408A, entitled "Asynchronous Task Processing Method, Apparatus, Electronic Device, and Medium," discloses a scheme for establishing an asynchronous task queue and selecting appropriate computing nodes to allocate computing tasks to each asynchronous task based on task information. These prior technologies generally focus on routing and distributing asynchronous task flows and managing queues globally at the system's macro-level.
[0004] However, at the micro-level of single-agent execution, existing asynchronous task processing methods still have significant shortcomings. In multi-agent systems, task data typically does not arrive at the target agent all at once, but is submitted in batches by different agents according to their respective execution schedules. Affected by factors such as network latency, task scheduling order, and differences in processing time of upstream nodes, the data received by the target agent at any given time is often only a part of the complete task context. For example, the current data may only contain the interface name and some input parameter fields, lacking return structures, exception branches, dependency fields, or subsequent process nodes. It should be noted that this incompleteness does not merely refer to the fact that the complete data has not arrived in full or in a specific order, but rather that the data that has already arrived itself has gaps in its semantic structure, lacking structural elements such as return structures, exception branches, or dependency fields necessary to form a parsable and inferable context. At this point, although the target agent has obtained some usable information, this information is insufficient to directly constitute a complete parsing and inference context.
[0005] In the above scenario, the target agent needs to make trade-offs regarding processing timing. If the target agent chooses to wait for all context data to arrive before initiating the parsing and inference process, it can reduce processing bias caused by missing context. However, this will leave the already arrived data in a waiting state for an extended period, causing pipeline stagnation and idle computing resources, which can easily lengthen the overall response latency, especially in high-concurrency task scenarios. If the target agent chooses to start processing directly based on fragmented data when the context is incomplete, it can improve the utilization of computing resources and shorten the response time of some tasks. However, since the missing data has not yet been confirmed, the initial inference results may be based on inaccurate structural assumptions. Once the subsequent supplementary actual data is inconsistent with the initial estimates, the system usually needs to undo the generated intermediate states and re-parse and recalculate the relevant logic.
[0006] Therefore, current technologies still lack a data processing mechanism for single-agent execution processes that can determine whether the current data has the semantic conditions to continue processing when the asynchronous task data is incomplete, and support limited look-ahead processing using reusable structural templates when the conditions are insufficient; simultaneously, when subsequent real supplementary data arrives and deviations in the previous processing are discovered, it can accurately locate the affected local area instead of directly performing a global rollback and full recalculation. In other words, current technologies cannot effectively balance computational resource utilization, inference accuracy, and deviation correction costs under semantic fragmentation. Summary of the Invention
[0007] The technical problem to be solved by this invention is to provide a multi-agent task data processing method and system to solve the problems of ineffective consumption of computing resources and excessive cost of full rollback and recalculation caused by blind reasoning in the semantic fragmentation state of asynchronous task data with structural incompleteness by a single agent; the structural incompleteness refers to the lack of structural elements such as return structure, abnormal branches or dependency fields in the semantic structure of the currently arrived asynchronous task data, rather than the data arriving with a time delay or having a sequential arrival order.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: A multi-agent task data processing method, executed by a target agent, includes the following steps: acquiring asynchronous task data to be processed submitted by other agents in the multi-agent system; The semantic completeness level of the asynchronous task data is obtained, and it is determined whether the semantic completeness level reaches a preset semantic completeness threshold. When the semantic completeness level does not reach the preset semantic completeness threshold, an interface template corresponding to the features of the asynchronous task data is retrieved and matched from a preset historical abstract syntax tree template library. The existing content in the asynchronous task data is bound to the corresponding real slot of the interface template, and the placeholder node in the interface template is retained for the missing part. Virtual branch context data is generated by splicing and virtual markers are added to the placeholder node. The inference engine of the target agent performs look-ahead inference on logic that does not depend on the placeholder node based on the virtual branch context data and generates look-ahead processing results. The inference logic chain representing the dependency relationship between the look-ahead processing results and the placeholder node is recorded. After obtaining the structural supplementary data corresponding to the asynchronous task data submitted by other intelligent agents, a context merging and verification operation is performed; real context data is constructed based on the asynchronous task data and the structural supplementary data; if there is a difference between the real context data and the virtual branch context data, the program dependency graph of the real context data and the virtual branch context data is extracted for topological comparison to determine the difference features, and the associated nodes affected by the difference features are determined according to the inference logic chain; For the associated nodes affected by the aforementioned difference features, a local recalculation operation is performed, reusing the look-ahead processing results that are not affected by the aforementioned difference features, and the updated processing results are output.
[0009] Specifically, the multi-agent system includes at least two agent nodes. The target agent is the execution node currently responsible for processing the asynchronous task data. The other agents submit the asynchronous task data to the target agent through a message queue, event bus, remote procedure call interface, or shared task pool. The asynchronous task data includes at least one of the following: task identifier, source agent identifier, submission timestamp, fragment sequence number, data type identifier, upstream task link identifier, and currently available content fragments.
[0010] Specifically, the step of obtaining the semantic integrity level of the asynchronous task data includes: converting the asynchronous task data into serialization features, wherein the serialization features include at least one of field integrity features, syntax fragment continuity features, dependency reference integrity features, call entry point existence features, and return structure existence features; The serialized features are input into a pre-trained semantic completeness evaluation model, which includes an encoder and a classification output layer. The Sigmoid output unit of the classification output layer outputs a probability score P with a value between 0 and 1, and the probability score P is used as the semantic integrity watermark W, where W=P.
[0011] Specifically, the training steps of the semantic completeness evaluation model include: collecting incomplete data samples that cause parsing blockage, complete data samples that flow smoothly, and intermediate completeness samples that, although not completely complete, can successfully perform forward inference from historical task processing records, and constructing a training sample set; Each training sample in the training sample set is assigned a semantic completeness label value Y ranging from 0 to 1. The semantic completeness label value Y of the incomplete data sample is lower than the first label threshold, the semantic completeness label value Y of the complete data sample is higher than the second label threshold, and the semantic completeness label value Y of the intermediate completeness sample is between the first label threshold and the second label threshold. The training sample set is input into the initial classification model, which outputs a probability score P. The model parameters of the initial classification model are updated by optimizing the loss function between the probability score P and the semantic completeness label value Y until the initial classification model converges, thus obtaining the semantic completeness evaluation model.
[0012] Specifically, after performing the context merging and verification operation, the process further includes: if the real context data is consistent with the virtual branch context data, then the look-ahead processing result is output as the final processing result.
[0013] Specifically, the steps for retrieving the interface template matching the historical abstract syntax tree template library include: extracting the task feature vector V1 of the asynchronous task data, wherein the task feature vector V1 is encoded by at least one of the following: task type, interface name, field name, field type, partial syntax tree node, call chain summary, parsing error location, and upstream agent identifier; The cosine similarity S between the task feature vector V1 and the template feature vector V2 of each pre-stored template in the historical abstract syntax tree template library is calculated according to S=(V1·V2) / (|V1|×|V2|). The pre-stored template with the largest cosine similarity S value is selected as the interface template.
[0014] Specifically, the construction steps of the historical abstract syntax tree template library include: filtering historical task contexts that have successfully completed parsing, reasoning and result output from historical task processing records, and removing abnormal records that failed to execute, conflicted contexts or were subsequently manually rolled back; Perform syntax parsing on the selected historical task context to generate an abstract syntax tree, or convert process nodes, interface nodes, and field nodes into equivalent abstract syntax tree nodes; The generated abstract syntax tree is abstracted, and the data content corresponding to only one business is replaced with placeholder nodes, while the interface entry, field slots, branch paths and dependencies are retained to obtain a reusable pre-stored template.
[0015] Specifically, the step of generating virtual branch context data by concatenating the interface template with the asynchronous task data includes: binding existing fields, code nodes, or process nodes in the asynchronous task data to the corresponding real slots in the interface template; For missing parameters, return fields, call relationships, or control branches, retain the placeholder nodes in the interface template and add virtual markers, source markers, and version markers to the placeholder nodes; The virtual marker is used to indicate that the corresponding node comes from template completion rather than actual submitted data; the source marker is used to record the matched template number; and the version marker is used for subsequent merging and verification with actual supplementary data.
[0016] Specifically, when performing look-ahead inference based on the virtual branch context data, the inference logic chain is recorded synchronously; The reasoning logic chain includes the context nodes involved in the reasoning, the data dependencies between nodes, the control dependencies, intermediate variables, output fields, and the generation order of each intermediate result; The range of virtual nodes that each intermediate result depends on is recorded in the prospective processing results.
[0017] Specifically, the preset semantic water level threshold is dynamically generated through a reinforcement learning water level adjustment model. The corresponding steps include: obtaining the throughput characteristics of the inference engine inside the target agent and the hit rate characteristics of historical forward inference operations, and normalizing the throughput characteristics and the hit rate characteristics to 0 to 1 respectively. The throughput feature and the hit rate feature are combined into a state space vector and input into the reinforcement learning water level regulation model; The reinforcement learning water level regulation model outputs continuous action commands for adjusting the threshold, and the values of the continuous action commands are normalized to -1 to 1. The continuous action command is parsed, and the single threshold adjustment range is limited to -0.05 to 0.05, while the adjusted preset semantic water level threshold is maintained between 0.50 and 0.95. Specifically, when the continuous action command is greater than the preset zero-zone threshold, the preset semantic water level threshold is increased; when the continuous action command is less than the opposite of the preset zero-zone threshold, the preset semantic water level threshold is decreased; when the value of the continuous action command is between the opposite of the preset zero-zone threshold and the preset zero-zone threshold, the current preset semantic water level threshold is maintained. The preset zero-zone threshold is greater than 0 and does not exceed 0.1.
[0018] Specifically, the training steps of the reinforcement learning water level regulation model include: constructing an initial reinforcement learning model that includes a policy network and a value network; During the environmental interaction process, the computational resource utilization parameter and inference accuracy parameter of the target intelligent agent are input into the reward function algorithm to calculate the reward feedback value normalized to -1 to 1. The reward function algorithm imposes penalties on behaviors such as resource overload, low hit rate, frequent global rollback, or excessive recalculation range. The deep deterministic policy gradient algorithm is used to update the node parameters of the policy network and the value network using the reward feedback values until the initial reinforcement learning model converges to obtain the reinforcement learning water level adjustment model.
[0019] Specifically, the step of extracting the program dependency graph of the real context data and the virtual branch context data and performing topological comparison includes: constructing the program dependency graph into a graph structure composed of nodes and directed edges, wherein the nodes represent code statements, function calls, variable definitions, variable usage, conditional branches, return nodes, business field processing nodes or inference step nodes, and the directed edges represent data dependencies or control dependencies; The nodes of the two program dependency graphs corresponding to the real context data and the virtual branch context data are normalized; if the program dependency graph has a circular dependency, the strongly connected node set is compressed into aggregate nodes and then topologically sorted. The differences are identified by comparing the changes in the node set, edge set, node attributes, edge direction, dependency level, and placeholder markers in the dependency graphs of the two programs in a topological order. The differences are defined as the following: the real context adds nodes, the virtual context has redundant nodes, the node type changes, the parameter value changes, the return field changes, the data dependency edge changes, the control dependency edge changes, or the virtual placeholder node is replaced by a real node but the semantics are inconsistent.
[0020] Specifically, the steps for performing local recalculation on the differential features include: using a program slicing algorithm to extract the first code node that generates the differential features; The data flow of the first code node is traced forward and backward along the program dependency graph to determine all affected related nodes and generate an affected sector graph. The number of nodes covered by the affected sector map is counted as the number of recalculated nodes, and the look-ahead processing results corresponding to the nodes in the program dependency graph that are not covered by the affected sector map are marked as reusable; The local recalculation operation is performed on the code blocks covered by the affected sector diagram and their associated dependencies. The local recalculation results are then merged with the look-ahead processing results marked as reusable and output.
[0021] Specifically, the steps of performing forward and reverse data flow tracing on the first code node include: in the program dependency graph, starting from the first code node, traversing all directed edges with the starting point as input to lock the forward ripple variable; Starting with the first code node as the endpoint, traverse all directed edges pointing to that endpoint to lock the inverse dependency variable; The positive spillover variables and the negative dependency variables are mapped to the inference logic chain recorded when the look-ahead inference operation is performed to form the influence sector diagram.
[0022] The present invention also discloses a multi-agent task data processing system for implementing the above method, which is deployed in the target agent and includes a data acquisition module, an evaluation module, a context construction module, a prospective reasoning module, a verification module, a comparison module and a recalculation module; The data acquisition module is used to acquire asynchronous task data to be processed submitted by other agents in the multi-agent system; The evaluation module is used to obtain the semantic integrity level of the asynchronous task data and determine whether the semantic integrity level reaches a preset semantic integrity level threshold. The semantic integrity level is a probability score with a value of 0 to 1. The context building module is used to retrieve and match interface templates corresponding to the features of the asynchronous task data from a preset historical abstract syntax tree template library when the semantic integrity level does not reach the preset semantic level threshold. It binds the existing content in the asynchronous task data to the corresponding real slots of the interface template, retains the placeholder nodes in the interface template for the missing parts, splices them to generate virtual branch context data, and adds virtual tags to the placeholder nodes. The inference engine of the target agent performs look-ahead inference operations on logic that does not depend on the placeholder nodes based on the virtual branch context data and generates look-ahead processing results. It also records the inference logic chain that represents the dependency relationship between the look-ahead processing results and the placeholder nodes. The forward inference module is used to perform forward inference tasks based on the virtual branch context data and generate forward processing results, and synchronously record the inference logic chain; The verification module is used to perform a context merging verification operation after obtaining the structured supplementary data corresponding to the asynchronous task data submitted by the other intelligent agents. The comparison module is used to construct real context data based on the asynchronous task data and the structured supplementary data. If there is a difference between the real context data and the virtual branch context data, the program dependency graph of the real context data and the virtual branch context data is extracted for topological comparison to determine the difference features. The recalculation module is used to generate an impact sector map for the difference features, count the number of nodes covered by the impact sector map as the number of recalculation nodes, perform local recalculation operations on the code blocks covered by the impact sector map and their associated dependencies, reuse the look-ahead processing results not covered by the impact sector map, and output the updated processing results.
[0023] The advantages of this invention over the prior art are: This invention effectively alleviates the problem of balancing resource utilization and processing accuracy faced by single agents when processing fragmented asynchronous task data by constructing a continuous processing chain within the target agent, encompassing semantic integrity assessment, virtual branch context generation, look-ahead reasoning, real context verification, and local recalculation. Upon receiving asynchronous task data to be processed, the target agent does not immediately initiate a complete parsing and reasoning process. Instead, it first calculates a probability score indicating that the current data meets the conditions for continued processing using a semantic integrity assessment model, and uses this probability score as the semantic integrity level. In this way, the target agent can first determine whether the current data already possesses a basic semantic structure, avoiding blind reasoning when the context is clearly insufficient, and also avoiding prolonged waiting even when existing data has processing value.
[0024] When the semantic completeness level does not reach the preset semantic completeness threshold, this invention retrieves a pre-stored template from the historical abstract syntax tree template library that matches the current asynchronous task data structure features, and uses the matched pre-stored template as the interface template for this processing. This interface template originates from the abstract syntactic skeleton of a historical successful task context, providing structural support such as interface entry points, field slots, branch paths, and dependencies for incomplete asynchronous task data. The target agent writes the data that has actually arrived into the corresponding slot of the interface template, and reserves the positions of data that has not yet arrived as virtual placeholder nodes, thereby concatenating and generating virtual branch context data. This processing method does not forge real business data, but rather establishes a parsable, graph-building, and dependency-labeling temporary context in the case of incomplete input structure. This allows the target agent to execute processing steps that do not depend on missing fields in advance, and to mark the results that depend on missing fields as placeholders, improving computational utilization during asynchronous waiting periods.
[0025] After the arrival of subsequent structured supplementary data, this invention constructs real context data based on asynchronous task data and structured supplementary data, and merges and verifies the real context data with the virtual branch context data. If they are consistent, it indicates that the look-ahead processing results obtained earlier based on the virtual branch context can be reused, and the target agent can directly output the look-ahead processing results, thereby reducing the overhead of repeated parsing, dependency graph comparison, and recalculation. If they differ, this invention does not use global state rollback or full logic recalculation, but instead extracts the program dependency graph of the real context data and the virtual branch context data and performs topological comparison to determine the difference characteristics that cause the deviation. Subsequently, the code nodes that cause the difference are extracted using a program slicing algorithm, and data flow is traced forward and backward along the program dependency graph to generate an affected sector graph. The target agent only performs local recalculation on the code blocks covered by the affected sector graph and their associated dependencies, while the unaffected look-ahead processing results continue to be reused. Thus, this invention narrows the deviation correction range from global recalculation to the affected local area, reduces the cost of repeated computation, and improves the continuous processing capability of the target agent in an asynchronous and delayed environment.
[0026] Furthermore, this invention dynamically generates and adjusts preset semantic water level thresholds through a reinforcement learning-based water level adjustment model. This model combines the throughput characteristics of the target agent's internal inference engine with the hit rate characteristics of historical look-ahead inference tasks into a state space vector, and adjusts actions based on the output threshold according to the current operating state. When the inference engine load is high or the historical hit rate decreases, the target agent can increase the semantic water level threshold, making look-ahead inference more cautious and reducing the recalculation pressure caused by low-quality look-ahead processing. When the inference engine load is low and the historical hit rate is high, the target agent can decrease the semantic water level threshold, allowing more asynchronous task data to enter the controllable look-ahead processing flow earlier. Through this adaptive adjustment mechanism, this invention can achieve a dynamic balance between processing timeliness, inference accuracy, and computational resource consumption based on the operating state, further reducing the overall processing latency in multi-agent asynchronous collaborative scenarios. Attached Figure Description
[0027] Figure 1 This is an overall flowchart of the multi-agent task data processing method according to an embodiment of the present invention; Figure 2 This is a conceptual diagram of the training and working screen of the semantic integrity evaluation model according to an embodiment of the present invention. Figure 3 This is a tree topology diagram of the virtual branch context generation process according to an embodiment of the present invention; Figure 4 This is a conceptual diagram illustrating the splicing and verification comparison of real context data according to an embodiment of the present invention; Figure 5This is a schematic diagram of program dependency graph extraction and topology comparison according to an embodiment of the present invention; Figure 6 This is a physical concept diagram of reinforcement learning dynamically adjusting a preset semantic water level threshold according to an embodiment of the present invention. Figure 7 This is a structural block diagram of the multi-agent task data processing system of the present invention. Detailed Implementation
[0028] The present invention will now be described in detail with reference to the accompanying drawings. The following embodiments are used to illustrate the technical implementation process of the present invention and do not limit the present invention to implementation using only the exact same software framework, message middleware, or model components. Any data processing architecture capable of asynchronous task data acquisition, semantic integrity level assessment, virtual branch context construction, lookahead reasoning, real context verification, and local recalculation, without departing from the technical concept of the present invention, can be used to implement the present invention.
[0029] This invention is applied to a multi-agent collaborative processing environment. The multi-agent system includes at least two agent nodes, which can exchange asynchronous task data via message queues, event buses, remote procedure call interfaces, or shared task pools. The target agent is the execution node currently responsible for processing the asynchronous task data; other agents can be task splitting nodes, data acquisition nodes, upstream inference nodes, or result verification nodes. Asynchronous task data can be code snippets, configuration snippets, structured business fields, function call parameters, process node descriptions, or task fragments formed by a combination of the above.
[0030] like Figure 1 As shown, the target agent first obtains asynchronous task data submitted by other agents in the multi-agent system. To facilitate subsequent verification, this asynchronous task data may carry a task identifier, source agent identifier, submission timestamp, fragment sequence number, data type identifier, upstream task link identifier, and currently available content fragments. Upon receiving this data, the target agent does not immediately enter the complete parsing and inference process; instead, it first determines whether the current data possesses the structural conditions for continued processing. This design aims to avoid two extreme situations: premature inference leading to extensive recalculation later, and excessive waiting causing the inference engine to become idle.
[0031] The target agent acquires the semantic completeness level of the asynchronous task data and determines whether this level reaches a preset semantic completeness threshold. The semantic completeness level indicates the degree to which the current asynchronous task data is semantically sufficient for further processing, and its value can be normalized to 0 to 1. A value closer to 1 indicates that the current data is closer to a complete context; a value closer to 0 indicates that the current data is more likely to cause parsing blockage, missing dependencies, or inference bias. The preset semantic completeness threshold can also be limited to 0 to 1, and in typical business scenarios, it can be set to 0.60 to 0.90, with a preferred initial value of 0.75. This preset does not mean that the threshold must remain fixed, but rather refers to the effective threshold used by the target agent within the current judgment period. When the threshold is set higher, the target agent will more cautiously initiate look-ahead inference, suitable for scenarios with high recalculation costs or low historical look-ahead hit rates; when the threshold is set lower, the target agent will more actively utilize incomplete data for early inference, suitable for scenarios with relatively abundant computing power and high requirements for low latency.
[0032] When the semantic completeness level reaches a preset semantic threshold, the target agent can treat the current asynchronous task data as data with basic structural conditions and directly enter the regular parsing and inference process. For example, if the current data already contains function entry points, parameter declarations, return fields, and major dependencies, it can directly construct the real context data and perform subsequent processing. This branch is used to complete the overall process and avoid the system forcibly generating virtual branches when the data is already sufficiently complete.
[0033] When the semantic completeness level does not reach the preset semantic level threshold, the target agent retrieves and matches interface templates corresponding to the asynchronous task data features from a preset historical abstract syntax tree template library. Then, it uses the interface templates and asynchronous task data to generate virtual branch context data. The historical abstract syntax tree template library can be continuously accumulated by the target agent during historical task execution, or it can be pre-generated by an offline analysis system and then distributed to the target agent. Each pre-stored template can include an abstract syntax tree skeleton, interface entry nodes, parameter placeholder nodes, return value placeholder nodes, dependency edge information, task type identifier, and template feature vector. The interface template here is not the complete real business logic, but rather a context skeleton that allows incomplete data to pass syntactic structure verification. In this way, the target agent can construct a temporary context acceptable to the parser and inference engine for the current task fragment even before the actual supplementary data arrives.
[0034] In a more specific embodiment, the historical abstract syntax tree template library can be constructed according to the following process. First, the target agent or offline build program filters historical task contexts that have successfully completed parsing, inference, and result output from historical task processing records, removing abnormal records that failed execution, had context conflicts, or were subsequently manually rolled back, to ensure that the samples in the library have stable structural reference value. Then, the filtered historical task contexts are parsed. If the historical task context is a code snippet, a corresponding abstract syntax tree is generated using a syntax parser; if the historical task context is a process configuration, interface call description, or structured business data, the process nodes, interface nodes, and field nodes are converted into equivalent abstract syntax tree nodes. Next, the generated abstract syntax tree is abstracted, replacing data content that corresponds only to a single business with placeholder nodes, while retaining interface entry points, field slots, branch paths, and dependencies that reflect the task processing structure. After abstraction, the abstract syntax tree no longer represents a specific task, but rather a reusable syntactic skeleton for a class of tasks.
[0035] Interface templates in the historical abstract syntax tree template library can be matched using task feature vectors. The target agent extracts task feature vectors from the asynchronous task data. Task feature vectors can be encoded by task type, interface name, field name, field type, partial syntax tree nodes, call chain summary, parsing error location, and upstream agent identifier. Encoding methods can employ word embedding models, text vectorization models, code vectorization models, or feature encoders based on historical task clustering. Each pre-stored template in the historical abstract syntax tree template library also generates its template feature vector in the same way. The target agent calculates the cosine similarity between the task feature vector and the template feature vectors of each pre-stored template. Cosine similarity measures the closeness between two vectors; a higher value indicates a greater semantic similarity between the current asynchronous task data and the corresponding template. The target agent selects the pre-stored template with the highest cosine similarity value as the interface template. The interface template is defined as the most suitable template for the current asynchronous task data selected from the historical abstract syntax tree template library. If multiple templates with similarity values are available, the template with a higher historical hit rate, fewer recalculations, or more stable performance within the most recent time window can be selected first. Here, "similarity values" means that the difference between the cosine similarity of each pre-stored template and its maximum value is within the range of 0 to 0.1.
[0036] Virtual branch context data can be generated in the following way. The target agent binds existing fields, code nodes, or process nodes in the asynchronous task data to the corresponding real slots in the interface template; for missing parameters, return fields, call relationships, or control branches, placeholder nodes in the template are retained, and virtual markers, source markers, and version markers are added to these placeholder nodes. The virtual marker indicates that the node comes from template completion rather than actual commit data, the source marker records the matched template number, and the version marker is used for subsequent merging and verification with actual supplementary data. The virtual branch context generated in this way retains the actual task content that has been reached, and provides temporary branches to maintain the continuity of the syntactic structure, thus bypassing the problem of traditional syntax parsers directly reporting errors in incomplete contexts. Figure 3 As shown.
[0037] Based on virtual branch context data, the target agent performs lookahead inference and generates lookahead processing results. Lookahead inference can be implemented by a rule-based inference engine, a workflow inference engine, a static code analyzer, a task planning model, or a large language model inference component. During lookahead inference, the target agent not only generates lookahead processing results but also synchronously records the inference logic chain. The inference logic chain includes the context nodes involved in the inference, the data dependencies between nodes, the control dependencies, intermediate variables, output fields, and the generation order of each intermediate result. The purpose of recording the inference logic chain is to allow the system to identify which results depend on virtual nodes and which results depend only on confirmed real nodes when subsequent real data arrives and causes deviations, thus providing a basis for subsequent local recalculation.
[0038] It's important to note that the interface template is not used to fabricate real business data, nor does it imply that the target agent can directly obtain a deterministic final result even when all fields are missing. The interface template's role is to provide a structural skeleton for the incomplete asynchronous task data, enabling the target agent to first complete syntax parsing, dependency identification, executable region partitioning, and some intermediate inference. For fields already provided by the asynchronous task data, the target agent can perform calculations according to normal logic; for missing fields, the target agent retains them as virtual placeholder nodes and records the range of virtual nodes that the result depends on in the lookahead inference result. Therefore, the lookahead inference task is not the final execution of the complete task, but rather, before the data is fully received, it processes logic that does not depend on missing fields and generates temporary results with conditional assumptions for logic that depends on missing fields. After the subsequent structural supplementary data arrives, the target agent verifies these temporary results based on the real context data. If the virtual placeholder nodes match the real supplementary data, the lookahead processing result is reused; if there are differences, only the affected local areas are recalculated.
[0039] For example, the current asynchronous task data only contains the interface name and some input parameter fields of the order verification interface, but lacks exception branches and return fields. After the target agent matches the order verification interface template from the historical abstract syntax tree template library, it can first fill in the input parameter slots, verification branches, and return structures that the interface usually has, thereby generating virtual branch context data. At this time, the target agent can first perform format validation, dependency path identification, and subsequent call preparation related to the fields that have been reached; for risk scores, exception branch selection, or final return values that must depend on missing fields to be determined, only look-ahead processing results with virtual placeholders are generated. After other agents fill in the real fields, the target agent then judges whether these real fields are consistent with the virtual branch context, and decides accordingly whether to directly reuse the look-ahead processing results or perform local recalculation for the affected code nodes and dependency chains.
[0040] The semantic completeness level can be obtained through a pre-trained semantic completeness evaluation model. The target agent inputs asynchronous task data into this model, and the model outputs a probability score indicating whether the current asynchronous task data possesses the structural conditions for continued processing. This probability score is then used as the semantic completeness level. For example... Figure 2 As shown, the semantic completeness evaluation model can employ an encoder plus a classification output layer structure. The encoder can be a Transformer encoder, a bidirectional recurrent neural network, a lightweight text encoding model, or a code semantic encoding model, used to extract field completeness, syntactic fragment continuity, dependency reference completeness, call entry point existence, and return structure existence from asynchronous task data. The classification output layer can use a fully connected layer and a Sigmoid output unit to map the semantic vector generated by the encoder to a probability score between 0 and 1.
[0041] In constructing the model input, asynchronous task data can be transformed into serializable features. For code-related tasks, keywords, variable declarations, function names, input parameter lists, return fields, call expressions, control statements, and parsing error locations can be extracted. For business process-related tasks, task type, presence of required fields, upstream node identifiers, downstream node identifiers, dependency field references, and data pattern identifiers can be extracted. These features can be concatenated into the model input vector, or they can be first transformed into a word sequence before being fed into the encoder. The probability score output by the model represents whether the current data is sufficient to continue processing, rather than indicating that the business result is definitely correct. Therefore, this score is mainly used to determine whether it is necessary to perform look-ahead inference with the help of virtual branch context.
[0042] The semantic completeness evaluation model can be trained through supervised learning. During the training phase, a training sample set is constructed by collecting incomplete data samples that caused parsing blockages, complete data samples that flowed smoothly, and intermediate completeness samples that, while not entirely complete, could successfully perform lookahead inference from historical task processing records. For each training sample in the training sample set, it is not only labeled as an incomplete data sample, a complete data sample, or an intermediate completeness sample, but also assigned a semantic completeness label value Y ranging from 0 to 1. The semantic completeness label value Y represents the degree to which the corresponding training sample supports continued processing in terms of semantic structure. The closer the Y value is to 0, the more likely the sample is to cause parsing blockages, missing dependencies, or inference biases; the closer the Y value is to 1, the closer the sample is to the complete context, and the more suitable it is to directly enter the parsing and inference process.
[0043] Specifically, the semantic completeness label value Y for incomplete data samples can be configured between 0 and 0.40, preferably between 0.05 and 0.35; the semantic completeness label value Y for intermediate completeness samples can be configured between 0.40 and 0.75, preferably between 0.45 and 0.70; and the semantic completeness label value Y for complete data samples can be configured between 0.75 and 1, preferably between 0.80 and 0.98. Here, 0.40 can be used as the first label threshold, and 0.75 can be used as the second label threshold. Samples below the first label threshold are used to characterize data states with significantly insufficient semantic structure, samples above the second label threshold are used to characterize data states with basically complete semantic structure, and samples between the first and second label thresholds are used to characterize data states that, although there are missing fields, return structures, or dependencies, can still support limited look-ahead inference.
[0044] In one implementation, the semantic completeness label value Y can be obtained through manual annotation, rule calculation, or a combination of manual annotation and rule calculation based on at least one of the following features: field completeness, syntactic fragment continuity, dependency reference completeness, call entry point existence, and return structure existence. For example, field completeness, syntactic fragment continuity, dependency reference completeness, call entry point existence, and return structure existence can each be configured with corresponding weights, and the weighted sum of each feature can be normalized to 0 to 1 to serve as the semantic completeness label value Y for the corresponding training sample. For samples that have caused parsing blocking or global rollback in historical processing, their semantic completeness label value Y can be reduced; for samples whose look-ahead inference results in historical processing are reused in subsequent real contexts, their semantic completeness label value Y can be increased.
[0045] During training, the training sample set is input into the initial classification model, which outputs a probability score P. A loss function measures the deviation between the probability score P and the semantic completeness label value Y, and backpropagation is used to update the model parameters. The loss function can be a binary cross-entropy loss function, a mean squared error loss function, or a weighted combination of both. When using the binary cross-entropy loss function, the semantic completeness label value Y is used as a soft label between 0 and 1 in the loss calculation, rather than simply as a hard classification label of 0 or 1. After multiple iterations, when the loss on the validation set stabilizes and the model outputs a probability score P that can distinguish between incomplete data samples, intermediate completeness samples, and complete data samples in a low-to-high watermark pattern, the initial classification model converges to obtain the semantic completeness evaluation model.
[0046] After the forward processing result is generated, the target agent continues to monitor the structured supplementary data corresponding to the same task identifier. This structured supplementary data consists of fragments of real context submitted by other agents at subsequent times, which may include missing parameter definitions, actual return fields, actual dependencies, supplementary process nodes, upstream inference conclusions, or subsequent code branches. After obtaining this structured supplementary data, the target agent performs a context merging and verification operation. For example... Figure 4 As shown. During the merge verification, the target agent constructs real context data based on asynchronous task data and structured supplementary data. The construction method can be to aggregate data fragments according to task identifiers, restore the order according to fragment sequence numbers, map them to corresponding syntax nodes according to data type identifiers, and then generate a real context tree or real context graph according to dependencies.
[0047] Context merging validation can begin with normalization. Normalization can include field sorting, whitespace cleanup, equivalence type unification, default value expansion, alias resolution, and node number rearrangement. This aims to avoid misjudgments due to differences in format, field order, or naming aliases. After normalization, the target agent checks the consistency between the real context data and the previously generated virtual branch context data. If the real context data matches the virtual branch context data, it means the temporary branch completed by the interface template matches the subsequent real supplementary data. In this case, the lookahead processing result does not need to be recalculated and can be directly output as the final processing result. This short-circuit mechanism reduces the overhead of meaningless dependency graph extraction and topology comparison.
[0048] If there are differences between the real context data and the virtual branch context data, the target agent extracts the program dependency graphs of the real context data and the virtual branch context data respectively, and performs a topological comparison of the two program dependency graphs to determine the differences. For example... Figure 5As shown, a program dependency graph can be composed of nodes and directed edges. Nodes can represent code statements, function calls, variable definitions, variable usage, conditional branches, return nodes, business field processing nodes, or reasoning step nodes. Directed edges can represent data dependencies or control dependencies. Data dependencies indicate that the output of one node is used as the input of another node; control dependencies indicate whether the execution of one node is affected by another decision node.
[0049] The extraction of program dependency graphs can be achieved using existing static analysis techniques. For program code data such as Java, Python, and C++, an abstract syntax tree can be generated using a syntax parser, and then a program dependency graph can be generated based on variable definitions, variable usage, function calls, and control branches. Optional techniques include dependency analysis based on LLVM intermediate representation, Java syntax analysis based on JavaParser, multilingual syntax tree parsing based on tree-sitter, or Java bytecode dependency analysis based on the Soot framework. For task flow data in non-traditional code formats, each task field, interface call, inference step, and result variable can be mapped to graph nodes, and field reference relationships, upstream and downstream call relationships, and execution condition relationships can be mapped to directed edges, thereby forming an equivalent program dependency graph. This allows the present invention to be applicable not only to source code fragments but also to configurable processes and agent inference chain fragments.
[0050] During topology comparison, the target agent can first normalize the nodes of the two program dependency graphs, unifying node types, node labels, variable identifiers, and placeholders into a comparable data structure. If the program dependency graphs contain circular dependencies, the strongly connected node set can be compressed into a single aggregate node before topological sorting. Subsequently, the target agent compares the changes in node sets, edge sets, node attributes, edge directions, dependency levels, and placeholders in the two graphs according to topological order. Difference features can include newly added nodes in the real context, redundant nodes in the virtual context, changes in node types, changes in parameter values, changes in return fields, changes in data dependency edges, changes in control dependency edges, and cases where virtual placeholder nodes are replaced by real nodes but with semantic inconsistencies.
[0051] For the identified discrepancies, the target agent performs a local recalculation operation and outputs the updated processing result. The core idea of local recalculation is to recalculate only the logical regions affected by the discrepancies, rather than overturning all completed look-ahead inference results. The target agent first uses a program slicing algorithm to extract the first code node that generates the discrepancy feature. The first code node can be the earliest statement node, parameter node, function call node, conditional branch node, or inference step node where the discrepancy occurs; if the task flow data is not source code, the first code node can also be a task field node or inference logic node equivalent to a code node. The program slicing algorithm can use static slicing, dynamic slicing, or a combination of static and dynamic slicing. Static slicing is suitable for determining the potentially affected range based on the dependency graph before execution; dynamic slicing is suitable for determining the actual affected range by combining the actual inference logic chain and execution records.
[0052] After identifying the first code node, the target agent performs forward and backward data flow tracing along the program dependency graph. During forward tracing, starting from the first code node, the agent traverses all directed edges that output from that node and flow to subsequent nodes. These are directed edges characterized by the input dependence of subsequent nodes on the starting point, thus identifying the positively impacted variables directly or indirectly affected by the node's output. Positively impacted variables can include subsequently calculated variables, returned fields, intermediate inference conclusions, and downstream call parameters. During backward tracing, starting from the first code node, the agent traverses all directed edges pointing to that node, thus identifying the inversely dependent variables that the node depends on. Inversely dependent variables can include upstream parameters, external inputs, control conditions, and prior inference conclusions. By performing both forward and backward tracing simultaneously, the agent avoids missing prior conditions due to forward searching alone, and also avoids failing to determine the actual output's impact range due to backward searching alone.
[0053] Subsequently, the target agent maps the forward-impact variables and backward-dependent variables to the inference logic chain recorded during the look-ahead inference operation, forming an influence sector graph. The influence sector graph represents the local scope that needs to be recalculated due to the difference features. This graph can cover the first code node that generates the difference, upstream nodes with data dependencies on that node, downstream nodes affected by that node's output, related control branches, and corresponding intermediate inference results. The target agent only performs local recalculation operations on the code blocks covered by the influence sector graph and their associated dependencies. Look-ahead inference results outside the influence sector graph continue to be reused. After recalculation, the target agent merges the local recalculation results with the unaffected look-ahead processing results to generate an updated processing result and outputs it.
[0054] In another embodiment, the preset semantic water level threshold is dynamically generated through a reinforcement learning water level adjustment model. For example... Figure 6As shown, the target agent acquires the throughput characteristics of its internal inference engine and the hit rate characteristics of historical look-ahead inference tasks. The throughput characteristic represents the proportion of inference tasks actually completed per unit time relative to the target agent's maximum processing capacity, and its value can be normalized to 0 to 1. The hit rate characteristic of historical look-ahead inference tasks represents the proportion of look-ahead processing results that match the final actual processing results, and its value can also be normalized to 0 to 1. The target agent combines the throughput and hit rate characteristics into a state space vector and inputs it into the reinforcement learning water level adjustment model.
[0055] The reinforcement learning water level adjustment model outputs action commands to adjust the threshold. These action commands can be continuous adjustments, with values normalized to -1 to 1. The target agent parses the action command and maps it to the adjustment range of a preset semantic water level threshold. A single threshold adjustment range can be limited to -0.05 to 0.05, and the adjusted preset semantic water level threshold remains between 0.50 and 0.95. When the action command is greater than the preset zero-zone threshold, the target agent increases the semantic water level threshold, making look-ahead inference more cautious, suitable for situations where the inference engine is nearing congestion or historical hit rates are declining. When the action command is less than the negative of the preset zero-zone threshold, the target agent decreases the semantic water level threshold, making look-ahead inference more aggressive, suitable for situations where the inference engine is idle and historical hit rates are high. When the value of the action command is between the negative of the preset zero-zone threshold and the preset zero-zone threshold, the target agent maintains the current threshold. The preset zero-zone threshold can be greater than 0 and not exceed 0.1, for example, 0.05.
[0056] The reinforcement learning water level regulation model can be trained using a deep deterministic policy gradient algorithm. During training, an initial reinforcement learning model containing a policy network and a value network is first constructed. The policy network receives the state space vector and outputs a threshold adjustment action, while the value network receives the state space vector and action information and evaluates the long-term benefit of the action in the current state. The policy network and value network can be implemented using a multi-layer fully connected neural network, with network node parameters continuously updated through environmental interaction data. During environmental interaction, the computational resource utilization parameter and inference accuracy parameter of the target agent are input into the reward function algorithm to calculate the corresponding reward feedback value. The computational resource utilization parameter can be normalized to 0 to 1, the inference accuracy parameter can also be normalized to 0 to 1, and the reward feedback value can be normalized to -1 to 1. The reward function algorithm encourages high inference accuracy and reasonable resource utilization, and penalizes behaviors such as resource overload, low hit rate, frequent global rollback, or excessive recalculation range. In one embodiment, the reward function algorithm can be implemented according to... The reward feedback value R is calculated, where Acc is the inference accuracy parameter normalized to 0 to 1, U is the computational resource utilization parameter normalized to 0 to 1, U0 is the preset target resource utilization rate, which can be between 0.70 and 0.85, preferably 0.80, Rr is the recalculation range index normalized to 0 to 1, which can be the ratio of the number of nodes recalculated in this recalculation to the total number of nodes involved in the lookahead processing, and w1, w2, and w3 are preset positive weights, which can be 0.6, 0.2, and 0.2, respectively. Therefore, the higher the inference accuracy, the closer the computational resource utilization rate is to the target resource utilization rate, and the smaller the recalculation range, the larger the reward feedback value. Conversely, the reward feedback value decreases accordingly when resource overload, low hit rate, or excessive recalculation range occurs. Then, a deep deterministic policy gradient algorithm is used to update the node parameters of the policy network and value network using the reward feedback value until the reward feedback value of the initial reinforcement learning model in the training environment tends to stabilize, resulting in a reinforcement learning water level adjustment model.
[0057] At the system implementation level, this invention also provides a multi-agent task data processing system, which is deployed within the target agent. For example... Figure 7 As shown, the system includes a data acquisition module, an evaluation module, a context construction module, a look-ahead inference module, a verification module, a comparison module, and a recalculation module. These modules can be deployed as functional units within the same process, or as multiple microservices or thread units within the target intelligent body. Data can be exchanged between modules through memory queues, event notifications, shared caches, or local API calls.
[0058] The data acquisition module is used to acquire asynchronous task data submitted by other agents in a multi-agent system. The data acquisition module can interface with message queues, event buses, remote procedure calls (RPC) interfaces, or task scheduling centers, and caches and archives data fragments from different agents according to task identifiers.
[0059] The evaluation module is used to obtain the semantic completeness level of asynchronous task data and determine whether the semantic completeness level has reached the preset semantic completeness threshold. The evaluation module can call the semantic completeness evaluation model to output the probability score, or it can obtain the dynamically updated preset semantic completeness threshold from the reinforcement learning level adjustment model.
[0060] The context building module is used to retrieve and match interface templates corresponding to the features of asynchronous task data from the historical abstract syntax tree template library when the semantic integrity level has not reached a preset semantic level threshold. It then uses these interface templates to concatenate the asynchronous task data with the interface templates to generate virtual branch context data. The context building module can also construct real context data based on the asynchronous task data and the structured supplementary data after the structured supplementary data arrives.
[0061] The look-ahead inference module is used to perform look-ahead inference tasks based on virtual branch context data and generate look-ahead processing results. During inference execution, the look-ahead inference module synchronously records the inference logic chain so that subsequent comparison and recalculation modules can determine the scope of impact.
[0062] The verification module performs a context merging verification operation after receiving structured supplementary data corresponding to the asynchronous task data submitted by other agents. If the actual context data matches the virtual branch context data, the verification module can trigger the result output process, outputting the lookahead processing result as the final processing result.
[0063] The comparison module is used to extract the program dependency graphs of the real context data and the virtual branch context data when there are differences, and then perform a topological comparison to determine the differences. The comparison module can output the differences in nodes, edges, variables, and control branches for use by the recalculation module.
[0064] The recalculation module performs local recalculation operations on discrepancies and outputs updated processing results. It uses a program slicing algorithm to extract the first code node that generates the discrepancies, performs forward and backward data flow tracing along the program dependency graph to generate an influence sector graph, and then performs local recalculation only on the code blocks covered by the influence sector graph and their associated dependencies. Through this modular deployment, the target agent can maintain high processing continuity and inference accuracy with relatively low computational cost, even when asynchronous data is incomplete, supplementary data is late, and virtual predictions are biased.
[0065] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A multi-agent task data processing method, characterized in that, Executed by the target agent, the process includes the following steps: acquiring asynchronous task data to be processed submitted by other agents in the multi-agent system; Obtain the semantic integrity level of the asynchronous task data and determine whether the semantic integrity level reaches a preset semantic integrity level threshold; when the semantic integrity level does not reach the preset semantic integrity level threshold, retrieve and match the interface template corresponding to the features of the asynchronous task data from the preset historical abstract syntax tree template library, bind the existing content in the asynchronous task data to the corresponding real slot of the interface template, retain the placeholder node in the interface template for the missing part, splice to generate virtual branch context data, and add virtual markers to the placeholder node; The inference engine of the target agent performs look-ahead inference on logic that does not depend on the placeholder node based on the virtual branch context data and generates look-ahead processing results, and records the inference logic chain that represents the dependency relationship between the look-ahead processing results and the placeholder node. Once the structured supplementary data corresponding to the asynchronous task data submitted by the other intelligent agents is obtained, a context merging and verification operation is performed. Based on the asynchronous task data and the structured supplementary data, real context data is constructed. If there is a difference between the real context data and the virtual branch context data, the program dependency graph of the real context data and the virtual branch context data is extracted for topological comparison to determine the difference features, and the associated nodes affected by the difference features are determined according to the inference logic chain. For the associated nodes affected by the aforementioned difference features, a local recalculation operation is performed, reusing the look-ahead processing results that are not affected by the aforementioned difference features, and the updated processing results are output.
2. The multi-agent task data processing method of claim 1, wherein, The multi-agent system includes at least two agent nodes. The target agent is the execution node currently responsible for processing the asynchronous task data. Other agents submit the asynchronous task data to the target agent through a message queue, event bus, remote procedure call interface, or shared task pool. The asynchronous task data includes at least one of the following: task identifier, source agent identifier, submission timestamp, fragment sequence number, data type identifier, upstream task link identifier, and currently available content fragments. 3.The multi-agent task data processing method of claim 1, wherein, The step of obtaining the semantic integrity watermark of the asynchronous task data includes: converting the asynchronous task data into serialization features, wherein the serialization features include at least one of field integrity features, syntax fragment continuity features, dependency reference integrity features, call entry point existence features, and return structure existence features; The serialized features are input into a pre-trained semantic completeness evaluation model, which includes an encoder and a classification output layer. The Sigmoid output unit of the classification output layer outputs a probability score P with a value between 0 and 1, and the probability score P is used as the semantic integrity watermark W, where W=P.
4. The multi-agent task data processing method of claim 3, wherein, The training steps of the semantic completeness evaluation model include: collecting incomplete data samples that cause parsing blockage, complete data samples that flow smoothly, and intermediate completeness samples that, although not completely complete, can successfully perform forward inference from historical task processing records, and constructing a training sample set. Each training sample in the training sample set is assigned a semantic completeness label value Y ranging from 0 to 1. The semantic completeness label value Y of the incomplete data sample is lower than the first label threshold, the semantic completeness label value Y of the complete data sample is higher than the second label threshold, and the semantic completeness label value Y of the intermediate completeness sample is between the first label threshold and the second label threshold. The training sample set is input into the initial classification model, which outputs a probability score P. The model parameters of the initial classification model are updated by optimizing the loss function between the probability score P and the semantic completeness label value Y until the initial classification model converges, thus obtaining the semantic completeness evaluation model.
5. The multi-agent task data processing method of claim 1, wherein, After performing the context merging and verification operation, the process further includes: if the real context data is consistent with the virtual branch context data, then the look-ahead processing result is output as the final processing result.
6. The multi-agent task data processing method of claim 1, wherein, The steps for retrieving the interface template matching the historical abstract syntax tree template library include: extracting the task feature vector V1 of the asynchronous task data, wherein the task feature vector V1 is obtained by encoding at least one of the following: task type, interface name, field name, field type, partial syntax tree node, call chain summary, parsing error location, and upstream agent identifier; The cosine similarity S between the task feature vector V1 and the template feature vector V2 of each pre-stored template in the historical abstract syntax tree template library is calculated according to S=(V1·V2) / (|V1|×|V2|). The pre-stored template with the largest cosine similarity S value is selected as the interface template.
7. The multi-agent task data processing method of claim 1, wherein, The construction steps of the historical abstract syntax tree template library include: filtering historical task contexts that have successfully completed parsing, reasoning and output results from historical task processing records, and removing abnormal records that failed to execute, conflicted contexts or were subsequently manually rolled back; Perform syntax parsing on the selected historical task context to generate an abstract syntax tree, or convert process nodes, interface nodes, and field nodes into equivalent abstract syntax tree nodes; The generated abstract syntax tree is abstracted, and the data content corresponding to only one business is replaced with placeholder nodes, while the interface entry, field slots, branch paths and dependencies are retained to obtain a reusable pre-stored template.
8. The multi-agent task data processing method of claim 1, wherein, The step of generating virtual branch context data by concatenating the interface template with the asynchronous task data includes: binding existing fields, code nodes, or process nodes in the asynchronous task data to the corresponding real slots in the interface template; For missing parameters, return fields, call relationships, or control branches, retain the placeholder nodes in the interface template and add virtual markers, source markers, and version markers to the placeholder nodes; The virtual marker is used to indicate that the corresponding node comes from template completion rather than actual submitted data; the source marker is used to record the matched template number; and the version marker is used for subsequent merging and verification with actual supplementary data. 9.The multi-agent task data processing method of claim 1, wherein, When performing look-ahead inference based on the virtual branch context data, the inference logic chain is recorded synchronously. The reasoning logic chain includes the context nodes involved in the reasoning, the data dependencies between nodes, the control dependencies, intermediate variables, output fields, and the generation order of each intermediate result; The range of virtual nodes that each intermediate result depends on is recorded in the prospective processing results. 10.The multi-agent task data processing method of claim 1, wherein, The preset semantic water level threshold is dynamically generated through a reinforcement learning water level adjustment model. The corresponding steps include: obtaining the throughput characteristics of the inference engine inside the target agent and the hit rate characteristics of historical forward inference operations, and normalizing the throughput characteristics and the hit rate characteristics to 0 to 1 respectively. The throughput feature and the hit rate feature are combined into a state space vector and input into the reinforcement learning water level regulation model; The reinforcement learning water level regulation model outputs continuous action commands for adjusting the threshold, and the values of the continuous action commands are normalized to -1 to 1. The continuous action command is parsed, and the single threshold adjustment range is limited to -0.05 to 0.05, while the adjusted preset semantic water level threshold is maintained between 0.50 and 0.
95. Specifically, when the continuous action command is greater than the preset zero-zone threshold, the preset semantic water level threshold is increased; when the continuous action command is less than the opposite of the preset zero-zone threshold, the preset semantic water level threshold is decreased; when the value of the continuous action command is between the opposite of the preset zero-zone threshold and the preset zero-zone threshold, the current preset semantic water level threshold is maintained. The preset zero-zone threshold is greater than 0 and does not exceed 0.
1.
11. The multi-agent task data processing method of claim 10, wherein, The training steps of the reinforcement learning water level regulation model include: constructing an initial reinforcement learning model containing a policy network and a value network; During the environmental interaction process, the computational resource utilization parameter and inference accuracy parameter of the target intelligent agent are input into the reward function algorithm to calculate the reward feedback value normalized to -1 to 1. The reward function algorithm imposes penalties on behaviors such as resource overload, low hit rate, frequent global rollback, or excessive recalculation range. The deep deterministic policy gradient algorithm is used to update the node parameters of the policy network and the value network using the reward feedback values until the initial reinforcement learning model converges to obtain the reinforcement learning water level adjustment model.
12. The multi-agent task data processing method according to claim 1, characterized in that, The step of extracting the program dependency graph of the real context data and the virtual branch context data and performing topological comparison includes: constructing the program dependency graph into a graph structure composed of nodes and directed edges, wherein the nodes represent code statements, function calls, variable definitions, variable usage, conditional branches, return nodes, business field processing nodes or inference step nodes, and the directed edges represent data dependencies or control dependencies; The nodes of the two program dependency graphs corresponding to the real context data and the virtual branch context data are normalized; if the program dependency graph has a circular dependency, the strongly connected node set is compressed into aggregate nodes and then topologically sorted. The differences are identified by comparing the changes in the node set, edge set, node attributes, edge direction, dependency level, and placeholder markers in the dependency graphs of the two programs in a topological order. The differences are defined as the following: the real context adds nodes, the virtual context has redundant nodes, the node type changes, the parameter value changes, the return field changes, the data dependency edge changes, the control dependency edge changes, or the virtual placeholder node is replaced by a real node but the semantics are inconsistent.
13. The multi-agent task data processing method according to claim 1, characterized in that, The steps for performing local recalculation on the differential features include: extracting the first code node that generates the differential features using a program slicing algorithm; The data flow of the first code node is traced forward and backward along the program dependency graph to determine all affected related nodes and generate an affected sector graph. The number of nodes covered by the affected sector map is counted as the number of recalculated nodes, and the look-ahead processing results corresponding to the nodes in the program dependency graph that are not covered by the affected sector map are marked as reusable; The local recalculation operation is performed on the code blocks covered by the affected sector diagram and their associated dependencies. The local recalculation results are then merged with the look-ahead processing results marked as reusable and output.
14. The multi-agent task data processing method according to claim 13, characterized in that, The steps of performing forward and reverse data flow tracing on the first code node include: in the program dependency graph, starting from the first code node, traversing all directed edges with the starting point as input to lock the forward ripple variable; Starting with the first code node as the endpoint, traverse all directed edges pointing to that endpoint to lock the inverse dependency variable; The positive spillover variables and the negative dependency variables are mapped to the inference logic chain recorded when the look-ahead inference operation is performed to form the influence sector diagram.
15. A multi-agent task data processing system for implementing the method of claim 1, characterized in that, Deployed within the target intelligent agent, it includes a data acquisition module, an evaluation module, a context construction module, a look-ahead reasoning module, a verification module, a comparison module, and a recalculation module; The data acquisition module is used to acquire asynchronous task data to be processed submitted by other agents in the multi-agent system; The evaluation module is used to obtain the semantic integrity level of the asynchronous task data and determine whether the semantic integrity level reaches a preset semantic integrity level threshold. The semantic integrity level is a probability score with a value of 0 to 1. The context building module is used to retrieve and match the interface template corresponding to the features of the asynchronous task data from the preset historical abstract syntax tree template library when the semantic integrity level does not reach the preset semantic level threshold. It binds the existing content in the asynchronous task data to the corresponding real slot of the interface template, retains the placeholder node in the interface template for the missing part, splices together to generate virtual branch context data, and adds virtual markers to the placeholder node. The inference engine of the target agent performs look-ahead inference on logic that does not depend on the placeholder node based on the virtual branch context data and generates look-ahead processing results, and records the inference logic chain that represents the dependency relationship between the look-ahead processing results and the placeholder node. The forward inference module is used to perform forward inference tasks based on the virtual branch context data and generate forward processing results, and synchronously record the inference logic chain; The verification module is used to perform a context merging verification operation after obtaining the structured supplementary data corresponding to the asynchronous task data submitted by the other intelligent agents. The comparison module is used to construct real context data based on the asynchronous task data and the structured supplementary data. If there is a difference between the real context data and the virtual branch context data, the program dependency graph of the real context data and the virtual branch context data is extracted for topological comparison to determine the difference features. The recalculation module is used to generate an impact sector map for the difference features, count the number of nodes covered by the impact sector map as the number of recalculation nodes, perform local recalculation operations on the code blocks covered by the impact sector map and their associated dependencies, reuse the look-ahead processing results not covered by the impact sector map, and output the updated processing results.
Citation Information
Patent Citations
Asynchronous task data processing method, device and computer readable storage medium
CN110851248B
Asynchronous task processing method and device, electronic equipment and medium
CN111831408A