An agent robustness teaching scenario evolution method and system

CN122985638APending Publication Date: 2026-10-27BEIJING POLYTECHNIC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611315686.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-27
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0003]现有智能体开发教学和测试系统依赖人工编写固定测试用例,导致测试场景覆盖不足、异常场景生成效率低、生成场景可能违反业务规则、复杂故障难以复现,以及学习者修改智能体后无法判断是否引入新缺陷的问题

Benefits of technology

该智能体鲁棒性教学场景进化方法及系统,通过采集智能体运行轨迹建立多维行为覆盖模型,按照未覆盖行为反馈选择变异算子,在接口约束、业务约束和因果约束下生成新的交互及环境故障场景,并利用输出偏差、工具调用偏差、状态异常和恢复失败共同判断故障;对于有效故障场景进一步执行最小化处理,将其转换为可复现的智能体修复教学任务,并在学习者完成修改后同时执行故障回归和正常功能回归,由此能够提高智能体内部行为覆盖率和缺陷发现率,减少无效测试场景及重复执行次数,并使智能体故障能够被稳定复现、定位和验证。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985638A_ABST
    Figure CN122985638A_ABST
Patent Text Reader

Abstract

The application discloses an intelligent agent robustness teaching scene evolution method and system, and relates to the technical field of artificial intelligence and machine learning; the evolution method specifically comprises the following steps: S1: analyzing the workflow, tools, memory, knowledge configuration and exception handling configuration of a target intelligent agent; the evolution system comprises: top-level analysis and modeling: including an intelligent agent engineering analysis module and a scene seed management module, a behavior atom modeling module and a coverage state management module; the application establishes a multi-dimensional behavior coverage model by collecting the running track of the intelligent agent, selects a mutation operator according to un-covered behavior feedback, generates new interaction and environment failure scenes under the constraints of interfaces, businesses and causality, and jointly judges the failure by using output deviation, tool calling deviation, state abnormality and recovery failure; for the effective failure scene, further minimum processing is performed to convert it into a reproducible intelligent agent repair teaching task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and machine learning technology, and in particular to a robust teaching scenario evolution method and system for intelligent agents. Background Technology

[0002] A search revealed a Chinese patent application with patent number 202511661776.2, which discloses a templated construction method and system for intelligent agent development teaching tasks. Based on a four-stage model of cognition-deconstruction-imitation-innovation, the system uses a visual task construction engine to effectively break down complex teaching tasks into atomic steps, achieving standardized deconstruction and construction of teaching tasks. This overcomes the problem of existing intelligent agent development teaching content separating business knowledge from development capabilities, enabling learners to effectively apply their learned development capabilities to real-world business scenarios.

[0003] Existing AI agent development teaching and testing systems rely on manually written fixed test cases, leading to insufficient test scenario coverage, low efficiency in generating abnormal scenarios, potential violations of business rules by generated scenarios, difficulty in reproducing complex faults, and the inability for learners to determine whether modifying the AI ​​agent introduces new defects. Specifically, existing methods typically only verify the correctness of the final output, failing to systematically cover workflow branches, tool abnormal states, memory state transitions, knowledge retrieval conflicts, security policy triggers, and fault recovery paths. Randomly generated abnormal inputs are also prone to issues such as incorrect field types, contradictory business timing, or inconsistencies with real user expressions. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a robust teaching scenario evolution method and system for intelligent agents.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: A robust teaching scenario evolution method for intelligent agents includes the following steps: S1: Analyze the target agent's workflow, tools, memory, knowledge configuration, and exception handling configuration; S2: Establish the complete set of atomic and overlay states for workflow, tools, memory, retrieval, security, and recovery behaviors; S3: Execute the seed scenario and collect the running trajectory, initialize the scenario set, coverage status and operator reward; S4: Select the parent scene and mutation operator based on behavior coverage feedback to generate candidate robust scenes; S5: Verify interfaces, business logic, and causal constraints; execute feasible scenarios and collect runtime trajectories in an isolated environment. S6: Calculate new coverage, fault deviation, severity, realism, and cost; update scenario fitness and mutation operator rewards. S7: Has a valid fault been found? If yes, re-execute S4; if no, execute S8. S8: Minimize the fault scenarios and generate teaching tasks for fault reproduction, repair, and regression verification.

