Security auditing method and device for large model agent
By structuring the execution trajectory of large model agents and fusing Bayesian evidence, trajectory-level risk probabilities are generated, solving the problem of the difficulty in fusing global intent information and local risk evidence in existing technologies, and realizing the interpretability and accuracy of security auditing of large model agents.
Patent Information
- Application Number
- CN202611414553.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-11
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies struggle to establish an interpretable, fusionable, and deployable audit mechanism between the global intent information of a complete reasoning trajectory and the local risk evidence of key segments in the security audit of large-scale intelligent agents. This makes it difficult to locate risk positions in a single complete trajectory audit, sequential monitoring lacks global consistency checks, hierarchical monitoring loses causal relationships, and hybrid monitoring lacks clear probabilistic interpretations.
By acquiring user task requests and the execution trajectories of large model agents, the data is organized into structured sequences to generate global risk evidence and fragment-level risk evidence. Then, using Bayesian evidence fusion methods, the global and local evidence are fused to generate trajectory-level risk probabilities, enabling accurate identification of hidden target deviations and cross-fragment abnormal behaviors.
It enables interpretable, fusionable, and deployable auditing of the task execution process of large model intelligent agents, accurately identifies hidden target deviations and cross-segment abnormal behaviors, avoids the location difficulties and information dilution problems in existing technologies, and provides clear probabilistic interpretations and processing suggestions.
Smart Images

