An intelligent agent long-term task security protection method and device
Patent Information
- Application Number
- CN202611405583.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-27
Smart Images

Figure CN123179391A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence security technology, and more specifically, to a security protection method and device for long-term intelligent agent tasks. Background Technology
[0002] Currently, in the field of artificial intelligence, intelligent agents are typically used to perform complex, long-term tasks. To ensure the security of intelligent agents during task execution, existing technologies usually employ solutions such as single-step content security filtering, tool access control, or system-provided security constraints.
[0003] However, existing security checkpoints are isolated from each other, and can only make binary decisions (allow or block) based on local information of the current action, failing to detect security state changes across multiple steps. When attackers break down malicious instructions into multiple seemingly harmless sub-problems, or when an agent gradually expands its operational permissions in a long-term task, the single-step check mechanism cannot detect the security deviations accumulated across steps, thus causing security protection to fail. Summary of the Invention
[0004] To address the problem that existing technologies cannot detect cumulative safety deviations across steps that lead to the failure of long-term task protection, this application proposes a safety protection method and device for intelligent agents in long-term tasks. This method dynamically assesses global risk by combining historical cumulative risks with the instantaneous risk increment of the current step, and performs graded handling before the risk spreads, thereby achieving proactive intervention before risk spreads and a balance between safety and execution efficiency.
[0005] Firstly, a security protection method for long-term intelligent agent tasks is provided, which may include: The task intent of a long-term task is parsed to generate a task intent profile containing security boundary information. Based on the task intent profile, the long-term task is divided into multiple execution stages, and a corresponding stage security policy is bound to each execution stage. During the process of advancing the long-term task stage by stage, the cumulative risk score is dynamically updated based on the historical accumulated risk and the instantaneous risk increment of the current executed step. When the cumulative risk score meets the preset triggering conditions, the corresponding graded handling strategy is initiated and executed.
[0006] In one possible implementation, the long-running task is divided into multiple execution phases based on the task intent profile, and a corresponding phase security policy is bound to each execution phase. This includes: identifying nodes where security risk attributes change as phase boundaries based on the security risk characteristics represented by the task intent profile; dividing the long-running task into multiple execution phases based on the identified phase boundaries, and configuring and binding a dedicated phase security policy for each execution phase independently.
[0007] In one possible implementation, the stage security strategy includes at least a cumulative risk threshold and a decay factor; the cumulative risk threshold is used to limit the upper limit of the cumulative risk score for the corresponding execution stage; the decay factor is used to control the degree of influence of historical cumulative risks and is configured differently according to the security risk characteristics of the execution stage.
[0008] In one possible implementation, the cumulative risk score is dynamically updated based on historical cumulative risk and the instantaneous risk increment of the current executed step, including: obtaining the historical cumulative risk of the previous step of the current step; performing attenuation processing on the historical cumulative risk based on the attenuation factor bound to the current execution stage to which the current step belongs, to obtain the attenuated risk value; and superimposing the attenuated risk value with the instantaneous risk increment of the current step to generate the updated cumulative risk score.
[0009] In one possible implementation, the instantaneous risk increment of the current step is determined by: based on the security boundary information defined in the task intent profile, evaluating the deviation score of the current step from the dimensions of tool use compliance, resource access compliance, behavior boundary compliance, and content security compliance; and weighting and summing the deviation scores of each dimension to obtain the instantaneous risk increment of the current step.
[0010] In one possible implementation, the preset triggering conditions include natural breakpoints, risk breakpoints, and abnormal breakpoints; the natural breakpoint is triggered when the current step reaches the stage boundary of its execution stage; the risk breakpoint is triggered when the cumulative risk score exceeds the risk threshold of the corresponding execution stage; and the abnormal breakpoint is triggered when unauthorized tool calls, restricted resource access, or unclassifiable abnormal operations are detected.
[0011] In one possible implementation, a corresponding tiered handling strategy is initiated and executed, including: in response to triggering the natural breakpoint and the cumulative risk score being lower than the cumulative risk threshold of the current stage, matching an approval plan to allow entry into the next execution stage of the current stage; in response to triggering the risk breakpoint and detecting a minor safety deviation, matching a correction plan to inject a correction prompt into the agent and continue execution; in response to triggering the risk breakpoint and detecting a moderate safety deviation, matching an approval plan to suspend the task and output a safety report; and in response to triggering the risk breakpoint and detecting a high safety deviation, matching a termination plan to terminate the task and generate a termination report.
[0012] In one possible implementation, the method further includes: updating the action description, input parameters, output results, and tool call information of the current step to the trajectory summary cache during the phased advancement of the long-term task; and extracting the context information of the current execution stage from the trajectory summary cache when the cumulative risk score meets the preset triggering conditions to support the decision-making of the hierarchical disposal strategy.
[0013] Secondly, a security protection device for long-term intelligent agent tasks is provided. This device may include: an intent parsing unit, used to parse the task intent of the long-term task and generate a task intent profile containing security boundary information; a stage division unit, used to divide the long-term task into multiple execution stages based on the task intent profile and bind corresponding stage security policies to each execution stage; a risk monitoring unit, used to dynamically update the cumulative risk score based on historical accumulated risks and the instantaneous risk increment of the currently executed steps during the process of advancing the long-term task stage by stage; a security breakpoint unit, used to trigger a security breakpoint and initiate a tiered handling strategy when the cumulative risk score meets a preset trigger condition; and a guard plan scheduler, used to execute the corresponding tiered handling strategy in response to the security breakpoint.
[0014] Thirdly, an electronic device is provided, comprising: at least one memory for storing program instructions; and at least one processor for calling the program instructions stored in the memory and executing the steps of the above-described security protection method for long-range intelligent agent tasks according to the obtained program instructions.
[0015] This application generates a task intent profile containing security boundary information by parsing the task intent of a long-term task. Based on this profile, the long-term task is divided into multiple execution phases bound to independent security policies, allowing the granularity of security protection to be reduced from the task level to the phase level, achieving an adaptive balance between security and execution efficiency. During the phase-by-phase progression, the cumulative risk score is dynamically updated by combining the attenuation of historical accumulated risks with the instantaneous risk increment of the current step. Mathematically, this ensures that even if the risk increment of each single-step operation is low, the cumulative risk score will continue to rise as long as the operation deviates from the security baseline. This effectively detects security deviations accumulated across steps, solving the detection challenge of cross-step attack patterns such as progressive jailbreaking and toolchain covert attacks. When the cumulative risk score meets the triggering conditions, a tiered handling strategy is triggered collaboratively through natural breakpoints, risk breakpoints, and abnormal breakpoints. This overcomes the limitations of the binary decision-making in existing solutions, suspending task execution and providing tiered intervention measures before the risk spreads to an uncontrollable level. This proactive intervention before risk spread significantly reduces the false interception rate and improves the security controllability throughout the entire lifecycle. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the structure of a security protection system provided in an embodiment of this application; Figure 2 A flowchart illustrating a security protection method for long-range tasks of an intelligent agent provided in an embodiment of this application; Figure 3 A schematic diagram illustrating the change of cumulative risk score with steps, provided for an embodiment of this application; Figure 4 A schematic diagram of a security protection device for long-range tasks of an intelligent agent provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise defined, the technical or scientific terms used in this application should have the ordinary meaning understood by those skilled in the art. The words "first," "second," and similar terms used in this application do not indicate any order, quantity, or importance, but are only used to distinguish different components. The words "comprising" or "including," etc., mean that the element or object preceding the word covers the element or object listed after the word and its equivalents, but do not exclude other elements or objects. The words "connected," "coupled," or "connected," etc., are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up," "down," "left," "right," etc., are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0019] The security protection method for long-term intelligent agent tasks provided in this application embodiment can be applied to... Figure 1 In the security protection system shown, such as Figure 1As shown, the security protection system may include: an intent parsing module 10, a phase division module 20, an intelligent agent execution engine 30, a risk monitoring module 40, a trajectory summary cache 50, a security breakpoint module 60, a guard plan scheduler 70, a plan library 80, and a witness recording module 90. Among them: The intent parsing module 10 receives long-term task requests at its input end and is connected to the input end of the stage division module 20 at its output end. It is used to perform structured semantic analysis on the task description and generate a task intent profile.
[0020] The stage division module 20 has its input end connected to the output end of the intent parsing module 10 and its output end connected to the input end of the intelligent agent execution engine 30. It is used to divide long-term tasks into multiple execution stages based on the task intent profile and bind differentiated security policies to each execution stage.
[0021] The intelligent agent execution engine 30 has its input end connected to the output end of the stage division module 20 and its output end connected to the input end of the risk monitoring module 40. It is used to drive the intelligent agent to execute task steps one by one according to the stage division results.
[0022] The risk monitoring module 40 has a first input connected to the output of the intelligent agent execution engine 30, a second input connected to the read / write end of the trajectory summary cache 50, and an output connected to the input of the safety breakpoint module 60. It is used to update the trajectory summary cache 50 and calculate the cumulative risk score after each execution step is completed.
[0023] The trajectory summary cache 50 is bidirectionally connected to the risk monitoring module 40 and is used to store complete summary information of the executed operation sequence in a structured manner.
[0024] The safety breakpoint module 60 has its input end connected to the output end of the risk monitoring module 40 and its output end connected to the input end of the guard plan scheduler 70. It is used to listen for three types of safety breakpoint trigger conditions and collect the current stage context information and pass it to the guard plan scheduler 70 when triggered.
[0025] The guard plan dispatcher 70 has its first input terminal connected to the output terminal of the safety breakpoint module 60, its second input terminal connected to the reading terminal of the plan library 80, and its output terminal connected to the control terminal of the intelligent agent execution engine 30 and the input terminal of the witness recording module 90. It is used to match the corresponding graded disposal plan from the plan library 80 according to the breakpoint type and the cumulative risk score and execute it.
[0026] The contingency plan library 80 is bidirectionally connected to the guard contingency plan dispatcher 70 and is used to store various graded handling contingency plans, such as approved contingency plans, revised contingency plans, approved contingency plans, terminated contingency plans, downgraded contingency plans, and rollback contingency plans.
[0027] Witness recording module 90, whose input is connected to the output of guard plan scheduler 70, is used to continuously write security-related events into execution witness records organized in a hash chain structure.
[0028] The collaborative working relationship between the above components is as follows: The intent parsing module 10 first parses the input long-range task request to generate a task intent profile. The stage division module 20 divides the task into multiple execution stages based on the profile and binds a security policy to each stage. The agent execution engine 30 drives the agent to execute stage by stage. After each step is completed, the risk monitoring module 40 updates the trajectory summary cache 50 and calculates the cumulative risk score. The security breakpoint module 60 continuously listens for breakpoint trigger conditions. Once triggered, the guard plan scheduler 70 matches and executes the corresponding plan from the plan library 80. All security-related events during the entire execution process are continuously recorded by the witness recording module 90 to form an immutable execution witness record.
[0029] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0030] Figure 2 This is a flowchart illustrating a security protection method for long-range tasks of an intelligent agent, provided in an embodiment of this application. Figure 2 As shown, the method may include: Step S210: Parse the task intent of the long-range task and generate a task intent profile containing security boundary information.
[0031] When a user or upstream system issues a long-range task request, the intent parsing module receives the request and performs structured semantic analysis on the task description to identify the core objective, operational object, and expected output of the task, thereby generating a task intent profile. The task intent profile may include elements such as: intent type, security boundaries, list of licensed tools, list of restricted resources, and expected output specifications. Specific operations include: Identify intent type: Determine the category to which the task belongs (such as code repair, data analysis, file management, network operation, etc.).
[0032] Extract security boundaries: Based on the task type and content, deduce implicit or explicit security constraints (such as not being able to delete files, not being able to access external networks, not being able to modify system configurations, etc.).
[0033] Identify licensed tools and restricted resources: Determine the set of tools that are allowed to be invoked to perform the task, as well as resources or operations that are explicitly prohibited from access.
[0034] The task intent profile serves as the security benchmark for the entire security protection system. All subsequent security deviation detections are based on comparing the differences between the actual execution trajectory and the security boundaries defined by the task intent profile. For example, for code repair tasks, security boundaries may include prohibiting file deletion and prohibiting modification of non-vulnerability-related code. It should be understood that the task intent profile is not limited to code repair scenarios; it can also be applied to various long-term task scenarios such as data analysis, file management, and network operations, as long as clear security boundary information can be extracted from it.
[0035] Step S220: Divide the long-term task into multiple execution phases based on the task intent profile, and bind the corresponding phase security policy to each execution phase.
[0036] The phase management module automatically divides long-term tasks into multiple independently verifiable execution phases based on dimensions such as the complexity of the task intent profile, tool usage plan, and security sensitivity. A single long-term task consists of multiple execution phases, and each execution phase contains several execution steps.
[0037] Each execution phase is bound to an independent phase security policy, which may include configuration parameters such as: a subset of visible tools, security check frequency, cumulative risk threshold, guard plan references, and decay factor. Specifically: the cumulative risk threshold is the upper limit of the allowed cumulative risk score for the corresponding execution phase; the decay factor (decay_factor) characterizes the rate at which the impact of historical risks decays; the visible tool subset is the range of tools allowed to be invoked in the corresponding execution phase; the security check frequency is the frequency of checks performed once per step or every K steps in the corresponding execution; and the guard plan references are the default associated handling plan types for the corresponding execution phase.
[0038] By dividing the work into phases, the granularity of security protection is reduced from the task level to the phase level, achieving an adaptive balance between security and execution efficiency. For example, a code remediation task can be divided into four execution phases: search and identification, remediation plan design, code modification, and testing and submission. Each phase is bound to different security policies based on its operational characteristics. It should be understood that the number and granularity of the phases can be dynamically adjusted according to the complexity of the task, and are not limited to a fixed number of phases.
[0039] Step S230: During the process of advancing long-term tasks in each execution phase, the cumulative risk score is dynamically updated based on the historical accumulated risk and the instantaneous risk increment of the current executed step.
[0040] The agent execution engine executes in a phase-by-phase sequence (Phase 1 → Phase 2 → ...). Within each phase, it executes step-by-step in sequence (Step 1, Step 2, ...). After each step is completed, the risk monitoring module obtains the instantaneous risk increment of the current step and, combined with the historical accumulated risk of the previous step, dynamically calculates and updates the current accumulated risk score. The instantaneous risk increment reflects the degree of deviation of the current step from the safety baseline defined by the task intent profile.
[0041] By combining historical accumulated risk with the instantaneous risk increment of the current step to dynamically update the accumulated risk score, it mathematically ensures that even if the risk increment of each single step is very low, as long as the operation continues to deviate from the security benchmark, the accumulated risk score will continue to rise. This effectively detects security deviations accumulated across steps and solves the detection problem of cross-step attack patterns such as progressive jailbreaking and toolchain covert attacks.
[0042] Step S240: When the cumulative risk score meets the preset triggering conditions, the corresponding graded handling strategy is initiated and executed.
[0043] The safety breakpoint module continuously monitors the accumulated risk score and related status. When the accumulated risk score meets the preset trigger conditions, the safety breakpoint module triggers a safety breakpoint and transmits the breakpoint event and the current stage's context information to the guard plan scheduler. The guard plan scheduler matches and executes the corresponding tiered response plan based on the breakpoint type and the current accumulated risk level, such as approving the plan, revising the plan, approving the plan, or terminating the plan.
[0044] By employing a tiered response strategy, the limitations of the existing binary decision-making approach are overcome. Task execution is suspended and tiered intervention measures are provided before the risk spreads to an uncontrollable level, enabling proactive intervention before the risk spreads. This significantly reduces the false interception rate and improves the security and controllability throughout the entire lifecycle.
[0045] In some embodiments, generating a task intent profile containing security boundary information includes: constructing a dynamic security boundary cognitive graph, which represents the operational objects, tool resources, and data assets involved in the task execution process using entity nodes and relational edges; assigning multi-dimensional security attribute labels to each entity node and relational edge in the cognitive graph, wherein the multi-dimensional security attribute labels include at least access control labels, sensitivity level labels, and operational constraint labels; and extracting security boundary information based on the cognitive graph, wherein the security boundary information includes hard boundaries and soft boundaries; hard boundaries are absolute security restrictions that cannot be crossed, and soft boundaries are flexible security restrictions that allow dynamic adjustment.
[0046] Specifically, when analyzing the mission intent of long-range tasks and constructing the corresponding security protection framework, a dynamic security boundary cognitive graph is first introduced as the core data structure for expressing and understanding security constraints in the task execution space. This cognitive graph is represented using a graph model, where entity nodes represent all operational objects, tools, resources, and data assets that may be involved in the task execution process, such as file systems, database tables, external API interfaces, third-party tools, system commands, and sensitive user information; relationship edges represent the interaction relationships between entities, such as "call," "read / write," "transfer," and "authorization." By constructing such a graph, the system can make the originally implicit and dispersed security requirements explicit and structured, forming a computable and reasonable security knowledge network. After the cognitive graph is constructed, multi-dimensional security attribute labels are further assigned to each entity node and each relationship edge in the graph. These labels include at least access control labels (such as "read-only," "read / write," and "deny access"), sensitivity level labels (such as "public," "internal," "confidential," and "top secret"), and operational constraint labels (such as "frequency limit," "time window limit," and "parameter whitelist"). The assignment process can be achieved through matching with a predefined security policy library, statistical analysis based on historical execution data, or manual annotation. The multi-dimensional label design allows the cognitive graph to reflect not only static permission information but also dynamic operational constraints, providing a rich data foundation for subsequent risk assessment. Finally, based on the labeled multi-dimensional security attribute labels, structured security boundary information is extracted from the cognitive graph and explicitly divided into two categories: hard boundaries and soft boundaries. Hard boundaries refer to absolute security restrictions that cannot be crossed under any circumstances, such as prohibiting access to the core key storage area or prohibiting the execution of unapproved commands with super administrator privileges. Once a hard boundary is violated, the highest level of security action (such as task termination) will be triggered directly. Soft boundaries refer to flexible security restrictions that can be dynamically adjusted according to the task execution context, such as temporarily relaxing the upper limit on the access frequency of non-sensitive data when resources are scarce, or allowing a moderate expansion of the range of operational parameters when the task priority is extremely high. By dividing the security boundaries into hard and soft layers, this method ensures both absolute security and retains the necessary flexibility for the agent to complete tasks in complex and dynamic environments, achieving an effective balance between security and task completion. The extracted hard and soft boundary information is ultimately integrated into the task intent profile, serving as the core basis for subsequent stage division, strategy binding, and real-time risk monitoring.
[0047] Based on the above embodiments, long-term tasks are divided into multiple execution phases based on task intent profiles, and corresponding phase security policies are bound to each execution phase, including: Based on the security risk characteristics represented by the task intent profile, nodes where security risk attributes change are identified as stage boundaries. Using the identified stage boundaries as the basis for division, long-term tasks are divided into multiple execution stages, and each execution stage is independently configured and bound with a dedicated stage security policy.
[0048] Specifically, after receiving the task intent profile, the stage management module does not divide it equally according to the number of execution steps. Instead, it performs in-depth analysis of the security risk characteristics represented in the task intent profile. Nodes where security risk attributes change typically indicate a shift in the potential destructive power or scope of impact of the agent's actions. Taking a code repair task as an example, when the task transitions from "search and analysis" to "code modification," its security risk attributes undergo a fundamental change: the search and analysis stage mainly involves read-only operations, with risks limited to information leakage; while the code modification stage involves write operations, escalating the risk to data corruption or logical breaches. Therefore, the stage management module identifies nodes where such shifts in operational permissions and potential impacts constitute stage boundaries.
[0049] By using changes in risk attributes as the basis for division, the operations within each execution phase have similar security risk characteristics. This allows for the matching of the most accurate security strategies to each phase, avoiding unnecessary strict scrutiny of low-risk phases while ensuring the most rigorous monitoring of high-risk phases.
[0050] Understandably, stage boundary identification can be based on a comprehensive judgment of multi-dimensional features, rather than solely relying on step numbers. Besides the aforementioned operational semantic transitions (such as switching from read-only to write), stage boundary identification can also be based on the switching of tool invocation types. For example, when an agent switches from invoking a code search tool to invoking a file writing tool, the system can determine that a stage boundary has been reached.
[0051] Furthermore, the escalation of resource access permissions can also serve as a basis for determining stage boundaries. For example, when an agent requests access to the production environment database instead of the test environment database, even if the operation type remains unchanged, its risk attributes have significantly changed, and stage boundary identification should be triggered in this case. Through comprehensive judgment of multi-dimensional features, the system can more accurately capture the real nodes of risk changes, effectively preventing attackers from circumventing stage boundary detection by splitting steps or disguising operation types, thereby improving the accuracy and security of stage division.
[0052] This embodiment achieves precise decentralization of security protection granularity from the task level to the stage level by dynamically identifying stage boundaries based on security risk characteristics. This division method makes the binding of stage security policies more closely aligned with the actual risk distribution, providing a reasonable stage framework for the subsequent differentiated calculation and graded handling of cumulative risk scores.
[0053] As a scalable implementation, the above embodiments divide stages based on security risk characteristics. In actual deployment, other stage division strategies can also be adopted. Stage division by tool call frequency, with every K tool calls constituting one execution stage, is suitable for tasks with stable tool call frequencies and simple operation types. Stage division by time window, with a security breakpoint forcibly triggered every T minutes, is suitable for tasks with high real-time requirements and needing security checks at fixed time intervals. Stage division by semantic boundaries, using a large language model to detect semantic inflection points of the task as stage boundaries, is suitable for scenarios with flexible task structures and where stage boundaries are difficult to predetermine. Dynamic adaptive stage division adjusts the stage granularity in real time according to the changing trend of the cumulative risk score. When the risk score increases rapidly, the stage granularity is automatically reduced to increase the check frequency; when the risk score is stable, the stage granularity is appropriately expanded to improve execution efficiency. The dynamic adaptive stage division strategy achieves dynamic matching between security protection granularity and real-time risk situation by introducing the risk change rate as a feedback control signal for stage granularity. When the rate of increase in the cumulative risk score exceeds a preset threshold, the system automatically breaks down the current stage into finer-grained sub-stages and assigns them stricter security policies, thereby enabling more intensive monitoring during the critical window period of accelerated risk accumulation. This risk feedback-based adaptive mechanism allows security resources to be concentrated on high-risk periods, avoiding the waste of resources that would otherwise be allocated to low-risk periods with fixed granularity and the inadequacy of monitoring during high-risk periods.
[0054] Furthermore, the phased security strategy may include at least a cumulative risk threshold and a decay factor; the cumulative risk threshold is used to limit the upper limit of the cumulative risk score for the corresponding execution phase; the decay factor is used to control the degree of impact of historical cumulative risks and is configured differently according to the security risk characteristics of the execution phase.
[0055] Since the cumulative risk threshold is the upper limit of risk tolerance allowed in each execution phase, the system will trigger the corresponding safety breakpoint when the cumulative risk score exceeds this limit.
[0056] The attenuation factor determines the proportion of historical risk retained in subsequent steps, and its value typically ranges from 0 to 1. For high-risk phases, the system is configured with a smaller attenuation factor, such as 0.5. This means that half of the risk from the previous step will be retained and added to the current step, thus retaining more historical risk memory, allowing even small, persistent deviations to be quickly amplified and detected. For low-risk phases, the system is configured with a larger attenuation factor, such as 0.9. This means that the impact of historical risk will decay rapidly, thus tolerating occasional, non-systematic operational fluctuations and avoiding false alarms triggered by a single accident.
[0057] Taking SQL injection remediation as an example, the phase management module divides the task into four phases and configures differentiated parameters for each phase. Phase 1 is search and identification, with risk characteristics of "read-only operation, information collection," including steps such as code search and vulnerability location. It is a low-risk phase with a cumulative risk threshold of 0.8 and a decay factor of 0.9, allowing for a higher risk tolerance and faster forgetting of historical risks. Phase 2 is remediation plan design, with risk characteristics of "analysis operation, plan generation," including steps such as vulnerability analysis and remediation plan design. It is a medium-risk phase with a cumulative risk threshold of 0.7 and a decay factor of 0.8. Phase 3 is code modification, with risk characteristics of "write operation, high risk," including steps of actually modifying code files. It is a high-risk phase involving actual file write operations, with a cumulative risk threshold of 0.6 and a decay factor of 0.5, using the lowest threshold and the slowest decay to achieve the strictest monitoring. Phase 4 is testing and submission, with risk characteristics of "verification operation, medium risk," including steps such as running tests and submitting code. It is a medium-risk phase with a cumulative risk threshold of 0.7 and a decay factor of 0.8. Through this differentiated configuration, the system can maintain high execution efficiency in low-risk phases and achieve robust security protection in high-risk phases.
[0058] The configuration of the aforementioned attenuation factor is crucial for detecting cumulative security deviations across steps. If the attenuation factor is configured to 0, the cumulative risk score depends entirely on the instantaneous risk increment of the current step, and the system degenerates into a memoryless single-step check mechanism, unable to detect cross-step attack patterns such as progressive jailbreaking. If the attenuation factor is configured to 1, historical risks never attenuate, and any occasional low-risk operation will be permanently accumulated, easily leading to the accidental blocking of normal tasks during execution. This embodiment, by configuring the attenuation factor between 0 and 1 and adjusting it differently according to the stage risk characteristics, mathematically ensures the reasonable retention and forgetting of risk memory, achieving an adaptive balance between security and execution efficiency.
[0059] In some embodiments, the cumulative risk threshold can be dynamically adjusted in the following ways: obtaining the execution progress information and environmental context information of the current execution stage; calculating the remaining execution ratio of the stage based on the execution progress information, and evaluating the environmental risk coefficient based on the environmental context information; calculating the threshold adjustment amount according to the remaining execution ratio of the stage and the environmental risk coefficient, and calculating the threshold adjustment amount according to a preset dynamic threshold adjustment function; and superimposing the threshold adjustment amount onto the baseline value of the cumulative risk threshold to obtain the dynamically adjusted cumulative risk threshold for the current execution stage.
[0060] Specifically, during the current execution phase, the system acquires two types of information in real time: first, the execution progress information for this phase, typically including quantifiable progress indicators such as the number of executed steps and the total number of steps in the phase; second, the current environmental context information, such as network load, system resource utilization, external security alarm levels, and time sensitivity—external factors that may affect the risk situation. Based on the execution progress information, the system can calculate the remaining execution ratio of the phase (e.g., the ratio of remaining steps to the total number of steps). Simultaneously, based on the aforementioned environmental context information, the system uses a pre-established environmental risk assessment model (e.g., based on fuzzy logic or weighted scoring methods) to assess and obtain a quantified environmental risk coefficient. This coefficient represents the overall amplification or suppression effect of the current external environment on the task execution risk. When the environment becomes more severe (e.g., network congestion, frequent abnormal alarms), this coefficient increases, and vice versa.
[0061] Subsequently, the remaining execution percentage and environmental risk coefficient are used as inputs and substituted into a preset dynamic threshold adjustment function for calculation. This adjustment function can be designed in various forms, such as a linear function, a piecewise function, or a nonlinear function fitted based on historical data. Its design principle is: when the remaining execution percentage is small (i.e., the task is nearing completion), a more lenient risk tolerance is usually allowed, so the threshold adjustment amount may be negative (i.e., lowering the threshold to tighten restrictions); while when the environmental risk coefficient is high, the risk tolerance should be reduced, making the adjustment amount negative or decreasing the positive value. Through this function, the system calculates a specific threshold adjustment amount (which can be positive, negative, or zero).
[0062] Finally, the calculated threshold adjustment is superimposed on the pre-set cumulative risk threshold baseline for this execution phase, thus obtaining the dynamically adjusted cumulative risk threshold. This adjusted threshold will serve as the basis for determining whether to trigger risk breakpoints in subsequent steps. Through this method, the cumulative risk threshold is no longer static but is continuously or discretely adjusted according to the dynamic changes in execution progress and environmental risks. This ensures the security of critical later stages while avoiding excessive interference with task execution due to excessively low thresholds in a favorable security environment, significantly improving the phase adaptability and environmental awareness of the security protection strategy. The baseline value of the cumulative risk threshold is the risk threshold pre-set by the system for that stage without dynamic adjustment when a stage security policy is bound to it.
[0063] In some embodiments, the cumulative risk score is dynamically updated based on historical cumulative risk and the instantaneous risk increment of the current step already performed, including: Obtain the historical accumulated risk of the previous step of the current step; based on the attenuation factor bound to the current execution stage to which the current step belongs, attenuate the historical accumulated risk to obtain the attenuated risk value; superimpose the attenuated risk value with the instantaneous risk increment of the current step to generate an updated accumulated risk score.
[0064] Specifically, the risk monitoring module triggers an update process for the cumulative risk score after each step is completed by the agent's execution engine. The system first retrieves the historical cumulative risk of the previous step from the state memory. Then, it reads the attenuation factor bound to the current execution stage, which is configured differently based on the safety risk characteristics of the execution stage. This attenuation factor is then used to attenuate the historical cumulative risk, resulting in a attenuated risk value. Finally, the attenuated risk value is superimposed on the instantaneous risk increment of the current step to generate the updated cumulative risk score. The instantaneous risk increment reflects the degree of deviation of the current step from the safety baseline defined by the task intent profile.
[0065] This embodiment uses an exponential decay model to dynamically update the cumulative risk score. The mathematical expression of the exponential decay model is as follows:
[0066] in, The cumulative risk score for the current step t. The cumulative risk score for the previous step t-1, As the attenuation factor, This represents the instantaneous risk increment at the current step t. The methods for obtaining each parameter are clear and feasible: The risk monitoring module calculates and stores the data in memory or database at the end of the previous step, and it can be read directly. The stage management module pre-configures and binds the security risk characteristics of each execution stage during the task initialization stage, and the risk monitoring module queries and obtains the information based on the stage identifier of the current step. The risk monitoring module performs a real-time evaluation and calculation of the actions of the current step based on the safety boundary information defined in the task intent profile after the current step is completed. This is the output of this calculation, and will also be used in the next calculation step. Stored.
[0067] This exponential decay model mathematically ensures that even with extremely low single-step risk increments, continuous deviations will lead to an increase in the score, which is crucial for detecting incremental jailbreak attacks. In incremental jailbreak attack scenarios, attackers break down malicious commands into multiple seemingly harmless sub-problems, each of which, when examined individually, reveals its... It might be as low as 0.01 or even lower, which would be considered safe in a traditional single-step checking mechanism. However, in the model of this application, because... If the value is less than 1 and greater than 0, historical risk will not be immediately eliminated, but will be retained at a certain proportion. (Assume...) It is 0.9, even for each step. The value was only 0.02, after multiple execution steps. This will show a continuous upward trend and eventually approach the threshold. Mathematically, this mechanism achieves the cumulative amplification of persistent, small deviations, effectively compensating for the shortcomings of existing single-step independent guardrails that cannot detect changes in risk status across steps. Simultaneously, because... The existence of this feature means that the impact of occasional, single, medium-risk operations (such as accidentally triggering an alarm but not continuing afterward) will gradually decrease as the process progresses, avoiding the problem of false blocking caused by static accumulation, and achieving accurate capture of real threats and reasonable tolerance for normal fluctuations.
[0068] As a scalable implementation, the above embodiments employ an exponential decay model to dynamically update the cumulative risk score. In actual deployment, other types of cumulative risk scoring algorithms can also be selected. The linear cumulative model only accumulates the instantaneous risk increment of each step without decay processing, making it suitable for highly sensitive scenarios with zero tolerance for security deviations, such as agent tasks in financial transactions or medical diagnosis. The sliding window model only counts the sum of the instantaneous risk increments of the most recent N steps; historical steps outside the window range no longer affect the current score, making it suitable for scenarios where the correlation between task steps is weak and more focused on recent behavioral patterns. The multidimensional risk vector model calculates the cumulative risk score from multiple dimensions such as operational deviation, content deviation, and resource deviation. Each dimension independently maintains its own decay factor and threshold, and finally, the risk level is comprehensively determined through vector operations, making it suitable for complex scenarios requiring fine-grained differentiation of different types of security deviations. The machine learning prediction model uses historical security event data to train the prediction model and predicts the probability of future security events based on the characteristics of the current trajectory, making it suitable for scenarios with a large amount of accumulated historical data and regular attack patterns. The selection of different cumulative risk scoring algorithms is not arbitrary, but requires comprehensive consideration based on the security sensitivity of the task, the strength of the correlation between steps, and the amount of available historical data. In ultra-high security scenarios, linear cumulative models and exponential decay models can be run in parallel, and the higher score of the two can be used as the final judgment criterion. This utilizes the zero-omission characteristic of the linear model to capture any small deviations, while using the decay characteristic of the exponential decay model to filter out occasional noise, forming a complementary dual-model redundancy detection mechanism.
[0069] In some embodiments, the instantaneous risk increment of the current step is determined by: Based on the security boundary information defined in the task intent profile, the deviation score of the current step is evaluated from the dimensions of tool usage compliance, resource access compliance, behavior boundary compliance, and content security compliance. The deviation scores of each dimension are weighted and summed to obtain the instantaneous risk increment of the current step.
[0070] Specifically, when assessing the instantaneous risk increment of the current step, the risk monitoring module does not rely solely on a single security rule, but rather breaks it down into four orthogonal evaluation dimensions. Tool usage compliance assesses whether the agent invokes tools not declared in the task intent profile or the list of permitted tools. For example, if the task intent profile only allows invoking code search tools, and the agent attempts to invoke a file deletion tool, the deviation score for this dimension will be close to 1.0. Resource access compliance assesses whether the agent accesses resources in the restricted resource list. For example, if the agent performs a task in a test environment but attempts to access a production environment database, this dimension will output a high deviation score. Behavioral boundary compliance assesses whether the agent's actions violate the security boundaries defined in the task intent profile. For example, modifying code logic unrelated to the vulnerability in a code repair task, or performing dangerous operations such as deleting files. Content security compliance assesses whether the agent's input and output content contains harmful, illegal, or sensitive information. For example, whether code snippets containing malicious scripts are generated. Each dimension outputs a deviation score between 0 and 1. The system then performs a weighted summation and normalization of the deviation scores for each dimension to obtain the instantaneous risk increment in the range of 0 to 1.
[0071] The aforementioned weights are not fixed but can be dynamically adjusted based on the task intent profile. For code repair tasks, since the core of such tasks lies in the precise modification of code logic, the weight of behavioral boundary compliance is configured higher than that of content security compliance to prevent the agent from introducing irrelevant logical changes during the repair process. For data analysis tasks, since such tasks frequently involve reading various data sources, the weight of resource access compliance is configured higher to strictly prevent the risk of unauthorized access to sensitive data. By dynamically adjusting the weights, the system can achieve accurate risk profiling for different types of long-term tasks, avoiding excessive consumption of computing resources on non-core dimensions.
[0072] This embodiment constructs a three-dimensional risk perception network through multi-dimensional comprehensive evaluation. If only a single dimension is used for evaluation, such as checking only content security compliance, it will be insufficient to cover complex long-term task risks. In toolchain covert attack scenarios, attackers may gradually expand their operational privileges through a series of content security compliance operations. In this case, a single-dimensional evaluation cannot detect the accumulation of risks at the tool usage and resource access levels, leading to serious missed detections. The four-dimensional evaluation mechanism of this embodiment ensures that any security deviation at any level can be captured and transformed into instantaneous risk increments, providing a comprehensive and accurate data foundation for the dynamic updating of subsequent cumulative risk scores.
[0073] In some embodiments, preset triggering conditions may include: natural breakpoints, risk breakpoints, and abnormal breakpoints; a natural breakpoint is triggered when the current step reaches the stage boundary of its execution stage; a risk breakpoint is triggered when the accumulated risk score exceeds the risk threshold of the corresponding execution stage; and an abnormal breakpoint is triggered when unauthorized tool calls, restricted resource access, or unclassifiable abnormal operations are detected.
[0074] Specifically, the security breakpoint module continuously monitors the running status of the agent's execution engine, as well as the cumulative risk score output by the risk monitoring module.
[0075] Natural breakpoints are primarily used for routine stage transition checks. When the agent completes the last step within the current stage and reaches the stage boundary, the safety breakpoint module automatically triggers a natural breakpoint. At this point, the system performs a routine check on the overall execution status of the current stage to determine whether the task is allowed to proceed to the next execution stage.
[0076] like Figure 3 As shown in the figure, the curve diagram illustrating the change of the cumulative risk score with each step demonstrates the dynamic change process of the cumulative risk score in this application. Figure 3 The horizontal axis represents the execution step number, and the vertical axis represents the cumulative risk score. The graph shows two curves: the solid line represents the trajectory of the actual cumulative risk score as the number of steps changes, and the dashed line represents the risk threshold at the current stage. It can be seen that: Phase A (Step-5): The cumulative risk scores for steps 1 to 5 are 0.08, 0.09, 0.07, 0.10, and 0.09, respectively. During this phase, the agent's operations are generally compliant, with occasional minor deviations (such as minor anomalies in tool call parameters or access to unnecessary auxiliary resources), but these deviations are low and not sustained. Due to the decay factor (assumed to be 0.9), historical risks are gradually forgotten, and the scores fluctuate slightly between 0.07 and 0.10, without showing a sustained upward trend.
[0077] Phase B (Steps 6-10): The cumulative risk scores for steps 6 to 10 are 0.12, 0.15, 0.18, 0.23, and 0.28, respectively. During this phase, the agent's actions begin to exhibit persistent, low-amplitude security deviations (e.g., gradually introducing minor operations inconsistent with the task's intended profile, but the instantaneous risk increment of each step remains below the alarm threshold of the content security filter). Because these deviations continue, the decay factor cannot completely offset the newly accumulated risk, and the score shows a monotonically increasing trend. By step 10, the score reaches 0.28. Although there is still considerable room before reaching the threshold of 0.70, the upward trend is clear, demonstrating an early warning capability against "gradual jailbreak" attacks.
[0078] Phase C (Steps 11-16): The cumulative risk scores for steps 11 to 16 are 0.60, 0.62, 0.66, 0.70, 0.76, and 0.82, respectively. In this phase, the agent's deviation behavior intensifies significantly, and the instantaneous risk increment increases dramatically. The score jumps to 0.60 in step 11, 0.62 in step 12, 0.66 in step 13, and reaches 0.70 in step 14, precisely hitting the risk threshold configured for this phase and triggering a risk breakpoint. It should be noted that the trigger condition for the risk breakpoint is that the cumulative risk score reaches or exceeds the risk threshold; therefore, the breakpoint is triggered in step 14, not in steps 15 or 16. Task execution is immediately suspended after step 14, and the tiered handling process begins. The scores for steps 15 and 16 are 0.76 and 0.82, respectively, representing the subsequent risk change trends recorded after the task has been suspended (if no intervention is provided, the risk will continue to rise). This data can be used as audit material to demonstrate the necessity and timeliness of the breakpoint trigger.
[0079] Steps 17-20: When the cumulative risk score drops to 0, it indicates that the task has been terminated (the termination plan has been executed), the system will no longer generate new security events, and the risk score will be zero.
[0080] (1) Stages A and B demonstrate that the exponential decay model can distinguish between occasional minor deviations and persistent low-amplitude deviations. The former's score will naturally decline, while the latter's score will steadily rise, providing a clear trend signal for subsequent risk prediction. (2) The precise triggering of step 14 demonstrates that the risk breakpoint mechanism can respond immediately at the critical moment when the accumulated risk just reaches the safety threshold, neither too early nor too late, avoiding premature misinterpretation and preventing loss of control due to delay. (3) The subsequent rise in steps 15-16 demonstrates that if no intervention is made, the risk will irreversibly spread, further highlighting the key value of triggering the breakpoint in step 14 for in-process intervention. (4) The score returning to zero after termination reflects the thoroughness of the termination plan. This curve fully illustrates the effectiveness, timeliness, and accuracy in detecting cumulative safety deviations across steps.
[0081] Furthermore, abnormal breakpoints have the highest priority and can interrupt any type of breakpoint handling process. For example, when the system is performing context collection and handling scheduling for natural or risky breakpoints, if an agent suddenly initiates an unauthorized access to the production environment database, the security breakpoint module will immediately suspend the current process, prioritize triggering the abnormal breakpoint, and perform a fallback interception action. This collaborative mechanism ensures that regardless of the attacker's covert methods, the system can respond in the shortest possible time, effectively preventing damage caused by score manipulation attacks or sudden high-risk operations.
[0082] As a scalable implementation, the above embodiments employ a synchronous blocking triggering mode, which completely suspends the generation of subsequent actions by the agent after triggering the safety breakpoint until the handling is completed. In actual deployment, other triggering modes can also be selected. Asynchronous alarm triggering issues an alarm signal after triggering the safety breakpoint but allows the agent to continue execution, suitable for scenarios with low risk levels and requiring task continuity. Cumulative triggering triggers the safety breakpoint only after M consecutive cumulative risk scores exceed a threshold, suitable for scenarios with large instantaneous risk fluctuations and requiring avoidance of sporadic triggering. Hierarchical breakpoints are divided into three levels: yellow, orange, and red, based on risk level. The yellow level only logs, the orange level issues an alarm and lowers the execution priority, and the red level completely suspends execution, suitable for scenarios requiring refined risk response. The above-mentioned hierarchical breakpoints, by introducing a multi-level response mechanism, construct a smooth transition range between complete permission and complete blocking. In the orange level, the system can indirectly reduce the agent's execution speed by reducing its inference budget (e.g., reducing the number of tokens that can be generated and limiting the concurrency of tool calls), buying time for manual review without completely interrupting the task flow. This "slow-down observation" strategy is particularly important for long-duration missions because a complete pause may result in loss of context or mission timeout, while slow-down observation controls the rate of risk propagation and maintains mission continuity.
[0083] In some embodiments, a corresponding tiered handling strategy is initiated and executed, including: In response to triggering a natural breakpoint and the cumulative risk score being lower than the cumulative risk threshold for the current stage, the contingency plan is matched to allow entry into the next execution stage of the current stage; In response to triggering a risk breakpoint and detecting a slight safety deviation, a corrective plan is matched to inject corrective prompts into the agent before execution continues; In response to triggering a risk breakpoint and detecting a moderate safety deviation, the approved contingency plan is matched to suspend the task and output a safety report; In response to triggering a risk breakpoint and detecting a high safety deviation, the termination contingency plan is matched to terminate the task and generate a termination report.
[0084] Specifically, after receiving the breakpoint event transmitted by the security breakpoint module, the guard plan dispatcher divides the degree of security deviation into four levels (no deviation, slight, moderate and high) based on the ratio of the current cumulative risk score to the cumulative risk threshold bound to the current execution stage, and matches the corresponding response plan.
[0085] When the cumulative risk score is in a lower range below the cumulative risk threshold (e.g., it can be set to 0-50% of the threshold, with the specific percentage configurable according to the actual scenario), it is considered to have no deviation. If a natural breakpoint is triggered at this point, it indicates that all steps in the current stage have been safely executed, the guard plan scheduler matches and approves the plan, allowing the task to proceed to the next execution stage without any intervention.
[0086] When the cumulative risk score rises to a low to medium range near the cumulative risk threshold (e.g., configurable to around 50%-80% of the threshold), it is considered a minor security deviation. If a risk breakpoint is triggered at this point, the guard plan scheduler matches a corrective plan, injects a correction prompt into the agent's execution engine, and then continues execution. For example, when it detects that an agent has modified code logic unrelated to the current vulnerability fix, the system injects a correction prompt: "You have modified code logic unrelated to the task. Please restore to the original state," guiding the agent to correct itself.
[0087] When the cumulative risk score approaches the upper limit of the cumulative risk threshold (e.g., it can be set to 80%-100% of the threshold), it is judged as a moderate safety deviation. At this point, the risk is close to the upper limit, and automatic correction may not be able to ensure safety. The guard plan scheduler matches the approved plan, suspends task execution, and sends a safety report containing a trajectory summary cache snapshot and a time series of cumulative risk scores to the preset manual review channel, waiting for manual feedback.
[0088] When the cumulative risk score exceeds the upper limit of the threshold (e.g., exceeding 100% of the threshold), it is judged as a high safety deviation, indicating that the risk has gotten out of control or irreversible damage has occurred. The guard plan scheduler matches the termination plan, immediately terminates the task and generates a termination report.
[0089] Furthermore, in addition to the basic contingency plans mentioned above, the guard contingency plan scheduler also supports two extended contingency plans: degradation contingency plans and rollback contingency plans. The degradation contingency plan is suitable for scenarios where the agent continuously generates moderate security deviations in the current phase, but these deviations have not yet reached an unacceptable level. When the guard contingency plan scheduler matches a degradation contingency plan, it narrows the subset of visible tools for the agent in the current phase, temporarily removing high-risk tools (such as file writing and network requests) from the visibility range, retaining only read-only or low-risk tools, allowing the agent to continue performing tasks in a restricted environment. For example, in the code modification phase of a code repair task, if the agent repeatedly attempts to modify code logic unrelated to the vulnerability, the guard contingency plan scheduler can match a degradation contingency plan, temporarily removing the visibility of file writing tools, allowing only code searching and solution design for the agent, and restoring the complete toolset after the risk score decays to a safe level. The rollback contingency plan is suitable for scenarios where the agent has already performed irreversible high-risk operations, but the system still retains a snapshot of the security state after the previous phase was completed. When the guard contingency scheduler matches a rollback contingency plan, it rolls the system state back to a safe state after the specified phase is completed, discarding all results of steps executed in the current phase, allowing the agent to restart execution from the security checkpoint. For example, during the code modification phase, if the agent deletes a critical configuration file, the guard contingency scheduler matches a rollback contingency plan, rolling back the code repository state to a snapshot after Phase 2 (remediation design) is completed, allowing the agent to restart from the first step of Phase 3. The combined use of degradation and rollback contingency plans allows for a more flexible handling strategy space. In complex attack scenarios, a single termination contingency plan might completely interrupt the task and prevent completion. However, by first executing a degradation contingency plan to reduce operational permissions, then observing the agent's behavior in the restricted environment, and further escalating to a rollback or even termination contingency plan if the risk continues to rise, this progressive handling strategy ensures security while maximizing the possibility of task completion.
[0090] Furthermore, the subsequent execution procedures differ depending on the specific contingency plan being matched. When a corrected plan is matched, the system injects a correction prompt into the agent and immediately or in the next cycle starts the next step of the current stage, allowing the agent to continue execution in the corrected state.
[0091] When the match passes the pre-defined plan, the system immediately initiates the first step of the next execution phase, achieving a smooth transition between phases.
[0092] When matching the approval plan, the system pauses task execution and waits for human feedback. After receiving feedback, the system decides whether to start the next step or terminate the task based on the results.
[0093] When the match terminates, no further stages or steps are initiated, and the task ends.
[0094] When a downgrade contingency plan is matched, the system continues to execute the next step of the current phase after reducing the visibility of the tool.
[0095] When a rollback plan is matched, the system restarts execution from the first step of the specified phase after the rollback state.
[0096] The matching of the aforementioned contingency plans not only relies on the risk score range but also incorporates cross-validation based on breakpoint type to prevent score manipulation attacks. In complex attack scenarios, attackers may use carefully crafted inputs to minimize the instantaneous risk increment at each step, thus suppressing the cumulative risk score to a low level, attempting to bypass the contingency plan when a natural breakpoint is triggered. To address this threat, the system introduces a cross-validation mechanism between breakpoint type and score range. When the security breakpoint module triggers an abnormal breakpoint, regardless of how low the current cumulative risk score is, the guard contingency plan scheduler forcibly elevates it to at least the level required to match the approved contingency plan. For example, if an unauthorized tool call triggers an abnormal breakpoint, even if the cumulative risk score is only 30% of the threshold, the system will not match the approved contingency plan but will directly match the approved contingency plan, suspend the task, and output a report for manual review. This cross-validation mechanism breaks the linear decision-making logic that relies solely on scores, effectively preventing attackers from manipulating scores to circumvent high-risk contingency plans and building a more robust defense depth.
[0097] This embodiment overcomes the limitations of existing binary decision-making systems that rely on allowing or blocking actions by finely classifying deviation levels based on cumulative risk score intervals and matching them with corresponding intervention plans of varying intensity. For minor deviations, a correction plan automatically corrects the issue, ensuring efficiency; for moderate deviations, an approval plan introduces manual intervention, balancing safety and efficiency; and for severe deviations, a termination plan decisively stops the damage, preventing irreversible harm. Furthermore, cross-validation based on breakpoint types further enhances the robustness of the protection system against complex attacks.
[0098] As a scalable implementation, the above embodiments employ contingency plan types such as pass, correction, approval, termination, downgrade, and rollback. In actual deployment, other contingency plan implementation methods can also be adopted. Model switching involves switching the large language model used by the agent from a high-performance model to a more conservative model during high-risk phases. Conservative models have stronger compliance capabilities in terms of security constraints and are suitable for scenarios where there are significant differences in model capabilities and the switching cost is controllable. Isolated execution involves continuing to execute the agent's subsequent operations in a shadow environment and observing its consequences. The shadow environment is isolated from the production environment but has the same data copy, suitable for scenarios where the consequences of operations need to be evaluated but the production environment cannot be affected. Real-time user feedback presents security deviation information to the user in real time, allowing the user to confirm whether to allow continued execution through an interactive interface. This is suitable for scenarios where the user is present and has professional judgment capabilities. The core value of the above model switching contingency plans lies in building a dynamic defense line by utilizing the differences in security compliance capabilities of different models. Although high-performance models have strong task execution capabilities, they may be induced to engage in unsafe behavior when faced with carefully crafted jailbreak prompts; while conservative models, through more rigorous security alignment training, have stronger resistance to jailbreak attacks. By automatically switching to a conservative model during high-risk phases, the system reduces the risk of the agent being manipulated by attackers without terminating the task. Once the risk score decreases, it switches back to the high-performance model to resume full-speed execution. This "capability degradation rather than task termination" approach ensures security while maximizing task continuity and completion rate.
[0099] In some embodiments, during the phased advancement of long-term tasks, the action description, input parameters, output results, and tool call information of the current step are updated to the trajectory summary cache; when the cumulative risk score meets the preset triggering conditions, the context information of the current execution stage is extracted from the trajectory summary cache to support the decision-making of the graded disposal strategy.
[0100] Specifically, the risk monitoring module maintains a trajectory summary cache internally. During the step-by-step execution of tasks by the agent's execution engine, after each step is completed, the risk monitoring module appends the key execution data of that step to the trajectory summary cache in a structured manner. This key execution data includes the action description, input parameters, output results, and tool call information for the current step. It should be understood that the trajectory summary cache does not store the complete raw log of the agent's operation; instead, it extracts and compresses it using a compact structured format. For example, for a code search output of several thousand characters, the cache only retains the matched file path, function name, and a summary of key code snippets, rather than the complete file content. This compact structured format effectively avoids the memory bloat caused by storing complete logs during long-term task execution, ensuring the system's operational stability when handling extremely long-duration tasks.
[0101] When the accumulated risk score meets the preset trigger conditions and triggers a security breakpoint, the guard plan scheduler extracts the context information of the current execution stage from the trajectory summary cache before formulating a tiered response strategy. Since the trajectory summary cache maintains a complete summary of the executed operation sequence, the extracted context information provides a global perspective for the tiered response strategy. For example, when a risk breakpoint is triggered and a moderate security deviation is detected, the guard plan scheduler matches the approval plan. At this time, the system extracts the action descriptions and tool call information of all steps executed in the current stage from the trajectory summary cache, generating a structured security report. After receiving this report, the manual review channel can not only see the local information of the current step that triggered the breakpoint, but also trace back the operation trajectory of the preceding steps within the current stage, thereby more accurately judging the source and intent of the risk and making a more reasonable approval decision. Without this global context awareness capability, the tiered response strategy can only make judgments based on isolated current actions, which is highly prone to misjudgment.
[0102] Furthermore, the trajectory summary cache not only supports real-time tiered handling decisions but also serves as a data source for execution witness records. During or after task execution, the witness record module continuously writes security-related events into the execution witness record. The execution witness record is organized using a hash chain structure, with each record block containing the hash value of the previous block, the event data of the current block, and a timestamp, forming an immutable chain of evidence. Specifically, each record block contains the following fields: A phase identifier, used to mark the execution phase to which the event belongs; Action summary and its hash value are used to record summary information of the agent's action that triggered the event and ensure its integrity; Cumulative risk score snapshot, used to record the cumulative risk score value at the time the event occurs; Event types include natural breakpoints, risk breakpoints, abnormal breakpoints, and completion; handling records are used to record the handling plans and results executed by the guard plan dispatcher; The predecessor hash, which is the hash value of the previous record block, is used to maintain the integrity of the chain structure. A timestamp is used to mark the precise time when an event occurred.
[0103] Upon completion of the task, the witnessing record module outputs a complete execution witnessing record for security auditing, root cause analysis, and liability determination. Since the trajectory summary cache has already undergone structured extraction and compression, it is directly used as the data source for the witnessing record, avoiding the computational overhead of secondary processing of massive amounts of raw logs when generating an immutable chain of evidence, significantly improving the efficiency of audit tracing. This embodiment, by introducing a trajectory summary cache, breaks down the data barriers between the execution layer, decision-making layer, and audit layer, providing a solid contextual data foundation for the entire security protection system. The immutability of the aforementioned hash chain structure provides provable capability for agent security protection. In liability determination scenarios, auditors can verify the integrity of the execution witnessing record block by block: by recalculating the hash value of each record block and comparing it with the predecessor hash stored in the next block, any tampering with the historical record will result in a hash mismatch and be immediately detected. This design gives the agent's execution process judicial-level traceability, providing compliance assurance for the deployment of AI agents in high-risk scenarios.
[0104] like Figure 4 As shown, this embodiment provides a security protection device for long-term intelligent agent tasks. The device includes: an intent parsing unit 410, a phase division unit 420, a risk monitoring unit 430, a security breakpoint unit 440, and a guard plan scheduler 450.
[0105] The intent parsing unit 410 is used to parse the task intent of a long-range task and generate a task intent profile containing security boundary information. The intent parsing unit corresponds to... Figure 1 The intent parsing module receives long-range task requests from users or upstream systems, performs structured semantic analysis on the task description, and outputs a task intent profile. The task intent profile includes elements such as intent type, security boundaries, a list of permitted tools, a list of restricted resources, and expected output specifications. The intent parsing unit outputs the task intent profile to the phase division unit, which serves as a security benchmark for the entire security protection system.
[0106] The phase division unit 420 is used to divide a long-running task into multiple execution phases based on the task intent profile, and to bind a corresponding phase security policy to each execution phase. The phase division unit corresponds to... Figure 1 The phase management module identifies nodes where security risk attributes change, based on the security risk characteristics represented by the task intent profile, as phase boundaries. It automatically divides long-term tasks into multiple independently verifiable execution phases and independently configures and binds a dedicated phase security policy to each phase. The phase division unit outputs the phase division policy to the risk monitoring unit and the guard plan scheduler for subsequent risk calculation and plan matching.
[0107] The risk monitoring unit 430 is used to dynamically update the cumulative risk score based on historical accumulated risk and the instantaneous risk increment of the current executed step during the phase-by-phase advancement of a long-term task. The risk monitoring unit corresponds to... Figure 1 The risk monitoring module internally maintains a trajectory summary cache. During the step-by-step execution of tasks by the agent's execution engine, the risk monitoring unit acquires the instantaneous risk increment of the current step, combines it with the historical accumulated risk of the previous step, and uses the attenuation factor bound to the current execution stage for attenuation and superposition processing to dynamically calculate and update the current accumulated risk score. The risk monitoring unit outputs the accumulated risk score to the safety breakpoint unit in real time for triggering conditional judgments.
[0108] The safety breakpoint unit 440 is used to trigger a safety breakpoint and initiate a tiered response strategy when the accumulated risk score meets preset trigger conditions. The safety breakpoint unit corresponds to... Figure 1 The safety breakpoint module continuously monitors the accumulated risk score and related status. When the accumulated risk score meets the triggering conditions for a natural breakpoint, a risk breakpoint, or an abnormal breakpoint, the safety breakpoint unit triggers a safety breakpoint, extracts the context information of the current execution phase from the trajectory summary cache, and passes the breakpoint event and context information to the guard plan scheduler.
[0109] The guard plan dispatcher 450 is used to respond to security breakpoints and execute corresponding tiered response strategies. The guard plan dispatcher corresponds to... Figure 1 The guard plan scheduler matches and executes corresponding tiered response plans based on the breakpoint type and the current accumulated risk level, such as approval plans, revised plans, and termination plans. When executing a revised plan, the guard plan scheduler injects a correction prompt into the agent's execution engine through a feedback path; when executing an approval or termination plan, the guard plan scheduler outputs the response record to the witness record module, achieving end-to-end traceability.
[0110] The data flow between the aforementioned units forms a complete closed loop of detection, suspension, assessment, and handling. The security benchmark output by the intent parsing unit is passed down to the phase division unit and the risk monitoring unit, ensuring the consistency of risk detection benchmarks; the dynamic score output by the risk monitoring unit is passed horizontally to the security breakpoint unit, realizing real-time risk perception and triggering; the vertical linkage between the security breakpoint unit and the guard plan scheduler ensures timely tiered intervention before risk spreads. This modular structural design decouples the functional units, facilitating independent upgrades and maintenance, while providing solid physical structural support for the cross-step cumulative security deviation detection and tiered handling described in the method embodiment.
[0111] Based on the above embodiments, see Figure 5 The diagram shown is a structural schematic of the electronic device in an embodiment of this application.
[0112] This application provides an electronic device that may include a processor 510 (Central Processing Unit, CPU), a memory 520, an input device 530, and an output device 540. The input device 530 may include a keyboard, a mouse, a touch screen, etc., and the output device 540 may include a display device, such as a liquid crystal display (LCD) or a cathode ray tube (CRT).
[0113] The memory 520 may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor 510 with program instructions and data stored in the memory 520. In this embodiment, the memory 520 may be used to store the program of any of the security protection methods for long-range intelligent agent tasks in this embodiment.
[0114] The processor 510 calls the program instructions stored in the memory 520, and the processor 510 is used to execute any of the security protection methods for long-range intelligent agent tasks in the embodiments of this application according to the obtained program instructions.
[0115] Based on the above embodiments, this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the security protection method for long-range intelligent agent tasks in any of the above method embodiments.
[0116] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0117] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0120] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A security protection method for long-range tasks of intelligent agents, characterized in that, The method includes: Analyze the mission intent of long-term tasks and generate a mission intent profile that includes security boundary information; Based on the task intent profile, the long-term task is divided into multiple execution phases, and a corresponding phase security policy is bound to each execution phase. During the process of advancing the long-term task in each execution phase, the cumulative risk score is dynamically updated based on the historical accumulated risk and the instantaneous risk increment of the current executed step; When the cumulative risk score meets the preset triggering conditions, the corresponding graded handling strategy is initiated and executed.
2. The method as described in claim 1, characterized in that, Based on the task intent profile, the long-term task is divided into multiple execution phases, and a corresponding phase security policy is bound to each execution phase, including: Based on the security risk characteristics represented by the task intent profile, nodes where security risk attributes change are identified as stage boundaries. Based on the identified stage boundaries, the long-term task is divided into multiple execution stages, and each execution stage is independently configured and bound with a dedicated stage security policy.
3. The method as described in claim 1, characterized in that, The phased security strategy includes at least a cumulative risk threshold and a decay factor; The cumulative risk threshold is used to limit the upper limit of the cumulative risk score for the corresponding execution stage; The attenuation factor is used to control the degree of impact of historical accumulated risks and is configured differently according to the security risk characteristics of the execution phase.
4. The method as described in claim 3, characterized in that, The cumulative risk score is dynamically updated based on historical accumulated risk and the instantaneous risk increment of the current steps already performed, including: Obtain the historical cumulative risk of the previous step in the current step; Based on the attenuation factor bound to the current execution stage to which the current step belongs, the historical accumulated risk is attenuated to obtain the attenuated risk value. The attenuated risk value is superimposed with the instantaneous risk increment of the current step to generate an updated cumulative risk score.
5. The method as described in claim 4, characterized in that, The instantaneous risk increment for the current step is determined in the following way: Based on the security boundary information defined in the task intent profile, the deviation score of the current step is evaluated from the dimensions of tool usage compliance, resource access compliance, behavior boundary compliance, and content security compliance. The deviation scores of each dimension are weighted and summed to obtain the instantaneous risk increment of the current step.
6. The method as described in claim 3, characterized in that, The preset triggering conditions include natural breakpoints, risky breakpoints, and abnormal breakpoints; When the current step reaches the stage boundary of its execution stage, the natural breakpoint is triggered; When the cumulative risk score exceeds the risk threshold of the corresponding execution stage, the risk breakpoint is triggered; The exception breakpoint is triggered when unauthorized tool calls, restricted resource access, or unclassifiable abnormal operations are detected.
7. The method as described in claim 6, characterized in that, Initiate and execute the corresponding tiered response strategy, including: In response to triggering the natural breakpoint and the cumulative risk score being lower than the cumulative risk threshold for the current stage, a contingency plan is matched to allow entry into the next execution stage of the current stage; In response to triggering the risk breakpoint and detecting a slight safety deviation, a correction plan is matched to inject a correction prompt into the agent before execution continues; In response to triggering the aforementioned risk breakpoint and detecting a moderate security deviation, the approved contingency plan is matched to suspend the task and output a security report; In response to triggering the risk breakpoint and detecting a high safety deviation, the termination contingency plan is matched to terminate the task and generate a termination report.
8. The method as described in claim 1, characterized in that, The method further includes: During the phased advancement of the long-term task, the action description, input parameters, output results, and tool call information of the current step are updated to the trajectory summary cache. When the cumulative risk score meets the preset triggering conditions, the context information of the current execution stage is extracted from the trajectory summary cache to support the decision-making of the hierarchical disposal strategy.
9. A safety protection device for long-range intelligent agent tasks, characterized in that, The device includes: The intent parsing unit is used to parse the task intent of long-term tasks and generate a task intent profile that includes security boundary information. A phase division unit is used to divide the long-term task into multiple execution phases based on the task intent profile, and bind a corresponding phase security policy to each execution phase. The risk monitoring unit is used to dynamically update the cumulative risk score based on historical accumulated risk and the instantaneous risk increment of the current step that has been executed, during the process of advancing the long-term task in each execution stage. The safety breakpoint unit is used to trigger a safety breakpoint and start a graded handling strategy when the accumulated risk score meets the preset triggering conditions. The guard plan dispatcher is used to respond to the security breakpoint and execute the corresponding graded handling strategy.
10. An electronic device, characterized in that, include: At least one memory for storing program instructions; At least one processor is configured to invoke program instructions stored in the memory and execute the steps of the security protection method for long-range intelligent agent tasks as described in any one of claims 1-8, according to the obtained program instructions.