[0006] Preferably: In step S2, a complete set of behavioral atoms is established: in: Workflow edge and conditional branching behavior; The tool's status includes normal operation, timeout, empty return, and error code. : Memory state transitions such as write, overwrite, read, and invalidation; Search results: hit, no results, conflicting evidence, and outdated knowledge; Security policies can be categorized into branches such as allow, deny, and downgrade. Recovery behaviors include retrying, rolling back, using alternative tools, and manual takeover. For the k-th atom, define a trajectory coverage indicator function. After the t-th round of evolution, the global coverage state is: in, It is the set of scenarios that have been executed up to round t; The global weighted coverage rate is: Where K is the number of atoms in the behavior. The business importance of the k-th row atom; The new coverage brought by the candidate scenarios is as follows: Weighted by rare behaviors: in, It represents the number of times behavior atom k is triggered in the first t rounds.

[0007] Furthermore: In step S5, the scenario must satisfy the following set of hard constraints:

[0008] in, Indicates range constraints. Represents equality constraints; Defining hard constraints for feasibility:

[0009] in, For indicator functions, This is the numerical error tolerance; if Candidate scenarios do not enter the actual execution environment; For soft constraints that allow slight deviations, define the normalized violation:

[0010] in, , For the first A soft constraint function, For normalization, As a penalty weight, The number of soft constraints involved in scenario s.

[0011] As a preferred embodiment of the present invention: in step S6, Q decision dimensions are established for the execution result, and the normalization deviation of each dimension is:

[0012] in, It corresponds to the expected rules or transformation relationships. It is an allowable deviation. The normalized distance metric between the output and the expected rule on the q-th decision dimension; You can set:

[0013] And satisfy:

[0014] in: : Deviations in output content, format, or semantics; : Normalized edit distance between the actual tool call sequence and the expected sequence; The proportion of memory states that violate business invariants; Deviations in security policy, such as incorrectly allowing or blocking processes. Deviations that fail to retry, roll back, or downgrade correctly after an anomaly occurs; The fault determination function is:

[0015] in, To determine the comprehensive fault threshold, The number of hardware failures related to security, privacy, or finances; The severity of the fault is:

[0016] in, This is the sensitivity coefficient. Additional response time caused by the fault. This is the upper limit of time normalization; the formula limits the severity to... .

[0017] Based on the aforementioned solution: In step S6, the scene adaptability is:

[0018] in:

[0019] in, It's weight. It is a penalty coefficient that is greater than the sum of other income items; To indicate authenticity, the mean of the sample data from real-world business scenarios is calculated. Covariance Matrix Scene feature vector , Used to prevent the covariance matrix from becoming non-invertible; These measures Token, runtime (Time), and tool call count (Calls), respectively.

[0020] Preferably: In step S4, the set of mutation operators is as follows: , No. The immediate reward for each operator is:

[0021] in, As a father, For sub-scenes, These are the weighting coefficients of the coverage gain term and the fault term in the operator reward, respectively; Average reward of the update operator:

[0022] Using the upper confidence boundary selection operator:

[0023] in, For the number of times the operator is used, To explore the coefficient, This refers to the temperature parameter.

[0024] Furthermore: In step S8, for fault scenarios Define the scene complexity:

[0025] in, For the number of dialogue rounds, For the number of disturbances, The amplitude of the disturbance.

[0026] The minimization problem is:

[0027] The constraints are:

[0028] in, express It is obtained by deleting interactive rounds, removing perturbations, or reducing parameters; Sign the fault.

[0029] Based on the aforementioned scheme: In step S8, the intelligent agent repaired by the learner is denoted as... Calculate on the minimum failure scenario, the normal regression set, and the similar mutation set respectively:

[0030] The final repair score is:

[0031] in, For fault repair rate, To maintain normal function, For generalization to similar scenarios, ,and The repair is considered successful when the threshold is reached.

[0032] As a preferred embodiment of the present invention: the verification results and fitness data are fed back to the coverage feedback-driven scenario selection. The failed behavior states are re-added to the uncovered or unrepaired queue to enter the next round of scenario evolution until the target coverage, number of faults discovered, or calculation budget is reached, and then the scenario library, fault library, and repair report are output.