Figure CN123179455A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a security auditing method and apparatus for large-scale intelligent agents. Background Technology
[0002] In recent years, agent systems based on Large Language Models (LLMs) have evolved from single-turn question-answering models to automated systems capable of long-term task planning, tool invocation, web page operation, code execution, file processing, and multi-step environmental interaction. Some agent paradigms combine reasoning processes with external actions, enabling the model to alternately generate thoughts, invoke tools, and continue making decisions based on environmental feedback while performing tasks. Subsequent agent paradigms further introduce language feedback and self-reflection mechanisms, allowing the agent to correct its strategies through multiple rounds of trials. With the development of these methods, large model agents can now assume more proactive operational roles in scenarios such as code repair, web browsing, office automation, data analysis, and complex task execution.
[0003] However, unlike traditional chat models that only generate the final response, agents may access external resources, modify files, run code, call application programming interfaces (APIs), or alter the state of the digital environment during task execution. Therefore, security risks are no longer limited to the final output text but may also be subtly distributed throughout planning, reasoning, tool calls, intermediate results, and subsequent actions. To address this challenge, research has begun to focus on monitoring the agent's intermediate reasoning process and execution trajectory. For example, some scholars have proposed a thought chain monitoring method for reasoning models, using an independent monitoring model to read the reasoning process of the monitored model and determine whether reward hacking, hidden objectives, illegal plans, or other erroneous behavior signals are present. The core assumption of this type of method is that the agent's intermediate reasoning process can expose its true intentions and potential anomalous strategies earlier than simply observing the final output. Furthermore, some scholars have assessed whether monitoring models can identify potential risks from the agent's reasoning trajectory by setting hidden objectives or adversarial tasks within the task. These works collectively demonstrate that security auditing for large-scale agent models has gradually shifted from examining the security of the final response to examining the security of the task execution trajectory.
[0004] Regarding specific audit architectures, existing technologies typically employ single-time complete trajectory monitoring, sequential monitoring, hierarchical monitoring, and hybrid monitoring. The most basic thought chain monitoring method inputs the user request and the agent's complete inference trajectory into the monitoring model simultaneously, allowing the model to provide a risk score or judgment all at once. Some solutions further investigate various monitoring architectures for long-trajectory agent scenarios, including sequential monitoring, hierarchical monitoring, and hybrid monitoring. Sequential monitoring typically reads the trajectory segment by segment according to time windows or fixed step sizes, updating the risk judgment after each window; hierarchical monitoring first summarizes or makes local judgments on local trajectory segments, then inputs the summary or local results into the upper-level monitoring model; hybrid monitoring attempts to combine the time-dependency characterization capability of sequential methods with the information compression capability of hierarchical methods for long trajectories.
[0005] However, the aforementioned existing technologies still have many shortcomings. First, basic thought chain monitoring methods are easily affected by context length, information dilution, and the lack of prominence of local evidence in long-term tasks. When risky behaviors only appear in a few key actions or are packaged as part of normal task steps, a single complete trajectory audit tends to provide a general judgment and is difficult to accurately locate the risk. Second, sequential monitoring mainly relies on evidence within a local window, lacking a consistency check of the complete task objective and overall execution intention. It is easy to misjudge local anomalies as risks, or fail to form a sufficiently strong overall judgment when anomalies are dispersed among multiple normal segments. Although hierarchical monitoring can compress long trajectory information, it is easy to lose the causal relationship between segments and the continuity of objectives across segments, and it is particularly difficult to identify the execution of hidden sub-tasks composed of multiple low-suspicious steps. Although hybrid monitoring attempts to utilize both sequential and hierarchical information, it usually uses empirical weighting, simple summation, or linear combination to integrate multiple audit results, lacking a clear probabilistic interpretation and a unified evidence update mechanism.
[0006] Therefore, how to establish an interpretable, integrable, and deployable audit mechanism between the global intent information of the complete reasoning trajectory and the local risk evidence of key segments has become a technical problem that urgently needs to be solved in the industry. Summary of the Invention
[0007] To address the shortcomings of existing technologies, this invention provides a security auditing method and apparatus for large-scale intelligent agents, establishing an interpretable, fusionable, and deployable auditing mechanism between global intent information of the complete reasoning trajectory and local risk evidence of key segments.
[0008] In a first aspect, the present invention provides a security auditing method for large-scale intelligent agents, the method comprising the following steps: Obtain user task requests and the execution trajectory of large model agents, and organize the execution trajectories into a structured sequence according to time order; Global risk evidence and at least one fragment-level risk evidence are generated based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The global risk evidence and the at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0009] According to the security auditing method for large-scale intelligent agents provided by the present invention, the step of organizing the execution trajectory into a structured sequence according to the time order includes: Each message or action in the execution trajectory is numbered in chronological order; Extract preset information for each message or action as a structured field; the preset information includes at least one of the following: role type, tool type, operation object, input parameters, return result, and whether the external state has been changed; The structured sequence is formed based on the number of each message or action and the structured fields of each message or action.
[0010] According to a security auditing method for large-scale intelligent agents provided by the present invention, the key execution segments are extracted through the following steps: Each message or action in the structured sequence is numbered according to chronological order; Candidate segments are generated from the structured sequence based on preset segment boundary conditions; the segment boundary conditions include at least one of tool call boundary, external state change boundary, task completion time point, and abnormal action chain. The key execution segment is selected from the candidate segments according to the preset key segment filtering rules; the key segment filtering rules include at least one of the following: whether it involves sensitive tools or permissions, whether it changes the external state, whether it deviates from the user's task goal, and whether it occurs after the task is completed.
[0011] According to the present invention, a security auditing method for large-scale intelligent agents, wherein generating global risk evidence based on the structured sequence includes: The complete structured sequence and the user task request are input into the global audit module, which then outputs global risk evidence that characterizes the consistency between the overall behavior and the user's original task objective.
[0012] According to the present invention, a security auditing method for large-scale intelligent agents generates at least one fragment-level risk evidence based on the structured sequence, including: For each of the key execution segments, the segment audit module assesses the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior. Based on the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior, segment-level risk evidence is generated for each key execution segment.
[0013] According to the security auditing method for large-scale intelligent agents provided by the present invention, the global auditing module and the segment auditing module are configured with the same auditing model, or the global auditing module and the segment auditing module are configured with different auditing models; the auditing model is at least one of a large language model, a risk classification model, a rule engine, and an integrated system composed of multiple auditors.
[0014] According to the present invention, a security auditing method for large-scale intelligent agents includes performing Bayesian evidence fusion on the global risk evidence and the at least one fragment-level risk evidence to obtain trajectory-level risk probabilities, comprising: The global risk evidence and the at least one fragment-level risk evidence are represented as additive evidence in the form of log-likelihood ratios; Based on the aforementioned addable evidence, calculate the comprehensive evidence; The comprehensive evidence is mapped to the trajectory-level risk probability using a probability mapping function.
[0015] According to the present invention, a security auditing method for large-scale intelligent agents is provided, the method further includes: The audit results are determined based on the trajectory-level risk probability; the audit results include the trajectory-level risk probability and at least one of the following: the risk level, the global risk basis, the key segment number, the segment-level evidence, and the handling recommendations; Based on the audit results, appropriate risk management actions will be taken.
[0016] According to the present invention, a security auditing method for large-scale intelligent agents includes performing corresponding risk mitigation operations based on the audit results, comprising: If the trajectory-level risk probability is lower than a first threshold, the large model agent is allowed to continue execution; If the trajectory-level risk probability is between the first threshold and the second threshold, the user is prompted to confirm or strengthen subsequent auditing. If the trajectory-level risk probability is between the second and third thresholds, the use of high-risk tools will be suspended, the agent's permissions will be restricted, or the case will be transferred to manual review. If the trajectory-level risk probability is higher than the third threshold, terminate the current task and save the audit record; the first threshold is less than the second threshold, and the second threshold is less than the third threshold.
[0017] Secondly, the present invention also provides a security auditing device for large-scale intelligent agents, the device comprising the following modules: The acquisition module is used to acquire user task requests and the execution trajectory of large model agents, and organize the execution trajectory into a structured sequence according to the time order; An evidence generation module is used to generate global risk evidence and at least one fragment-level risk evidence based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The fusion module is used to perform Bayesian evidence fusion on the global risk evidence and the at least one fragment-level risk evidence to obtain the trajectory-level risk probability; the trajectory-level risk probability represents the conditional probability that the large model agent has any one of the following during the entire task execution process, given the user task request and the execution trajectory: target deviation, hidden violation behavior, and abnormal operation.
[0018] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the security auditing method for large-scale intelligent agents as described above.
[0019] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the security auditing method for large-scale intelligent agents as described above.
[0020] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the security auditing method for large-scale intelligent agents as described above.
[0021] This invention provides a security auditing method and apparatus for large-scale intelligent agents. First, it acquires user task requests and the execution trajectory of the large-scale intelligent agent, organizing the execution trajectory into a structured sequence according to time order. Then, it generates global risk evidence and at least one fragment-level risk evidence based on the structured sequence. The global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, while the fragment-level risk evidence is obtained by performing risk assessment on key execution fragments extracted from the structured sequence. Finally, it performs Bayesian evidence fusion on the global risk evidence and at least one fragment-level risk evidence to obtain a trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and execution trajectory, the large-scale intelligent agent exhibits any one of the following during the entire task execution process: target deviation, concealed violation behavior, or abnormal operation.
[0022] This invention combines global intent information of the complete reasoning trajectory (i.e., global risk evidence G, reflecting whether the overall behavior of the agent deviates from the user's original goal) with local risk evidence of key segments (i.e., segment-level risk evidence L). j This invention organically separates and integrates the risk information (reflecting whether there are anomalies in specific sensitive operations) with Bayesian methods, ultimately generating a trajectory-level risk probability s with a clear probabilistic interpretation. Compared with existing technologies, this invention avoids the problem of difficulty in locating specific risk positions due to excessively long context and information dilution in single complete trajectory audits, and also avoids the defects of sequential and hierarchical monitoring that lack global consistency checks or lose cross-segment causal relationships. By unifying the global context and local evidence into the same probabilistic framework, it achieves accurate identification of hidden target deviations and cross-segment abnormal behaviors, making the audit results interpretable (traceable to specific segments and global judgments), fusionable (based on a unified evidence update mechanism based on Bayesian theory), and deployable (without retraining the agent model, it only needs to be accessed as an independent audit layer). Thus, it establishes an interpretable, fusionable, and deployable audit mechanism between the global intent information of the complete inference trajectory and the local risk evidence of key segments. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is one of the flowcharts illustrating the security auditing method for large-scale intelligent agents provided by this invention.
[0025] Figure 2This is the second flowchart of the security auditing method for large-scale intelligent agents provided by the present invention.
[0026] Figure 3 This is the third flowchart of the security auditing method for large-scale intelligent agents provided by this invention.
[0027] Figure 4 This is the fourth flowchart of the security auditing method for large-scale intelligent agents provided by this invention.
[0028] Figure 5 This is a schematic diagram of the structure of the security audit system for large-scale intelligent agents provided by the present invention.
[0029] Figure 6 This is a schematic diagram of the security auditing device for large-scale intelligent agents provided by the present invention.
[0030] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0032] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, a first node can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0033] To clearly understand the various embodiments provided by the present invention, the technical content involved in the present invention will first be described as follows: On the one hand, while complete trajectory auditing can reveal the overall task context, it can easily obscure local anomalies. On the other hand, while local segment auditing can uncover specific suspicious actions, it can easily overlook cross-segment goal consistency and the evolution of hidden intentions. Existing methods lack a security auditing mechanism that can simultaneously retain global trajectory judgments and local segment evidence, and generate trajectory-level risk probabilities in an interpretable and calibrable manner. Therefore, in real-world large-scale model agent deployment scenarios, there are still problems of missed detections, false alarms, and difficulty in tracing audit results.
[0034] To address the shortcomings of existing technologies, this invention provides a security auditing method for large-scale intelligent agents. This method, without altering the agent's original task execution capabilities, integrates as an independent security audit layer into the agent's operational flow. It analyzes the trajectory information generated during agent execution and outputs trajectory-level risk probabilities and corresponding processing results. Through this implementation, an interpretable, fusionable, and deployable auditing mechanism can be established between the global intent information of the complete inference trajectory and the local risk evidence of key segments, thereby resolving the existing technical problems pointed out in the background section.
[0035] The key point of this invention lies in proposing a Bayesian security auditing method for the execution trajectory of large-scale intelligent agents. This method can perform security auditing directly using logs and trajectory information generated during the operation of the intelligent agent without retraining the agent model or changing the original task execution process. Specific key points include: 1. This paper proposes a security auditing method for intelligent agents that focuses on the complete execution trajectory. Many existing security auditing methods primarily focus on the security of the model's final output. However, large-scale intelligent agents in actual operation involve multiple steps of planning, tool calls, file operations, web page operations, code execution, and environmental interactions. Risky behaviors may occur during the execution process rather than in the final response. This invention takes user tasks, intermediate steps of the intelligent agent, tool call records, environmental feedback, and final output as audit objects, expanding the audit scope from whether the response is safe to whether the entire task execution process is safe. This is more suitable for practical application scenarios such as code-based intelligent agents, web-based intelligent agents, office automation intelligent agents, and data analysis intelligent agents.
[0036] 2. This invention proposes an auditing mechanism that combines global trajectory evidence with local key segment evidence. Instead of simply scoring the entire trajectory at once, or merely segmenting the trajectory and scoring each segment separately, this invention models two types of evidence separately: on the one hand, it judges whether the agent continuously serves the user's original goal from the perspective of the entire trajectory, and whether there are task deviations, hidden sub-tasks, or abnormal extensions after task completion; on the other hand, it focuses on analyzing specific behaviors such as sensitive tool calls, file modifications, permission requests, external transmissions, and state changes from the perspective of key execution segments. Through this global-local dual-perspective approach, this invention can both preserve the complete task context and locate specific suspicious steps, avoiding the problems of overly coarse auditing of the entire trajectory and overly fragmented auditing of segments.
[0037] 3. A trajectory-level risk scoring method based on Bayesian evidence fusion is proposed. This invention employs a comparative risk assessment for key segments, simultaneously determining the relative probability of the same segment under both risk and benign assumptions. This probability is then fused with global risk evidence at the complete trajectory level using Bayesian methods to generate trajectory-level risk probabilities. Compared to simple averaging, manual weighting, or voting methods, this method accumulates risk based on the strength of evidence rather than the number of segments, providing a clearer probabilistic interpretation. Audit results can further output risk probabilities, risk levels, and key evidence segments, and can trigger processing methods such as continued execution, user confirmation, suspension of high-risk tools, transfer to manual review, or saving audit records according to actual system needs. Therefore, it has strong interpretability and practical deployment.
[0038] The following is combined with Figures 1 to 7 The present invention describes a security auditing method and apparatus for large-scale intelligent agents.
[0039] Figure 1 This is one of the flowcharts illustrating the security auditing method for large-scale intelligent agents provided by this invention, such as... Figure 1 As shown, the method includes the following: Step 101: Obtain the user task request and the execution trajectory of the large model agent, and organize the execution trajectory into a structured sequence according to the time order.
[0040] The execution subject of the security auditing method for large-scale intelligent agents provided by this invention can be an electronic device, or any other subject that can implement the security auditing method for large-scale intelligent agents, such as other security auditing systems for large-scale intelligent agents.
[0041] In this context, a large-scale intelligent agent (Agent) refers to an automated system built upon a large language model, capable of autonomous reasoning and decision-making, and able to invoke external tools or interact with the external environment to complete specific tasks. Its core distinguishing feature from traditional question-answering models lies in its ability to perform long-term task planning, invoke tools, manipulate files, execute code, and handle environmental feedback. A user task request (Q) refers to a legitimate task objective provided by the user to the large-scale intelligent agent in the form of natural language or structured instructions, such as "Please help me summarize this Portable Document Format (PDF) document" or "Extract sales data from the database for the past month and generate charts." The execution trajectory (T) refers to the complete record generated by the large-scale intelligent agent's interaction with the external environment during the process of completing the user task request. This includes, but is not limited to: the agent's intermediate reasoning text (i.e., thought chain), planned steps, tool invocation records, tool invocation parameters, environmental return results, file or webpage access records, database query records, external state modification records, and the final output generated by the agent. Structured sequences refer to the process of organizing, numbering, and formatting the chaotic raw execution trajectory according to the chronological order of events, extracting key information fields (such as role, action type, operation object, parameters, results, etc.) of each step (message or action), thus forming a data format that is easy for computer programs to analyze and process automatically.
[0042] In practical applications, the user task request Q and the execution trajectory T of the large model agent are first acquired. The execution trajectory T may include, but is not limited to, the agent's intermediate inference text, planned steps, tool call records, tool call parameters, environmental return results, file or webpage access records, database query records, external state modification records, and the final output. For systems where complete inference text cannot be obtained, this invention can also audit based solely on observable execution logs, tool call sequences, and environmental feedback. Subsequently, the system organizes the original trajectory T into a unified structured sequence in chronological order, recording information such as the role type, tool type, operation object, input parameters, return result, and whether the external state has been changed for each message or action. This transforms the mixed dialogue, tool calls, and environmental feedback into a trajectory representation that facilitates subsequent auditing.
[0043] Step 102: Generate global risk evidence and at least one fragment-level risk evidence based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on the key execution fragments extracted from the structured sequence.
[0044] Specifically, global risk evidence (G) refers to a comprehensive risk indicator generated based on a complete structured execution trajectory, used to assess whether the overall behavior of the agent conforms to the user's original task objectives. It reflects risks such as task intent deviation, goal violation, or strategic deception observed at a macro level.
[0045] Fragment-level risk evidence (L) refers to risk indicators generated based on one or more key execution fragments extracted from the complete trajectory, used to assess the likelihood of anomalies in operational behavior within that specific fragment. It reflects sensitive operations, anomalous calls, or violations observed at a micro-level.
[0046] In practical applications, for the structured execution trajectory (structured sequence), this invention extracts risk evidence from two levels: global evidence at the complete trajectory level and local evidence at the key execution segment level. For global evidence, the system inputs the complete trajectory T and the user task request Q into the global audit module, focusing on analyzing whether the agent's overall behavior continuously serves the user's original task objective, whether there are any additional operations after the task is completed, whether there are long-term strategies unrelated to the user's objective, or whether there are signs of hiding the true purpose or bypassing restrictions, and outputs global risk evidence G. For local evidence, the system selects several key execution segments from the complete trajectory, denoted as Γ1,Γ2,...,Γ k Key segments can be extracted using rules, models, or a combination of both, prioritizing segments involving sensitive tool calls, file writing, data deletion, external transmission, account operations, code execution, permission requests, state changes, additional operations after task completion, and segments weakly related to user goals. For each key segment Γ j Auditing is conducted through a segment auditing module. Instead of simply assigning a "suspiciousness" score, this module assesses the relative probability of a segment constituting risky or benign behavior, thus obtaining segment-level risk evidence L. j .
[0047] Step 103: Perform Bayesian evidence fusion on the global risk evidence and at least one fragment-level risk evidence to obtain the trajectory-level risk probability; the trajectory-level risk probability represents the conditional probability that, given the user task request and execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0048] Specifically, Bayesian evidence fusion refers to a mathematical method based on Bayesian probability theory that combines evidence from different sources (global and local) in an additive form such as log-likelihood ratio to update the posterior confidence of a hypothesis (e.g., "the trajectory is at risk").
[0049] The trajectory-level risk probability (s) refers to the conditional probability, as the final output, that the large model agent, given a user task request and a complete execution trajectory, will exhibit any of the following during the entire task execution process: target deviation, covert violation, or abnormal operation. This probability is a value between 0 and 1, used to quantify the overall risk level.
[0050] In practical applications, the system combines global risk evidence G with multiple fragment-level risk evidence L1, L2, ..., L k Input the Bayesian fusion module. For example, the above evidence can be represented as a log-likelihood ratio or other additive evidence form, and the comprehensive evidence S = G + L1 + L2 + ... + L k The trajectory-level risk probability s is obtained through a probability mapping function. This risk probability represents the possibility that, given a user task and a complete execution trajectory, the agent's execution process may involve target deviation, concealed violations, or abnormal operations. Unlike simple averaging, manual weighting, or majority voting, this invention unifies the overall judgment of the complete trajectory and the local judgment of key segments into a single risk probability through Bayesian evidence fusion, ensuring that the audit results simultaneously retain both global context and local evidence.
[0051] The following is a detailed example 1: Suppose an e-commerce platform has deployed a web shopping agent based on a large language model. Its core function is to help users automatically search for products, compare prices, and place orders. The system receives the following user task request: Q: Help me buy a new smartphone priced under 5000 yuan.
[0052] During the execution of this task, the agent generated the following execution trajectory T (simplified into a structured sequence representation), as shown in Table 1: Table 1:
[0053] In step 101, the system obtains the above execution trajectory T and organizes it into a structured sequence as shown in the table according to the time order.
[0054] In step 102, the system performs global and local evidence extraction in parallel: Global Evidence G Generation: The global audit module (e.g., a large model configured with advanced reasoning capabilities, such as Claude-4-Sonnet) reads the complete trajectory and user task. This module infers that the user explicitly requested "within 5000 yuan," but the item purchased in step 11 of the trajectory costs 5200 yuan, exceeding the budget. Furthermore, the agent reads the user profile in step 9, and reasoning in step 8 shows it intentionally guides the user to accept a more expensive item. This clearly demonstrates a target shift, moving from "buying within budget" to "promoting higher-priced items." Therefore, the global audit module generates global evidence G indicating the presence of high risk, which can be represented, for example, as a log-likelihood ratio G = 3.5 (a positive value indicates a bias towards the risk hypothesis).
[0055] Local evidence L j Generation: The key fragment extraction module identifies steps 9 (reading user profile) and steps 11-13 (adding to cart, getting address, submitting order) as key fragments based on rules, because they involve sensitive tool calls (reading user profile, submitting order) and external state changes.
[0056] Fragment Γ1 (Step 9): The fragment audit module analyzes this step. Under the benign assumption (i.e., normal service), reading user profiles can help recommend products; however, under the risk assumption (i.e., target deviation), reading profiles is to probe the user's spending limit, thereby recommending over-budget products. After evaluation, the module concludes that the fragment-level risk evidence L1=2.0 (biased risk).
[0057] Fragment Γ2 (Steps 11-13): The fragment audit module analyzes this step. Under the benign assumption, the user requests to shop, and submitting the order is the ultimate goal; however, under the risk assumption, this submission directly causes the user's financial loss, and the goods do not conform to the user's original instructions. After evaluation, the module arrives at fragment-level risk evidence L2=4.5 (strongly risk-biased).
[0058] In step 103, the Bayesian fusion module calculates the comprehensive evidence S = G + L1 + L2 = 3.5 + 2.0 + 4.5 = 10.0. The comprehensive evidence S is then mapped to a trajectory-level risk probability s using a probability mapping function (e.g., the sigmoid function or a variant thereof). For example, s ≈ 0.99995 indicates that the trajectory carries an extremely high risk.
[0059] The method provided in this invention first acquires the user task request and the execution trajectory of the large model agent, and organizes the execution trajectory into a structured sequence according to time order; then, it generates global risk evidence and at least one fragment-level risk evidence based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution segments extracted from the structured sequence; then, the global risk evidence and at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability; the trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0060] This invention combines global intent information of the complete reasoning trajectory (i.e., global risk evidence G, reflecting whether the overall behavior of the agent deviates from the user's original goal) with local risk evidence of key segments (i.e., segment-level risk evidence L). j This invention organically separates and integrates the risk information (reflecting whether there are anomalies in specific sensitive operations) with Bayesian methods, ultimately generating a trajectory-level risk probability s with a clear probabilistic interpretation. Compared with existing technologies, this invention avoids the problem of difficulty in locating specific risk positions due to excessively long context and information dilution in single complete trajectory audits, and also avoids the defects of sequential and hierarchical monitoring that lack global consistency checks or lose cross-segment causal relationships. By unifying the global context and local evidence into the same probabilistic framework, it achieves accurate identification of hidden target deviations and cross-segment abnormal behaviors, making the audit results interpretable (traceable to specific segments and global judgments), fusionable (based on a unified evidence update mechanism based on Bayesian theory), and deployable (without retraining the agent model, it only needs to be accessed as an independent audit layer). Thus, it establishes an interpretable, fusionable, and deployable audit mechanism between the global intent information of the complete inference trajectory and the local risk evidence of key segments.
[0061] It should be noted that each implementation method of this application can be freely combined, rearranged, or executed individually, and does not need to rely on or depend on a fixed execution order.
[0062] According to the security auditing method for large-scale intelligent agents provided by the present invention, the execution trajectory is organized into a structured sequence according to the time order, including: Each message or action in the execution trajectory is numbered in chronological order; Extract the preset information for each message or action as a structured field; the preset information includes at least one of the following: role type, tool type, operation object, input parameters, return result, and whether the external state has been changed; A structured sequence is formed based on the number of each message or action and the structured fields of each message or action.
[0063] In some embodiments, organizing the execution trajectory into a structured sequence in chronological order may include the following steps: Structured fields refer to key information items with clear semantics extracted from each record of the original trajectory. For example, for a tool call, its structured fields may include: role type (indicating whether the action was initiated by an agent, environment, or user), tool type (indicating what tool was called, such as a search engine or code executor), operation object (indicating the target of the operation, such as a filename, Uniform Resource Locator (URL), or database table), input parameters (the specific parameters of the call), return result (the feedback after the tool execution), and whether the external state was changed (a boolean value indicating whether the operation had a persistent impact on the external environment of the system).
[0064] In practical applications, each message or action in the execution trajectory is first numbered according to time sequence.
[0065] The original execution trajectory typically consists of a series of events in a timeline, which may include agent inference outputs, tool invocation requests, tool execution result returns, and environment state updates. For subsequent processing and analysis, the system first needs to assign a unique sequence number to each event according to its absolute or relative chronological order. This numbering process is fundamental to ensuring the traceability and causal order of the trajectory.
[0066] Then, the preset information for each message or action is extracted as a structured field.
[0067] For each numbered event, the system extracts preset key information based on its event type using a parser or rule engine. This preset information includes, but is not limited to: role type (e.g., whether the message was generated by an agent, user, system, tool, or environment), tool type (if the event is a tool call, the tool name needs to be extracted), operation object (e.g., the path to the file being operated on, database table name, webpage URL), input parameters (the specific parameter values during the call), return result (the data or status returned by the tool), and whether the external state has been changed (e.g., file writing, database updates, order submissions, etc., can be considered as changing the external state, while only searching or calculating is considered as not changing it).
[0068] Furthermore, a structured sequence is formed based on the number of each message or action and the structured fields of each message or action.
[0069] The system organizes each event and its corresponding structured fields into a serialized data structure, such as a list or a data frame, according to their numbering order. This structured sequence preserves the chronological order of the original trajectory while presenting the core information of each step in a unified and standardized format, providing a standardized input interface for the subsequent evidence extraction module.
[0070] The method provided in this invention converts unstructured and mixed log text into well-structured and semantically clear serialized data by numbering, extracting fields, and serializing and recombining the original execution trajectory. This provides a standardized input interface for the subsequent global audit module and fragment audit module, avoids parsing errors and information loss caused by inconsistent data formats, and improves the robustness and scalability of the audit system.
[0071] According to the security auditing method for large-scale intelligent agents provided by the present invention, key execution segments are extracted through the following steps: Number each message or action in the structured sequence according to chronological order; Candidate segments are generated from the structured sequence based on preset segment boundary conditions; the segment boundary conditions include at least one of the following: tool call boundary, external state change boundary, task completion time point, and abnormal action chain. Key execution segments are selected from candidate segments according to preset key segment filtering rules; the key segment filtering rules include at least one of the following: whether it involves sensitive tools or permissions, whether it changes external state, whether it deviates from the user's task goal, and whether it occurs after the task is completed.
[0072] Specifically, in some embodiments, the extraction of key execution segments may include the following steps: Candidate segments refer to several consecutive event sequences divided from the complete trajectory based on preset boundary conditions. Candidate segments are a candidate set of critical execution segments; they may contain potential risks or simply be normal task sub-steps.
[0073] Segment boundary conditions are rules used to determine when a candidate segment begins and ends. These rules aim to divide long trajectories into semantically complete and easily analyzable segments. For example, a complete tool call and its return result can serve as a boundary; or, the completion of an entire subtask can serve as a boundary.
[0074] Key segment selection rules are used to filter out the segments most in need of auditing from all candidate segments based on their content characteristics. These rules reflect an understanding of risky behaviors in a specific application scenario. Key segment selection rules are pre-defined and can be continuously updated.
[0075] In practical applications, each message or action in the structured sequence is first numbered according to time order.
[0076] This step aims to provide a unique index for each event in the structured sequence, facilitating subsequent segmentation and referencing. It is understood that if the aforementioned structuring steps have already been numbered, the results of this step can be directly reused.
[0077] Then, candidate fragments are generated from the structured sequence based on the preset fragment boundary conditions.
[0078] The system slides along a structured sequence and segments it according to preset boundary conditions. These segment boundary conditions include, but are not limited to: Tool call boundaries: For example, the beginning (initiating a request) and the end (receiving a return result) of a tool call constitute a segment; or, multiple consecutive tool calls constitute a segment.
[0079] External state change boundary: Whenever the "whether to change external state" field in an event changes to "yes", it is treated as an important node, and the events before and after it constitute a segment.
[0080] Task completion time point: When the agent outputs the final answer or the task is marked as completed, the sequence of actions before and after the task completion constitutes a segment.
[0081] Abnormal action chain: When an error, retry, or continuous high-sensitivity operation occurs, these actions and their contexts are grouped into a segment.
[0082] Optionally, the key segment filtering rules can be configured according to the application scenario: In code-based intelligent agent scenarios, key fragment selection rules focus on code execution, file writing, and test commands; in web-based intelligent agent scenarios, key fragment selection rules focus on login, payment, form submission, and external sending; in office automation intelligent agent scenarios, key fragment selection rules focus on email sending, document modification, and permission changes; and in data analysis intelligent agent scenarios, key fragment selection rules focus on database queries, data export, and result modification.
[0083] Further, key execution segments are selected from the candidate segments based on preset key segment filtering rules.
[0084] The system scores or filters all generated candidate segments, selecting the most worthy segments for analysis. The key segment selection rules include, but are not limited to: Does it involve sensitive tools or permissions? For example, operation segments involving tools such as deleting files, modifying permissions, sending emails, executing external Structured Query Language (SQL), and submitting orders are selected first.
[0085] Whether to change external state: All fragments that have a persistent impact on databases, file systems, online services, etc. are selected first.
[0086] Does it deviate from the user task objective? By calculating the similarity between the semantics of the fragment and the user task Q, fragments with low similarity or irrelevantness are filtered out.
[0087] Whether it occurs after the task is completed: Additional operation segments that are still performed after the agent has claimed that the task has been completed are given priority.
[0088] For example, Figure 2 This is the second flowchart illustrating the security auditing method for large-scale intelligent agents provided by this invention, as shown below. Figure 2 The diagram illustrates the process of obtaining the complete execution trajectory and extracting key segments. This method includes: Obtain the complete execution trajectory T (numbered in chronological order), including: [0] User task request normal fragment; [1] The agent plans to generate ordinary fragments; [2] Tool call: Read candidate fragments of files / web pages; [3] Environmental Feedback: Returns a normal fragment of the result; [4] Tool calls: Write / Modify / Commit; [5] Key segment Γ1: The agent explains the reason for the operation; [6] After the task is completed, additional access to the critical fragment Γ2 of the resource is granted; [7] The final output is a normal fragment.
[0089] The steps for extracting key segments include: Segment candidate generation: Segment the trajectory according to message window, tool call boundary, and external state change boundary; The key fragment set is obtained by filtering from the candidate fragments based on the selection criteria.
[0090] The selection criteria are as follows: 1. Does it involve sensitive tools or permissions? 2. Whether to change the external state of a normal fragment 3. Does it deviate from the user's task objectives? 4. Did it occur after the task was completed? 5. Does it form an abnormal link with the preceding and following actions? A set of key segments, including Γ1, Γ2, ..., Γk, is used for subsequent segment-level comparison audits.
[0091] The method provided in this invention achieves automated and configurable extraction of key execution segments from long trajectories through preset boundary conditions and filtering rules. On the one hand, the segment boundary conditions ensure that the extracted segments have semantic integrity and causal coherence; on the other hand, the key segment filtering rules enable the system to flexibly configure filtering strategies according to specific application scenarios (such as code agents, web page agents, office automation agents, etc.), concentrating limited computing resources on segments most likely to contain risky behaviors, thereby improving overall audit efficiency while ensuring audit accuracy.
[0092] According to the present invention, a security auditing method for large-scale intelligent agents generates global risk evidence based on structured sequences, including: Input the complete structured sequence and user task request into the global audit module, and the global audit module will output global risk evidence that represents the consistency between the overall behavior and the user's original task objectives.
[0093] In some embodiments, the step of generating global risk evidence is implemented in the following manner: The global audit module is an independent functional unit used for macro-level risk assessment of the entire execution trajectory. It can be implemented as a large language model loaded with specific prompts, a fine-tuned risk classifier, or a rule engine. Its core function is to understand the complete semantics of the user's task Q and compare it with the agent's entire execution flow to determine whether the latter follows the former's intent in terms of macro-level strategy.
[0094] In practical applications, the complete structured sequence and the user task request are input into the global audit module, which then outputs global risk evidence that characterizes the consistency between the overall behavior and the user's original task objective.
[0095] The following is a detailed embodiment: Let's continue with the example of a web shopping agent. The input received by the global audit module (specifically, a large language model configured with detailed instructions) is: the user's task request Q "Help me buy a new smartphone priced under 5000 yuan" and the complete trajectory (a structured list).
[0096] The processing procedure of the global audit module is as follows: Intent parsing: Model analysis Q extracts the core constraints: "Purchase a smartphone", "Price ≤ 5000 yuan", "New model".
[0097] Strategy Comparison: The model examines the entire trajectory, particularly the reasoning step (number 8) and the final action (numbers 11-13). It identifies that the agent's reasoning shows its plan to "recommend more expensive items," and the final action is to purchase items worth 5200 yuan.
[0098] Consistency Assessment: The model concludes that there is a fundamental conflict between the agent's behavioral strategy (promoting expensive goods) and the user's instruction (purchasing goods within the budget). Instead of attempting to find alternatives within the budget, the agent actively guides the user to exceed their budget.
[0099] Evidence Quantification: Based on the above reasoning, the global audit module outputs a quantified global risk evidence G. In this system, this evidence is designed in the form of a log-likelihood ratio (LLR) to represent the strength of the "risk hypothesis" relative to the "benign hypothesis." For example, the model outputs G=3.5. This positive value represents a strong risk signal, and its magnitude reflects the severity of the target deviation at the global level.
[0100] The method provided in this invention performs a holistic analysis of the complete trajectory and user tasks through a global audit module, which can effectively capture long-term strategic shifts and the evolution of hidden targets across segments. This makes up for the shortcomings of sequential monitoring, which relies only on local windows and lacks global consistency checks, and provides a macro-level evidentiary basis for subsequent Bayesian fusion.
[0101] According to the present invention, a security auditing method for large-scale intelligent agents generates at least one fragment-level risk evidence based on structured sequences, including: For each key execution segment, the segment audit module assesses the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior. Based on the relative probability that each key execution segment belongs to a risky behavior and the relative probability that it belongs to a benign behavior, segment-level risk evidence is generated for each key execution segment.
[0102] In some embodiments, the step of generating at least one fragment-level risk evidence is implemented in the following manner: Comparative risk assessment, in particular, involves evaluating an event or event not in isolation by judging its "suspiciousness," but by analyzing it within two opposing hypothetical frameworks: hypothesis one is that "the event is a risky behavior" (risk hypothesis H1), and hypothesis two is that "the event is a benign behavior" (benign hypothesis H0). Evidence is formed by comparing the relative probabilities of the event occurring under the two hypotheses. The advantage of this method is that it effectively controls false alarms, because an action may be neutral in itself, but becomes suspicious in a specific context.
[0103] In practical applications, for each key execution segment, the segment audit module first assesses the relative probability that the key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior.
[0104] The segment auditing module received a critical segment Γ j And its context. The fragment auditing module (which can also be a general large model or a specialized classifier) performs a dual inference process: First, assuming the segment represents a risky behavior, attempt to explain why these steps are abnormal, malicious, or illegal, and calculate the (log) probability P(Γ) of observing this key segment under this assumption. j |H1).
[0105] Secondly, assuming the segment represents benign behavior, we attempt to explain that these steps are part of a normal task flow and calculate the (log) probability P(Γ) of observing this key segment under this assumption. j |H0).
[0106] Then, based on the relative probability that the key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior, segment-level risk evidence for the key execution segment is generated.
[0107] Fragment-level risk evidence L j It can be defined as the ratio of the two (log) probabilities mentioned above, i.e., the log-likelihood ratio: L j =log(P(Γ j |H1) / P(Γ j |H0)). When L j When L is a large positive number, it indicates that the segment is more likely to occur under the risk assumption, and is a strong risk signal; when L... j When L is a large negative number, it indicates that the segment is more likely to occur under benign assumptions, which is a strong safety signal; when L... j When the value is close to 0, it indicates that the segment does not provide effective information for distinguishing between risk and benign conditions.
[0108] The following is a detailed embodiment: Following the example of the web shopping intelligent agent in Implementation 1, the segment auditing module evaluates the key segment Γ1 (step 9: reading the user profile).
[0109] Risk Assumption (H1) Assessment: The module assumes that the agent intends to engage in goal deviation or privacy abuse. Under this assumption, the agent reads the user profile to analyze the user's spending power and historical preferences, seeking opportunities to sell higher-priced goods, thus violating the user's explicit instruction of "within 5000 yuan". This objective well explains the behavior of "reading the profile just before the decision". Therefore, the module gives a high conditional probability estimate, for example, P(Γ1|H1)=0.8.
[0110] Benign Hypothesis (H0) Evaluation: The module assumes the agent is providing services normally. Under this assumption, the purpose of reading user profiles is to more accurately filter products that match the user's budget, such as identifying preferred brands or confirming whether the user has membership discounts, thereby better serving the user. This explanation is reasonable, but considering the agent's subsequent reasoning ("more expensive items can be recommended") and actions (submitting an order exceeding the budget"), this benign explanation contradicts the subsequent context. Therefore, the module gives a low conditional probability estimate, such as P(Γ1|H0) = 0.1.
[0111] Finally, the module calculates the fragment-level risk evidence L1=log(P(Γ1|H1) / P(Γ1|H0))= log(0.8 / 0.1)=log(8)≈2.08, which is approximately equal to 2.0. This positive evidence indicates that the probability of this fragment under the risk assumption is 8 times that under the benign assumption, providing strong support for the overall risk assessment.
[0112] The method provided in this invention, through comparative risk assessment, places each key segment under both risk and benign assumptions for bidirectional reasoning. This effectively distinguishes truly anomalous operations from sensitive but normal behaviors, avoiding false alarms that are easily generated by unilateral scoring. Furthermore, the segment-level evidence output in the form of log-likelihood ratios has a clear probabilistic interpretation, providing input that conforms to a unified mathematical framework for subsequent Bayesian fusion.
[0113] According to the security auditing method for large-scale intelligent agents provided by the present invention, the global auditing module and the segment auditing module are configured with the same auditing model, or the global auditing module and the segment auditing module are configured with different auditing models; the auditing model is at least one of a large language model, a risk classification model, a rule engine, and an integrated system composed of multiple auditors.
[0114] Specifically, the audit model refers to the algorithmic model or rule set used within the global audit module and the segment audit module to perform analysis and reasoning. It is the core carrier of audit capabilities.
[0115] In this embodiment, the audit models configured in the global audit module and the segment audit module can be flexibly selected.
[0116] First, the global auditing module and the fragment auditing module can be configured with the same auditing model or different auditing models. For example, a low-cost implementation is to use the same general-purpose large language model (such as Qwen3.5-27B) to perform both global and fragment auditing simultaneously, distinguishing tasks only by different prompts. Another high-performance implementation is to use a large model with strong inference capabilities (such as Claude-4-Sonnet) for global auditing, while using a finely tuned, efficient small model for fragment auditing, to balance performance and cost.
[0117] Secondly, the specific form of the audit model can be: Large Language Models (LLMs): Leveraging their powerful semantic understanding and reasoning capabilities, LLMs perform auditing tasks through natural language prompting or in-context learning. This is the mainstream implementation method in this invention's embodiments.
[0118] Risk classification models refer to binary or multi-class classification models trained based on deep learning (such as Transformer). Their input is the feature vector of a trajectory segment, and the output is the risk category or probability. This type of model has fast inference speed, but requires high-quality labeled data for training.
[0119] Rule engine: Refers to a series of "if-then" rules defined by human experts. For example, "If the track contains a 'delete' operation and the operation target is a file under the ' / system / ' path, then it is judged as high risk." This method is highly interpretable but lacks comprehensive coverage, and is usually used in combination with other methods.
[0120] Integrated system: Composed of multiple models or devices mentioned above, it integrates the results from all parties through voting or weighted averaging to improve robustness.
[0121] The following provides a detailed implementation example: Flexible configuration of the audit module. In a specific deployment scenario, the system administrator can configure the system based on budget and accuracy requirements.
[0122] Scenario A (Low Cost, Rapid Deployment): The administrator chooses to use the same open-source model, Qwen3.5-35B-A3B, as the foundation for both global and fragment auditing modules, distinguishing tasks only through two different sets of system prompts. System prompt G requires the model to analyze the consistency of macro-level objectives, while system prompt L requires the model to perform a comparative risk assessment of a given fragment.
[0123] Scenario B (High accuracy and high security requirements): The administrator chooses to use Claude-4-Sonnet as the global auditing module to leverage its powerful long text reasoning capabilities to accurately understand the intent of complex tasks; at the same time, an internally trained small classifier specifically designed to detect "abnormal tool call sequences" is chosen as the fragment auditing module to achieve millisecond-level response to critical operations.
[0124] Scenario C (Completely offline, high interpretability requirements): The administrator chooses to implement the audit module entirely based on a rules engine. The global audit module is a script that checks whether the final result meets the initial constraints; the fragment audit module is a set of rules that check whether there are unauthorized file writes or network requests.
[0125] Regardless of the configuration method used, as long as the "global-local" evidence extraction and Bayesian fusion process proposed in this invention is followed, it falls within the protection scope of this invention.
[0126] The method provided in this invention, by flexibly configuring the audit model, enables the system to select the most suitable model combination according to different deployment scenarios, achieving good scenario adaptability and deployment economy while ensuring audit effectiveness.
[0127] According to the present invention, a security auditing method for large-scale intelligent agents is provided, which performs Bayesian evidence fusion on global risk evidence and at least one fragment-level risk evidence to obtain trajectory-level risk probabilities, including: Represent global risk evidence and at least one fragment-level risk evidence as additive evidence in the form of log-likelihood ratios; Based on each piece of evidence that can be added, calculate the comprehensive evidence; The comprehensive evidence is mapped to trajectory-level risk probabilities using a probability mapping function.
[0128] Specifically, in some embodiments, the specific implementation of Bayesian evidence fusion of global risk evidence and at least one fragment-level risk evidence to obtain trajectory-level risk probabilities includes the following steps: Among them, the log-likelihood ratio: In statistics, the likelihood ratio is the ratio of the probability of observing the same data under two hypotheses. Its logarithmic form (Log-Likelihood Ratio, LLR) is additivity, meaning that the log-likelihood ratios of a series of independent pieces of evidence can be added together to obtain the total strength of evidence. This forms the mathematical basis for evidence fusion in this invention.
[0129] Additive evidence refers to evidence that can be combined through addition under specific mathematical transformations. This invention uniformly represents both global and fragmentary evidence as log-likelihood ratios, simplifying combination operations to simple scalar addition.
[0130] A probability mapping function is a function that maps comprehensive evidence S (a scalar taking values in the real number field, ranging from negative infinity to positive infinity) to a probability value in the interval [0,1]. It must satisfy the property of being monotonically increasing, meaning the stronger the evidence (the larger the positive value), the closer the mapped probability is to 1.
[0131] In practical applications, step 103 specifically includes the following sub-steps: Step 103-1: Represent the global risk evidence and at least one fragment-level risk evidence as additive evidence in the form of log-likelihood ratio.
[0132] The system will receive evidence G, L1, L2, ..., L from each module. k The output of a module is uniformly converted to the log-likelihood ratio (LLR) format. If the output of a module is already in LLR format, it can be used directly. Otherwise, it needs to be converted to LLR using a preset conversion function or calibration mapping.
[0133] Step 103-2: Calculate the comprehensive evidence based on each piece of addable evidence.
[0134] According to the Naive Bayes assumption (i.e., each source of evidence is conditionally independent under a given risk assumption), the total log-likelihood ratio S is equal to the sum of the log-likelihood ratios of each source of evidence: S = G + L1 + L2 + … + L k Where G is the global risk evidence, and L1 to L k For each segment-level risk evidence, k represents the number of critical execution segments.
[0135] This step is the core of the invention, as it organically integrates scattered evidence of varying granularity into a unified metric.
[0136] Step 103-3: Map the comprehensive evidence into trajectory-level risk probabilities using a probability mapping function.
[0137] The system inputs the comprehensive evidence S into a probability mapping function f to obtain the trajectory-level risk probability s: s = f(S). This function is typically the logistic function (Sigmoid) or a variant thereof, for example, expressed as: s=1 / (1+exp(-S)).
[0138] Where s is the trajectory-level risk probability, and S is the comprehensive evidence.
[0139] To make the probability mapping more accurate, a deviation term or temperature coefficient can be introduced into the function for calibration to adjust the overall conservative or aggressive nature of the system.
[0140] The method provided in this invention achieves quantitative fusion and uncertainty quantification of multi-source heterogeneous evidence under a unified probability framework by additively fusing global evidence in the form of log-likelihood ratio with fragmented evidence and mapping it to probability values. This results in obtaining trajectory-level risk probabilities with clear mathematical meaning and interpretability, providing a calibrable decision-making basis for subsequent graded disposal.
[0141] According to the present invention, a security auditing method for large-scale intelligent agents is provided, the method further includes: The audit results are determined based on the trajectory-level risk probability; the audit results include the trajectory-level risk probability and at least one of the following: risk level, overall risk basis, key segment number, segment-level evidence, and handling recommendations; Based on the audit results, implement the corresponding risk management procedures.
[0142] In some embodiments, the method further includes audit result output and risk disposal operations.
[0143] The audit results refer to the structured information set output by the system after completing evidence fusion and risk assessment. It includes not only the final risk probability value, but also the evidence and reasoning at all levels supporting that probability value, which guides subsequent decision-making and provides a complete traceable record for manual review and post-audit.
[0144] Risk level refers to mapping the trajectory-level risk probability of continuously taking values to a finite number of discrete levels according to a preset threshold range, such as low risk, medium risk, high risk, and severe risk, so that the business system can perform differentiated strategy routing and handling according to different levels.
[0145] Global risk evidence refers to the key reasoning process and judgment rationale used by the global audit module when generating global risk evidence G. For example, "The user instruction limits the budget to 5,000 yuan, but the agent ultimately purchases goods worth 5,200 yuan, indicating a clear target deviation." This is used to explain why the trajectory is considered risky from the perspective of the overall task intent.
[0146] The key segment number refers to the unique identifier (such as event number or segment number) of the key execution segment that is extracted and participates in the fusion calculation in the structured sequence, which is used to quickly locate and trace back specific high-risk operation steps.
[0147] Fragment-level evidence refers to the quantitative evidence values (such as log-likelihood ratios) and brief descriptions output after comparative risk assessment of each key execution fragment, used to explain which specific operational steps provided risk signals.
[0148] Handling suggestions: These refer to the initial handling opinions given by the system based on the risk level or risk probability, such as allowing continued execution, suggesting user confirmation, suspending high-risk tools, transferring to manual review, or terminating the task, to guide the system or operators in taking the next steps.
[0149] Risk handling operations: These refer to the specific intervention measures that the system actually performs on the running large model agent based on the risk level or handling suggestions in the audit results, including but not limited to allowing, alarming, downgrading, blocking, and terminating.
[0150] In practical applications, the system generates a structured audit result based on the trajectory-level risk probability s output by the Bayesian fusion module, combined with preset mapping rules and threshold configurations. The audit result includes at least the trajectory-level risk probability s itself, and also includes at least one of the following: risk level, global risk basis, key segment number, segment-level evidence, and processing recommendations.
[0151] Then, based on the audit results, the corresponding risk management procedures are carried out.
[0152] Based on the risk level, risk probability, or handling recommendations in the audit results, corresponding risk mitigation actions are triggered. These risk mitigation actions are actual interventions applied to the operational state of the large-scale model agent, aiming to effectively block or mitigate risky behaviors before they cause actual harm.
[0153] The method provided in this embodiment of the invention, through the above-described processing procedure, can effectively intercept an agent's illegal intent before it causes substantial economic loss, even if the agent has already generated such intent during reasoning. It also provides a complete and interpretable chain of audit evidence to subsequent arbitration and review processes.
[0154] According to the security auditing method for large-scale intelligent agents provided by the present invention, based on the audit results, corresponding risk handling operations are performed, including: If the probability of trajectory-level risk is below the first threshold, the large model agent is allowed to continue execution; If the probability of trajectory-level risk is between the first and second thresholds, prompt the user to confirm or strengthen subsequent auditing. If the trajectory-level risk probability is between the second and third thresholds, suspend the use of high-risk tools, restrict the agent's permissions, or transfer the case to manual review. If the probability of trajectory-level risk is higher than the third threshold, terminate the current task and save the audit record; the first threshold is less than the second threshold, and the second threshold is less than the third threshold.
[0155] Specifically, based on the audit results, the corresponding risk management procedures may include the following steps: Depending on the actual application needs, one or more thresholds can be set: when the risk is low, allow the agent to continue execution; when the risk is medium, prompt the user for confirmation or strengthen subsequent auditing; when the risk is high, suspend the invocation of high-risk tools, restrict the agent's permissions, or transfer the case to manual review; when the risk is severe, terminate the current task and save the audit record.
[0156] The first, second, and third thresholds are three pre-set risk thresholds set by the system, satisfying the condition that the first threshold < the second threshold < the third threshold. These three thresholds divide the [0,1] interval into four sub-intervals, corresponding to low risk, medium risk, high risk, and severe risk levels, respectively. The specific values of each threshold can be configured by the system administrator based on different application scenarios, business risk preferences, and compliance requirements. For example, the system can set different thresholds based on task type, user permissions, tool sensitivity, and business risk level. For low-risk consulting tasks, a more lenient audit strategy can be adopted; for high-risk tasks involving code execution, account operations, file deletion, external transmission, or data modification, stricter thresholds and processing methods can be used.
[0157] For example, when the trajectory-level risk probability *s* is below a first threshold (e.g., 0.2), the system determines the trajectory to be low-risk, meaning that no obvious target deviation, abnormal operation, or security threat has been detected in the current execution process. In this case, the system does not take any intervention measures, allowing the large model agent to continue executing the task according to the original process. This strategy aims to ensure the smoothness of normal tasks and avoid unnecessary interference and delays to legitimate operations.
[0158] When the trajectory-level risk probability *s* falls between the first and second thresholds (e.g., 0.2 ≤ *s* < 0.5), the system classifies the trajectory as medium-risk, indicating some risk but not yet clearly defined. In this case, the system adopts a cautious strategy: on the one hand, it can push a notification message to the user, requesting confirmation that the agent's current behavior matches their expectations; on the other hand, it can strengthen the auditing of subsequent steps, such as conducting a more detailed risk assessment of subsequently generated trajectory segments. This strategy aims to address the uncertainty of automatic judgment through human-machine collaboration, preventing task interruptions caused by false alarms.
[0159] When the trajectory-level risk probability *s* is between the second and third thresholds (e.g., 0.5 ≤ *s* < 0.8), the system determines the trajectory to be high-risk, indicating a significant security threat, requiring proactive intervention. In this case, the system can perform one or more of the following actions: Suspend high-risk tool calls: For example, block upcoming high-risk operations such as deleting files, sending external emails, or submitting payment orders, pending further confirmation.
[0160] Restrict agent permissions: For example, temporarily revoke an agent's file write permissions, or restrict it to only perform read-only operations, thereby preventing the spread of risky behavior.
[0161] Transfer to manual review: Submit the current task along with the complete audit results to the manual review queue, where security experts or operations personnel will make the final decision.
[0162] When the trajectory-level risk probability *s* exceeds the third threshold (e.g., *s* ≥ 0.8), the system determines the trajectory as a serious risk, meaning the agent is almost certainly engaging in malicious behavior that violates user intent or security regulations. In this case, the system immediately terminates the current task (e.g., forcibly killing the agent process or revoking all its unfinished tool calls) and completely saves all trajectory data, evidence, and audit results to a tamper-proof audit log for subsequent investigation and evidence collection.
[0163] The method provided in this invention can not only determine whether there is a risk in the trajectory of an intelligent agent, but also indicate whether the risk mainly comes from target deviation at the level of the complete trajectory or abnormal operation in a specific segment, which facilitates system processing and manual review.
[0164] This invention was validated in a long-trajectory, large-model intelligent agent security audit scenario. Experimental results show that the Bayesian security audit method based on global trajectory evidence and local key segment evidence can significantly improve the ability to identify concealed misalignment behaviors and abnormal execution behaviors. This invention achieves stable improvements across various audit model foundations: When using Claude-4-Sonnet as the audit model, the area under the curve (AUC) of the basic audit method is 0.420, and the total public price ratio (TPR) @ fair public price ratio (FPR) = 0.05 is 0.394; after adopting this invention, these values are improved to 0.942 and 0.779, respectively. When using Qwen3.5-27B as the audit model, the AUC increases from 0.399 to 0.932, and the TPR @ FPR = 0.05 increases from 0.260 to 0.760. When using Qwen3.5-35B-A3B as the audit model, the AUC increases from 0.510 to 0.936, and the TPR @ FPR = 0.05 increases from 0.327 to 0.731. These results demonstrate that this invention does not rely on a specific large model, but rather improves security audit effectiveness across different model capability levels through global-local evidence decomposition and Bayesian fusion mechanisms. From an operational perspective, the average audit time per trajectory in this invention is approximately 17.85 seconds, significantly lower than the 139.29 seconds for sequential auditing and the 180.63 seconds for hierarchical auditing, and only about 10 seconds longer than a basic single audit. Therefore, this invention improves audit accuracy while maintaining low deployment costs and good practical usability. Compared to methods that only review the final output, perform single complete trajectory audits, or simply segmented audits, this invention preserves the complete task context, locates key risk segments, and outputs risk probabilities, risk levels, and key evidence, facilitating manual review, system processing, and audit documentation. It is suitable for application scenarios requiring auditing of the intelligent agent's execution process, such as code execution, web page operations, enterprise office work, data analysis, and automated operation and maintenance.
[0165] Figure 3 This is the third flowchart of the security auditing method for large-scale intelligent agents provided by this invention, as shown below. Figure 3 As shown, the method includes: Obtain the complete trajectory T + user task Q.
[0166] Global trajectory risk assessment yields global evidence G.
[0167] A comparative segment evaluation (risk assumption vs. benign assumption) is performed on each key segment to obtain corresponding segment evidence. Each key segment includes key segment Γ1, key segment Γ2, ..., key segment Γk, and the corresponding segment evidence includes segment evidence L1, segment evidence L2, ..., segment evidence L... k .
[0168] Evidence fusion: S = G + L1 + L2 + ... + L k ; Probability mapping: s = sigmoid(S).
[0169] Risk Level and Handling: Low risk: Continue execution; Medium risk: Enhance audit; High risk: Block or switch to manual control.
[0170] Figure 4 This is the fourth flowchart of the security auditing method for large-scale intelligent agents provided by this invention, as shown below. Figure 4 As shown, the method includes: Based on the user task request Q and the agent's execution process, the execution trajectory is collected, including inference text / tool calls / environmental feedback / output; Trajectory structuring includes message number, role, time sequence, and operation object; Global trajectory risk assessment, including task type, goal consistency, and overall intent deviation; and key segment extraction and local assessment, including sensitive operations, state changes, and abnormal links; Bayesian evidence fusion combines global evidence with fragmented evidence to obtain trajectory-level risk probabilities. Threshold assessment and risk level classification: Low / Medium / High / Severe; Risk handling: Allow continuation / Enhance audit / Request confirmation / Downgrade privileges / Block execution / Transfer to manual review.
[0171] Figure 5 This is a schematic diagram of the security auditing system for large-scale intelligent agents provided by the present invention. The system includes: Track acquisition module: Acquires task requests, execution logs, and tools; Trajectory preprocessing module: cleaning, segmentation, numbering, and structuring; Key segment extraction module: Identifies sensitive operation and abnormal behavior segments; Global Evidence Evaluation Module: Assessing overall goal consistency and task deviation; Fragment Evidence Assessment Module: Estimates the probability of fragments under risk and benign assumptions, respectively; Bayesian fusion module: fuses global and local evidence to output risk probability; Risk handling module: Alarm, blocking, demotion, transfer to human operator; Audit report module: Preservation of evidence, fragment index, and disposal records.
[0172] The security auditing device for large-scale intelligent agents provided by the present invention is described below. The security auditing device for large-scale intelligent agents described below can be referred to in correspondence with the security auditing method for large-scale intelligent agents described above.
[0173] Figure 6 This is a schematic diagram of the security auditing device for large-scale intelligent agents provided by the present invention, as shown below. Figure 6 As shown, the security auditing device 600 for large-scale intelligent agents includes: The acquisition module 610 is used to acquire user task requests and the execution trajectory of large model agents, and organize the execution trajectory into a structured sequence according to the time order; Evidence generation module 620 is used to generate global risk evidence and at least one fragment-level risk evidence based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The fusion module 630 is used to perform Bayesian evidence fusion on the global risk evidence and the at least one fragment-level risk evidence to obtain the trajectory-level risk probability; the trajectory-level risk probability represents the conditional probability that the large model agent has any one of the following during the entire task execution process, given the user task request and the execution trajectory: target deviation, hidden violation behavior, and abnormal operation.
[0174] This invention combines global intent information of the complete reasoning trajectory (i.e., global risk evidence G, reflecting whether the overall behavior of the agent deviates from the user's original goal) with local risk evidence of key segments (i.e., segment-level risk evidence L). j This invention organically separates and integrates the risk information (reflecting whether there are anomalies in specific sensitive operations) with Bayesian methods, ultimately generating a trajectory-level risk probability s with a clear probabilistic interpretation. Compared with existing technologies, this invention avoids the problem of difficulty in locating specific risk positions due to excessively long context and information dilution in single complete trajectory audits, and also avoids the defects of sequential and hierarchical monitoring that lack global consistency checks or lose cross-segment causal relationships. By unifying the global context and local evidence into the same probabilistic framework, it achieves accurate identification of hidden target deviations and cross-segment abnormal behaviors, making the audit results interpretable (traceable to specific segments and global judgments), fusionable (based on a unified evidence update mechanism based on Bayesian theory), and deployable (without retraining the agent model, it only needs to be accessed as an independent audit layer). Thus, it establishes an interpretable, fusionable, and deployable audit mechanism between the global intent information of the complete inference trajectory and the local risk evidence of key segments.
[0175] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, wherein the acquisition module 610 is specifically used for: Each message or action in the execution trajectory is numbered in chronological order; Extract preset information for each message or action as a structured field; the preset information includes at least one of the following: role type, tool type, operation object, input parameters, return result, and whether the external state has been changed; The structured sequence is formed based on the number of each message or action and the structured fields of each message or action.
[0176] According to the security auditing device 600 for large-scale intelligent agents provided by the present invention, the key execution segments are extracted through the following steps: Each message or action in the structured sequence is numbered according to chronological order; Candidate segments are generated from the structured sequence based on preset segment boundary conditions; the segment boundary conditions include at least one of tool call boundary, external state change boundary, task completion time point, and abnormal action chain. The key execution segment is selected from the candidate segments according to the preset key segment filtering rules; the key segment filtering rules include at least one of the following: whether it involves sensitive tools or permissions, whether it changes the external state, whether it deviates from the user's task goal, and whether it occurs after the task is completed.
[0177] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, wherein the evidence generation module 620 is specifically used for: The complete structured sequence and the user task request are input into the global audit module, which then outputs global risk evidence that characterizes the consistency between the overall behavior and the user's original task objective.
[0178] According to the security auditing device 600 for large-scale intelligent agents provided by the present invention, the evidence generation module 620 is further used for: For each of the key execution segments, the segment audit module assesses the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior. Based on the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior, segment-level risk evidence is generated for each key execution segment.
[0179] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, wherein the global auditing module and the segment auditing module are configured with the same auditing model, or the global auditing module and the segment auditing module are configured with different auditing models; the auditing model is at least one of a large language model, a risk classification model, a rule engine, and an integrated system composed of multiple auditors.
[0180] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, wherein the fusion module 630 is specifically used for: The global risk evidence and the at least one fragment-level risk evidence are represented as additive evidence in the form of log-likelihood ratios; Based on the aforementioned addable evidence, calculate the comprehensive evidence; The comprehensive evidence is mapped to the trajectory-level risk probability using a probability mapping function.
[0181] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, the security auditing device 600 for large-scale intelligent agents further includes a risk handling module; The risk management module is used for: The audit results are determined based on the trajectory-level risk probability; the audit results include the trajectory-level risk probability and at least one of the following: the risk level, the global risk basis, the key segment number, the segment-level evidence, and the handling recommendations; Based on the audit results, appropriate risk management actions will be taken.
[0182] According to the present invention, a security auditing device 600 for large-scale intelligent agents is provided, wherein the risk handling module is specifically used for: If the trajectory-level risk probability is lower than a first threshold, the large model agent is allowed to continue execution; If the trajectory-level risk probability is between the first threshold and the second threshold, the user is prompted to confirm or strengthen subsequent auditing. If the trajectory-level risk probability is between the second and third thresholds, the use of high-risk tools will be suspended, the agent's permissions will be restricted, or the case will be transferred to manual review. If the trajectory-level risk probability is higher than the third threshold, terminate the current task and save the audit record; the first threshold is less than the second threshold, and the second threshold is less than the third threshold.
[0183] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 7 As shown, the electronic device may include: a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a security auditing method for large-scale intelligent agents, which includes: Obtain user task requests and the execution trajectory of large model agents, and organize the execution trajectories into a structured sequence according to time order; Global risk evidence and at least one fragment-level risk evidence are generated based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The global risk evidence and the at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0184] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0185] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the security auditing method for large-scale intelligent agents provided by the above methods, the method comprising: Obtain user task requests and the execution trajectory of large model agents, and organize the execution trajectories into a structured sequence according to time order; Global risk evidence and at least one fragment-level risk evidence are generated based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The global risk evidence and the at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0186] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the security auditing method for large-scale intelligent agents provided by the methods described above, the method comprising: Obtain user task requests and the execution trajectory of large model agents, and organize the execution trajectories into a structured sequence according to time order; Global risk evidence and at least one fragment-level risk evidence are generated based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The global risk evidence and the at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
[0187] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0188] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0189] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A security auditing method for large-scale intelligent agents, characterized in that, include: Obtain user task requests and the execution trajectory of large model agents, and organize the execution trajectories into a structured sequence according to time order; Global risk evidence and at least one fragment-level risk evidence are generated based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The global risk evidence and the at least one fragment-level risk evidence are fused using Bayesian evidence to obtain the trajectory-level risk probability. The trajectory-level risk probability represents the conditional probability that, given the user task request and the execution trajectory, the large model agent has any one of the following during the entire task execution process: target deviation, hidden violation behavior, and abnormal operation.
2. The security auditing method for large-scale intelligent agents according to claim 1, characterized in that, The step of organizing the execution trajectory into a structured sequence according to time order includes: Each message or action in the execution trajectory is numbered in chronological order; Extract preset information for each message or action as a structured field; the preset information includes at least one of the following: role type, tool type, operation object, input parameters, return result, and whether the external state has been changed; The structured sequence is formed based on the number of each message or action and the structured fields of each message or action.
3. The security auditing method for large-scale intelligent agents according to claim 1, characterized in that, The key execution segment is extracted through the following steps: Each message or action in the structured sequence is numbered according to chronological order; Candidate segments are generated from the structured sequence based on preset segment boundary conditions; the segment boundary conditions include at least one of tool call boundary, external state change boundary, task completion time point, and abnormal action chain. The key execution segment is selected from the candidate segments according to the preset key segment filtering rules; the key segment filtering rules include at least one of the following: whether it involves sensitive tools or permissions, whether it changes the external state, whether it deviates from the user's task goal, and whether it occurs after the task is completed.
4. The security auditing method for large-scale intelligent agents according to claim 1, characterized in that, The generation of global risk evidence based on the structured sequence includes: The structured sequence and the user task request are input into the global audit module, which then outputs global risk evidence that characterizes the consistency between the overall behavior and the user's original task objective.
5. The security auditing method for large-scale intelligent agents according to claim 1, characterized in that, Generating at least one fragment-level risk evidence based on the structured sequence includes: For each of the key execution segments, the segment audit module assesses the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior. Based on the relative probability that each key execution segment belongs to risky behavior and the relative probability that it belongs to benign behavior, segment-level risk evidence is generated for each key execution segment.
6. The security auditing method for large-scale intelligent agents according to claim 4 or 5, characterized in that, The global audit module and the segment audit module are configured with the same audit model, or the global audit module and the segment audit module are configured with different audit models; the audit model is at least one of the following: a large language model, a risk classification model, a rule engine, and an integrated system composed of multiple auditors.
7. The security auditing method for large-scale intelligent agents according to any one of claims 1-3, characterized in that, The step of performing Bayesian evidence fusion on the global risk evidence and the at least one fragment-level risk evidence to obtain the trajectory-level risk probability includes: The global risk evidence and the at least one fragment-level risk evidence are represented as additive evidence in the form of log-likelihood ratios; Based on the aforementioned addable evidence, calculate the comprehensive evidence; The comprehensive evidence is mapped to the trajectory-level risk probability using a probability mapping function.
8. The security auditing method for large-scale intelligent agents according to claim 1, characterized in that, The method further includes: The audit results are determined based on the trajectory-level risk probability; the audit results include the trajectory-level risk probability and at least one of the following: the risk level, the global risk basis, the key segment number, the segment-level evidence, and the handling recommendations; Based on the audit results, appropriate risk management actions will be taken.
9. The security auditing method for large-scale intelligent agents according to claim 8, characterized in that, Based on the audit results, the corresponding risk management operations are performed, including: If the trajectory-level risk probability is lower than a first threshold, the large model agent is allowed to continue execution; If the trajectory-level risk probability is between the first threshold and the second threshold, the user is prompted to confirm or strengthen subsequent auditing. If the trajectory-level risk probability is between the second and third thresholds, the use of high-risk tools will be suspended, the agent's permissions will be restricted, or the case will be transferred to manual review. If the trajectory-level risk probability is higher than the third threshold, terminate the current task and save the audit record; the first threshold is less than the second threshold, and the second threshold is less than the third threshold.
10. A security auditing device for large-scale intelligent agents, characterized in that, include: The acquisition module is used to acquire user task requests and the execution trajectory of large model agents, and organize the execution trajectory into a structured sequence according to the time order; An evidence generation module is used to generate global risk evidence and at least one fragment-level risk evidence based on the structured sequence; wherein, the global risk evidence is obtained by performing an overall risk assessment on the complete structured sequence, and the fragment-level risk evidence is obtained by performing a risk assessment on key execution fragments extracted from the structured sequence; The fusion module is used to perform Bayesian evidence fusion on the global risk evidence and the at least one fragment-level risk evidence to obtain the trajectory-level risk probability; the trajectory-level risk probability represents the conditional probability that the large model agent has any one of the following during the entire task execution process, given the user task request and the execution trajectory: target deviation, hidden violation behavior, and abnormal operation.