[0033] A robust teaching scenario evolution system for intelligent agents, used to implement the aforementioned robust teaching scenario evolution method for intelligent agents, includes: Top-level analysis and modeling: including the agent engineering analysis module, scene seed management module, behavior atomic modeling module, and coverage state management module; Scenario selection and constraint verification: including a scenario selection module driven by coverage feedback and an adaptive selection module for mutation operators, as well as a module for verifying interface constraints, business constraints and causal constraints; Isolation Execution and Trajectory Acquisition: This includes the isolation execution and tool playback module and the runtime trajectory acquisition module; Evaluation calculation and fault extraction: including modules for calculating coverage gain, fault bias, severity and fitness, as well as modules for fault signature extraction and minimum failure scenario generation; Teaching compilation and repair judgment: including the teaching task compilation module and the repair and regression judgment module; Agent modification and result verification: This includes modules for learners modifying agents and managing verification results; And the underlying multi-database storage and feedback closed loop includes a scenario library, trajectory library, coverage library, fault library and teaching task library, and feeds back the data from the verification result management module and the calculation module to the coverage feedback-driven scenario selection module to realize the continuous evolution of teaching scenarios.

[0034] The beneficial effects of this invention are as follows: This method and system for evolving robust teaching scenarios for intelligent agents establishes a multi-dimensional behavior coverage model by collecting the agent's operational trajectory. It selects mutation operators based on feedback from uncovered behaviors and generates new interaction and environmental fault scenarios under interface, business, and causal constraints. Faults are jointly identified using output deviation, tool call deviation, state anomalies, and recovery failures. For valid fault scenarios, minimization processing is further performed, converting them into reproducible agent repair teaching tasks. After learners complete modifications, fault regression and normal function regression are performed simultaneously. This improves the agent's internal behavior coverage and defect detection rate, reduces invalid test scenarios and repeated executions, and enables stable reproduction, localization, and verification of agent faults. Attached Figure Description

[0035] Figure 1 This is a schematic diagram of the evolution method of the present invention; Figure 2 This is a schematic diagram illustrating the evolutionary process of behavior coverage feedback and constraint variation scenarios in this invention; Figure 3 This is a schematic diagram illustrating the fault scenario minimization, teaching task generation, and repair verification process of the present invention. Figure 4 This is a block diagram of the system structure of the present invention. Detailed Implementation

[0036] The technical solution of the present invention will be further described in detail below with reference to specific embodiments.

[0037] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0038] Example 1: A robust teaching scenario evolution method for intelligent agents, such as... Figures 1 to 4 As shown, the specific steps include: S1: Analyze the target agent's workflow, tools, memory, knowledge configuration, and exception handling configuration; S2: Establish the complete set of atomic and overlay states for workflow, tools, memory, retrieval, security, and recovery behaviors; S3: Execute the seed scenario and collect the running trajectory, initialize the scenario set, coverage status and operator reward; S4: Select the parent scene and mutation operator based on behavior coverage feedback to generate candidate robust scenes; S5: Verify interfaces, business logic, and causal constraints; execute feasible scenarios and collect runtime trajectories in an isolated environment (i.e., an isolated execution environment / sandbox); S6: Calculate new coverage, fault deviation, severity, realism, and cost; update scenario fitness and mutation operator rewards. S7: Has a valid fault been found? If yes, re-execute S4; if no, execute S8. S8: Minimize the fault scenarios and generate teaching tasks for fault reproduction, repair, and regression verification.

[0039] I. Representation of Scene and Running Trajectory Define a candidate scenario as:

[0040] in: This indicates a scenario for testing or teaching an intelligent agent that needs to be executed. This represents a sequence of user inputs containing L rounds of interaction; This indicates environmental disturbance parameters, such as tool timeout, knowledge conflict, and missing field. This indicates the sequence of mutation operators used to generate this scene; This indicates reproducible execution parameters, including the random seed, model version, and tool replay data identifier.

[0041] Inputting the scenario into the target agent A and the isolated execution environment E, we get:

[0042] in: For the final output of the intelligent agent, For the running trajectory;

[0043] Each event is represented as:

[0044] in: For workflow node identification, For event type, , These are the input and output summaries, respectively. In execution state, For delay, This serves as the parent event identifier. The data flow and control flow relationships can be restored using the parent event identifier.

[0045] II. Multidimensional Behavioral Coverage Model Establish the complete set of behavioral atoms:

[0046] in: Workflow edge and conditional branching behavior; The tool's status includes normal operation, timeout, empty return, and error code. : Memory state transitions such as write, overwrite, read, and invalidation; Search results: hit, no results, conflicting evidence, and outdated knowledge; Security policies can be categorized into branches such as allow, deny, and downgrade. Recovery behaviors include retrying, rolling back, using alternative tools, and manual takeover.

[0047] For the k-th atom, define the trajectory coverage indicator function:

[0048] After the t-th round of evolution, the global coverage state is:

[0049] in, It is the set of scenarios that have been executed up to round t.

[0050] The global weighted coverage rate is:

[0051] Where K is the number of atoms in the behavior. The business importance of the k-th atom.

[0052] The new coverage brought by the candidate scenarios is as follows:

[0053] Weighted by rare behaviors:

[0054] in, It represents the number of times behavior atom k is triggered in the first t rounds. The fewer the number of triggers, the higher the weight, thus prompting the algorithm to prioritize exploring less frequent behaviors.

[0055] III. Legality Constraints of the Scenarios The scenario must satisfy the following set of hard constraints:

[0056] in, This indicates a range constraint, such as the refund amount not exceeding the order amount. This indicates an equality constraint, such as the requirement that the type of a tool's input field must be consistent with the interface pattern.

[0057] Defining hard constraints for feasibility:

[0058] in, For indicator functions, This is the numerical error tolerance. If Candidate scenarios do not enter the actual execution environment.

[0059] For soft constraints that allow slight deviations, define the normalized violation:

[0060] in, , For the first A soft constraint function, For normalization, As a penalty weight, The number of soft constraints involved in scenario s.

[0061] IV. Fault Deviation and Severity Q decision dimensions are established for the execution results, and the normalization bias of each dimension is:

[0062] in, It corresponds to the expected rules or transformation relationships. It is an allowable deviation. This is the normalized distance metric between the output and the expected rule on the q-th decision dimension.

[0063] You can set:

[0064] And satisfy:

[0065] in: : Deviations in output content, format, or semantics; : Normalized edit distance between the actual tool call sequence and the expected sequence; The proportion of memory states that violate business invariants; Deviations in security policy, such as incorrectly allowing or blocking processes. Deviations that fail to retry, roll back, or downgrade correctly after an anomaly occurs.

[0066] The fault determination function is:

[0067] in, To determine the comprehensive fault threshold, The number of hardware failures related to security, privacy, or finances.

[0068] The severity of the fault is:

[0069] in, This is the sensitivity coefficient. Additional response time caused by the fault. This is the upper limit for time normalization. The formula limits the severity to... .

[0070] V. Scenario Realism and Execution Costs Extracting scene feature vectors This includes semantic vectors, dialogue turns, parameter combinations, and tool failure frequency. The mean is calculated using samples from real-world business scenarios. Covariance Matrix Defining authenticity:

[0071] in, This is used to prevent the covariance matrix from becoming non-invertible. The closer the candidate scenario is to the actual business distribution, the better. The closer it is to 1.

[0072] Execution cost is defined as:

[0073] in, These measures Token, runtime (Time), and tool call count (Calls), respectively.

[0074] VI. Scene Adaptability Scene adaptability is:

[0075] in, It's weight. It is a penalty coefficient that is greater than the sum of other benefit items. This formula ensures that the algorithm prioritizes retaining scenarios that can increase coverage, discover high-severity faults, and are realistic, while suppressing high-cost or constraint-violation scenarios.

[0076] VII. Adaptive Selection of Mutation Operators Let the set of mutation operators be... . No. The immediate reward for each operator is:

[0077] in, As a father, For sub-scenes, These are the weighting coefficients of the coverage gain term and the fault term in the operator reward, respectively.

[0078] Average reward of the update operator:

[0079] The Upper Confidence Bound (UCB) selection operator is used:

[0080] in, For the number of times the operator is used, To explore the coefficient, This is a temperature parameter. This allows for automatic balancing between high-yield operators and less frequently used operators.

[0081] 8. Minimize failure scenarios For fault scenarios Define the scene complexity:

[0082] in, For the number of dialogue rounds, For the number of disturbances, The amplitude of the disturbance.

[0083] The minimization problem is:

[0084] The constraints are:

[0085] in, express It is obtained by deleting interactive rounds, removing perturbations, or reducing parameters; The fault is signed, including the first anomalous node, the fault type, and the affected output; similarity constraints are used to prevent it from becoming a different fault during the minimization process.

[0086] Repair verification formula The intelligent agent repaired by the learner is denoted as Calculate on the minimum failure scenario, the normal regression set, and the similar mutation set respectively:

[0087] The final repair score is:

[0088] in, For fault repair rate, To maintain normal function, For generalization in similar scenarios, three The sum of these three indicators is 1. Only when each of the three indicators reaches its threshold is the repair considered successful.

[0089] Based on the foregoing, the detailed process of this method is as follows: 1. Analyze the workflow nodes, condition edges, tool interfaces, memory variables, knowledge base, and exception handling configuration of the target intelligent agent.

[0090] 2. Establish a complete set of six types of behavioral atoms and set the business importance of each behavioral atom.

[0091] 3. Import real business dialogues or normal scenarios requiring manual confirmation to form an initial seed set.

[0092] 4. Execute the seed scenario, collect the running trajectory, and generate the initial coverage state. .

[0093] 5. Select a parent scene from the scene population based on the fitness Softmax probability.

[0094] 6. Use the UCB formula to select operators for expression variation, tool failure, retrieval conflict, memory pollution, context truncation, or flow perturbation.

[0095] 7. Perform mutation on the parent scene to obtain candidate child scenes.

[0096] 8. Use interface patterns, business rules, and causal rules to check hard constraints; if they are not met, perform constraint repair or discard.

[0097] 9. Execute candidate scenarios in an isolated sandbox using fixed random seeds and tool replay data.

[0098] 10. Collect the operation trajectory and calculate the new coverage, fault deviation, severity, authenticity and execution cost.

[0099] 11. Update scene profiles, coverage status, and mutation operator rewards based on scene adaptability.

[0100] 12. Minimize the newly discovered effective fault execution scenarios to obtain the minimum failure scenario that can be stably reproduced.

[0101] 13. Align the normal and failed trajectories according to the node identifiers to determine the first abnormal event and its upstream dependent subgraph.

[0102] 14. Automatically generate teaching tasks that include fault reproduction projects, operation logs, allowed modification ranges, and regression decision-makers.

[0103] 15. Learners submit modified agents and perform verification on minimum failure scenarios, normal scenarios, and similar mutation scenarios.

[0104] 16. Unsuccessful behavior states are re-added to the uncovered or unrepaired queue and enter the next round of scenario evolution.

[0105] 17. Once the target coverage, number of faults discovered, or budget is achieved, the process terminates and outputs a scenario library, a fault library, and a repair report.

[0106] Example 2: An agent-based robust teaching scenario evolution system, used to implement the agent-based robust teaching scenario evolution method in Example 1, such as... Figure 4 As shown, it includes: Top-level analysis and modeling: This includes an agent engineering analysis module and a scene seed management module, which are responsible for receiving and analyzing agent engineering inputs and managing initial scene seeds; as well as a behavior atomic modeling module and a coverage state management module, which are responsible for decomposing agent behavior into atomic models and managing test coverage state in real time.

[0107] Scenario selection and constraint verification: This includes a scenario selection module driven by coverage feedback and an adaptive selection module for mutation operators. Based on the coverage feedback mechanism, the module is responsible for selecting test scenarios and adaptively matching mutation operators. The module also includes an interface constraint, business constraint, and causal constraint verification module, which receives input from the scenario selection module and performs compliance verification on the generated scenarios in terms of interface specifications, business logic, and causal relationships to ensure the legality and validity of the scenarios.

[0108] Isolation Execution and Trajectory Acquisition: This includes the isolation execution and tool replay module and the runtime trajectory acquisition module. It receives verified scenarios, executes tests in an isolated environment, replays them using tools, and comprehensively collects the system's runtime trajectory to provide a data foundation for subsequent evaluation.

[0109] Evaluation calculation and fault extraction: This includes modules for calculating coverage gain, fault deviation, severity, and fitness. Based on the collected running trajectory, it quantifies and calculates test coverage gain, fault deviation, severity, and scenario fitness. It also includes a fault signature extraction and minimum failure scenario generation module, which synchronously processes running data, extracts typical fault signatures, and generates minimum failure scenarios for teaching, reducing teaching complexity.

[0110] Teaching compilation and repair judgment: This includes a teaching task compilation module and a repair and regression judgment module. It receives the output data from the above calculation module and fault extraction module, is responsible for converting faults into structured teaching tasks and compiling them, and at the same time, it judges the regression situation of the agent after repair to ensure that the repair is effective.

[0111] Agent modification and result verification: This includes a module for learning agents to modify agents and a module for managing verification results. It receives teaching tasks and regression judgment results, manages the modification and iteration process of learners (agents), and manages the verification results in a unified manner to form a repair archive.

[0112] The underlying multi-database storage and feedback loop includes a scenario database, trajectory database, coverage database, fault database, and teaching task database, which serve as the data foundation of the system. They receive data from the calculation module, fault extraction module, and verification management module to achieve knowledge reuse. The system also has a feedback loop mechanism that feeds back data from the verification result management module and the calculation module to the "coverage feedback-driven scenario selection module," driving the adaptive optimization of scenario selection and mutation operators to achieve continuous evolution of teaching scenarios.

[0113] Its working process is as follows: First, in the top-level parsing and modeling stage, the agent engineering parsing module and the scene seed management module parse the input agent engineering file and extract the behavioral logic and initial scene seeds. Then, the behavior atomic modeling module and the coverage state management module decompose the complex behavior of the agent into indivisible atomic operation models and initialize the coverage state manager to track the covered code paths or logic branches.

[0114] Next, the scenario selection and constraint verification phase begins. The coverage feedback-driven scenario selection module and the mutation operator adaptive selection module, based on the current coverage status, filter insufficiently covered areas from the scenario library and adaptively select mutation operators (such as parameter replacement, order shuffling, and anomaly injection) to generate new test scenarios. These new scenarios are then sent to the interface constraint, business constraint, and causal constraint verification module. This module verifies the scenarios from three dimensions: interface constraints ensure input and output formats match; business constraints ensure the scenario conforms to domain rules; and causal constraints ensure the timing and logical relationships of events are reasonable. Only scenarios that pass the verification can proceed to the next stage.

[0115] During the isolation execution and trajectory acquisition phase, the isolation execution and tool replay module and the running trajectory acquisition module execute the verified scenario in the sandbox environment, use tools (such as debuggers and logging systems) to replay the execution process, and collect the full system running trajectory, including function call stacks, variable states, decision paths, etc.

[0116] The evaluation and fault extraction phase begins. The coverage gain, fault bias, severity, and fitness calculation modules, based on the runtime trajectory, calculate the coverage gain (e.g., the number of newly covered branches), fault bias (the difference between actual and expected output), fault severity (e.g., system crash, data loss classification), and scenario fitness (comprehensive score) resulting from this test. Simultaneously, the fault signature extraction and minimum failure scenario generation modules cluster the occurring faults, extract fault feature signatures, and generate minimum failure scenarios by eliminating irrelevant steps to accurately locate the problem.

[0117] During the instructional compilation and repair determination phase, the instructional task compilation module and the repair regression determination module compile the extracted fault signatures and minimum failure scenarios into structured instructional tasks (such as prompts or training data containing error examples, correct demonstrations, and repair suggestions), and push them to the learner's agent modification and verification result management module. This module manages the iterative process of the agent (learner) adjusting parameters or modifying code according to the instructional task, and re-submits the modified agent to the system for regression testing. The verification result management module records the results of each verification.

[0118] Throughout the process, the scenario library, trajectory library, coverage library, fault library, and teaching task library serve as the underlying data support, storing test scenarios, running trajectories, coverage status, fault records, and teaching tasks respectively, thereby enabling data persistence and reuse.

[0119] Finally, the system uses a feedback loop mechanism to feed back the regression results from the validation result management module and the fitness data from the calculation module to the scenario selection module driven by overlay feedback in real time. This closed-loop feedback enables the system to identify which mutation operators generate high-fitness scenarios, thereby increasing the selection probability of these operators in subsequent iterations and achieving continuous evolution of teaching scenarios.

[0120] Through the aforementioned modular design and closed-loop process, this application realizes the automated and intelligent evolution of robust teaching scenarios for intelligent agents, providing a strong guarantee for the safe and reliable operation of intelligent agents.

[0121] Example 3: Taking the "e-commerce after-sales intelligent agent" as an example, its workflow includes six nodes: intent recognition, order query, after-sales rule retrieval, refund tool invocation, status writing, and response generation. The system first imports normal business scenarios such as "query logistics", "apply for refund", and "modify delivery address". After execution, it is found that the normal tool invocation path has been covered, but the recovery path of "retrying after the first timeout of the order tool" has not been covered.

[0122] The system selects a fault mutation operator to set the first response of the order query tool to timeout and the second response to normal, without changing the order number or user request. Simultaneously, the constraint module checks that the order number exists, the user's identity matches the order, and the refund amount does not exceed the actual payment amount. Therefore, this scenario satisfies business validity requirements.

[0123] Assuming the total weight of the behavior atoms is 64, and the newly added coverage weight for this scenario is 5, then: ΔC = 5 ÷ 64 = 0.078125 After running, it was found that the smart weight trial cleared the order number, causing the second call to use empty parameters. Let the output, tool, memory, safety, and recovery deviations be 0.4, 0.5, 1, 0, and 1 respectively, with weights of 0.2, 0.2, 0.25, 0.2, and 0.15 respectively, then: D=0.2(0.4)+0.2(0.5)+0.25(1)+0.2(0)+0.15(1)=0.58 When the fault threshold is 0.35, the scenario is identified as a failure scenario. The system then attempts to remove irrelevant dialogue rounds and other disturbances, ultimately retaining three elements: "valid order number, initial tool timeout, and state loss during retry," forming the minimum failure scenario.

[0124] The system compares the normal and failed trajectories, determines that the first difference occurs during the status read event of the retry node, and extracts the dependency subgraph between that node and the final response node. This generates a learning task: learners are required to fix the order number status preservation logic during the retry process, while not modifying the refund amount verification rules.

[0125] After the repair, the system re-executed the minimum failure scenario, 20 normal regression scenarios, and 10 abnormal scenarios of similar tools.

[0126] Assuming the corresponding deviations are 0.12, 0.08, and 0.15, and the weights are 0.5, 0.3, and 0.2, then: Score=100[0.5(0.88)+0.3(0.92)+0.2(0.85)]=88.6 If the preset pass threshold is 85 points, and all three types of deviations are below their respective upper limits, then the repair is considered successful; otherwise, the subsequent teaching scenario will be regenerated based on the trajectory of those who still fail.

[0127] 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 robust teaching scenario evolution method for intelligent agents, characterized in that, Specifically, the following steps are included: S1: Analyze the target agent's workflow, tools, memory, knowledge configuration, and exception handling configuration; S2: Establish the complete set of atomic and overlay states for workflow, tools, memory, retrieval, security, and recovery behaviors; S3: Execute the seed scenario and collect the running trajectory, initialize the scenario set, coverage status and operator reward; S4: Select the parent scene and mutation operator based on behavior coverage feedback to generate candidate robust scenes; S5: Verify interfaces, business logic, and causal constraints; execute feasible scenarios and collect runtime trajectories in an isolated environment. S6: Calculate new coverage, fault deviation, severity, realism, and cost; update scenario fitness and mutation operator rewards. S7: Has a valid fault been found? If yes, re-execute S4; if no, execute S8. S8: Minimize the fault scenarios and generate teaching tasks for fault reproduction, repair, and regression verification.

2. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S2, a complete set of behavioral atoms is established: in: Workflow edge and conditional branching behavior; The tool's status includes normal operation, timeout, empty return, and error code. : Memory state transitions such as write, overwrite, read, and invalidation; Search results: hit, no results, conflicting evidence, and outdated knowledge; Security policies can be categorized into branches such as allow, deny, and downgrade. Recovery behaviors include retrying, rolling back, using alternative tools, and manual takeover. For the k-th atom, define a trajectory coverage indicator function. After the t-th round of evolution, the global coverage state is: in, It is the set of scenarios that have been executed up to round t; The global weighted coverage rate is: Where K is the number of atoms in the behavior. The business importance of the k-th row atom; The new coverage brought by the candidate scenarios is as follows: Weighted by rare behaviors: in, It represents the number of times behavior atom k is triggered in the first t rounds.

3. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S5, the scenario must satisfy the following set of hard constraints: in, Indicates range constraints. Represents equality constraints; Defining hard constraints for feasibility: in, For indicator functions, This is the numerical error tolerance; if Candidate scenarios do not enter the actual execution environment; For soft constraints that allow slight deviations, define the normalized violation: in, , For the first A soft constraint function, For normalization, As a penalty weight, The number of soft constraints involved in scenario s.

4. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S6, Q decision dimensions are established for the execution result, and the normalization deviation of each dimension is: in, It corresponds to the expected rules or transformation relationships. It is an allowable deviation. The normalized distance metric between the output and the expected rule on the q-th decision dimension; You can set: And satisfy: in: : Deviations in output content, format, or semantics; : Normalized edit distance between the actual tool call sequence and the expected sequence; The proportion of memory states that violate business invariants; Deviations in security policy, such as incorrectly allowing or blocking processes. Deviations that fail to retry, roll back, or downgrade correctly after an anomaly occurs; The fault determination function is: in, To determine the comprehensive fault threshold, The number of hardware failures related to security, privacy, or finances; The severity of the fault is: in, This is the sensitivity coefficient. Additional response time caused by the fault. This is the upper limit of time normalization; the formula limits the severity to... .

5. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S6, the scene adaptability is: in: in, It's weight. It is a penalty coefficient that is greater than the sum of other income items; To indicate authenticity, the mean of the sample data from real-world business scenarios is calculated. Covariance Matrix Scene feature vector , Used to prevent the covariance matrix from becoming non-invertible; These measures Token, runtime (Time), and tool call count (Calls), respectively.

6. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S4, the set of mutation operators is: , No. The immediate reward for each operator is: in, As a father, For sub-scenes, These are the weighting coefficients of the coverage gain term and the fault term in the operator reward, respectively; Average reward of the update operator: Using the upper confidence boundary selection operator: in, For the number of times the operator is used, To explore the coefficient, This refers to the temperature parameter.

7. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S8, for the fault scenario Define the scene complexity: in, For the number of dialogue rounds, For the number of disturbances, Let be the amplitude of the disturbance. The minimization problem is: The constraints are: in, express It is obtained by deleting interactive rounds, removing perturbations, or reducing parameters; Sign the fault.

8. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: In step S8, the intelligent agent repaired by the learner is denoted as... Calculate on the minimum failure scenario, the normal regression set, and the similar mutation set respectively: The final repair score is: in, For fault repair rate, To maintain normal function, For generalization to similar scenarios, ,and The repair is considered successful when the threshold is reached.

9. The method for robust teaching scenario evolution of intelligent agents according to claim 1, characterized in that: The verification results and fitness data are fed back to the coverage feedback-driven scenario selection. The failed behavior states are re-added to the uncovered or unrepaired queue to enter the next round of scenario evolution until the target coverage, number of faults discovered, or budget is reached, and then the scenario library, fault library and repair report are output.

10. A robust teaching scenario evolution system for intelligent agents, used to implement the robust teaching scenario evolution method for intelligent agents according to any one of claims 1 to 9, characterized in that, include: Top-level analysis and modeling: including the agent engineering analysis module, scene seed management module, behavior atomic modeling module, and coverage state management module; Scenario selection and constraint verification: including a scenario selection module driven by coverage feedback and an adaptive selection module for mutation operators, as well as a module for verifying interface constraints, business constraints and causal constraints; Isolation Execution and Trajectory Acquisition: This includes the isolation execution and tool playback module and the runtime trajectory acquisition module; Evaluation calculation and fault extraction: including modules for calculating coverage gain, fault bias, severity and fitness, as well as modules for fault signature extraction and minimum failure scenario generation; Teaching compilation and repair judgment: including the teaching task compilation module and the repair and regression judgment module; Agent modification and result verification: This includes modules for learners modifying agents and managing verification results; And the underlying multi-database storage and feedback closed loop includes a scenario library, trajectory library, coverage library, fault library and teaching task library, and feeds back the data from the verification result management module and the calculation module to the coverage feedback-driven scenario selection module to realize the continuous evolution of teaching scenarios.

Citation Information

Patent Citations

  • A template-based construction method and system for teaching tasks of intelligent agent development

    CN121119642B