Sensitive data protection and local trusted execution for artificial intelligence agents

By constructing protected execution references and multi-layered cryptographic configurations in the AI ​​agent, the problem of sensitive data being exposed in external models is solved. This enables local trusted execution and secure isolation of sensitive data, prevents replay and cryptographic configuration failure, and improves the trustworthiness and security of data protection.

CN123179453APending Publication Date: 2026-11-27KOAL SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively protect sensitive data in AI agents, prevent its exposure in external model contexts, and prevent the replay of sensitive data and password configuration failures across tasks, tools, and parameter locations.

Method used

A sensitive data protection and local trusted execution method for artificial intelligence agents is constructed. Sensitive data is encrypted and stored within a local trusted boundary. Protected execution references with bound logical secret identifiers are generated and used in the combination of authorized tools and parameter positions to ensure that the authorization boundary of sensitive parameters cannot be changed by external models. Multi-layer cryptographic configuration and integrity authentication are used to protect data transmission and execution processes.

Benefits of technology

It achieves secure isolation of sensitive data in the external model context, prevents the transmission of sensitive data in plaintext, ensures that protected execution references are used under authorized conditions, prevents replay and password configuration failure, prevents the duplication of executed actions, and improves the trustworthiness and security of data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123179453A_ABST
    Figure CN123179453A_ABST
Patent Text Reader

Abstract

The application relates to a sensitive data protection and local trusted execution method for an artificial intelligence intelligent agent, wherein sensitive data is identified and encrypted and stored in a local trusted boundary, and a logical secret identifier is distributed; an integrity protection reference bound with an authorized tool, a parameter position and an execution context is generated according to a trusted tool calling mode and a local strategy, and sensitive data sent to an external model is replaced. Model output is analyzed, and action mode consistency, reference integrity, execution context, permission and anti-replay state are checked; after the checking, sensitive data is filled in through an isolated parameter channel by a trusted tool adapter and a target tool is called. Old references are invalidated and new references are generated when password configuration, keys or execution state changes; repeated execution is prevented according to the execution state, and automatic retry is prevented when it cannot be determined whether a non-idempotent action has been executed. According to the application, sensitive data plaintext does not enter an external model context, and the external model is prevented from expanding permission or reducing local password configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence security, data security, and trusted execution technology, and more specifically, to a method for sensitive data protection and local trusted execution for artificial intelligence agents. Background Technology

[0002] AI agents typically leverage large language models or other generative models for task understanding, plan generation, tool selection, and parameter construction. Task context may contain passwords, access tokens, private keys, connection strings, personal information, trade secrets, and sensitive content generated from files, persistent memory, session summaries, retrieval results, and data returned by tools. Directly sending this data when the model service is located outside the local security domain expands the exposure of sensitive data.

[0003] Existing solutions typically encrypt stored data or replace sensitive fields with masks, placeholders, or tokens before model invocation. Fixed placeholders are usually not bound to specific AI agents, tasks, execution epochs, checkpoint states, target tools, and target parameter locations, making it difficult to prevent cross-task replay, cross-tool misuse, and parameter location mismatches. If the tool invocation pattern can be modified by an external model, or if the model output directly enters the command line, database driver, browser, or business system, sensitive data may still end up in unauthorized parameter locations, ordinary logs, process parameters, and exception stacks.

[0004] The task execution process of AI Agents also includes pause and recovery, automatic retries, checkpoint rollback, execution migration, and multi-AI Agent delegation. If the protected reference is unrelated to the execution state, the restored old reference may remain valid, and completed actions may be repeated. On the other hand, using a single cryptographic algorithm or configuring the algorithm only at the storage layer makes it difficult to ensure that reference verification synchronously reflects compliance policies, expected confidentiality periods, algorithm deactivation, key rotation, and post-quantum migration states; target tools may also have character set and length constraints on parameters such as account numbers, card numbers, or device identifiers. Therefore, it is necessary to keep sensitive data within local trusted boundaries and ensure that external references can only be resolved by trusted components at the bound and verified execution locations, while also incorporating the selection, version, and migration state of cryptographic configurations into the reference generation and verification process. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a method for sensitive data protection and local trusted execution for artificial intelligence agents, which can reduce the exposure of sensitive data in model context, ordinary running logs and command parameters, ensure that external models cannot change the authorization boundaries of sensitive parameters or reduce the password configuration selected locally, and prevent protected references from being used across tasks, tools, parameter positions, execution states or after password configuration has expired.

[0006] The technical solution adopted by this invention to solve its technical problem is: constructing a method for sensitive data protection and local trusted execution for artificial intelligence agents, including the following steps: S1. Obtain the target tool invocation pattern set from the trusted tool registration information located within the local trusted boundary; S2. Obtain the task context data of the AI ​​agent, identify sensitive data in the task context data, assign logical secret identifiers to the sensitive data, and encrypt and store the sensitive data within the local trusted boundary. S3. Based on the target tool invocation pattern set and the local execution strategy, determine the authorized tool and parameter location combination that allows the use of sensitive data. The authorized tool and parameter location combination is derived from the target tool invocation pattern set that matches the corresponding tool. S4. Generate a corresponding protected execution reference for the combination of authorized tool and parameter location. The protected execution reference has integrity authentication information and is bound to the logical secret identifier, AI Agent identifier, task identifier, execution epoch, checkpoint state summary and target tool identifier and target parameter location in the combination, and does not contain plaintext of sensitive data. S5. Replace the sensitive data in the task context data to be sent to the external model with a reference set containing the corresponding protected execution reference, and receive the output of the external model; S6. Parse the output of the external model into a structured action containing the target tool, parameter location, and protected execution references in the reference set, and verify the consistency between the structured action and the corresponding target tool call pattern in the target tool call pattern set, as well as the integrity of the protected execution references, execution context consistency, call permissions, and anti-replay status. S7. When all verifications pass, generate or obtain an idempotent identifier, atomically write it into the pre-commit state of the structured action and reserve one use of the protected execution reference. The protected execution reference is parsed by the trusted tool adapter corresponding to the target tool. Before calling the target tool with the idempotent identifier, sensitive data is filled into the target parameter position through an isolated parameter channel that does not go through the external model context, AI Agent readable logs and command line parameters. If any verification fails, prevent the parsing of the protected execution reference and the execution of the structured action. S8. Upon completion of a structured action, atomically write the action completion status, execution result summary, and usage status of the protected execution reference; invalidate the protected execution reference when it reaches its maximum usage count, expires, or when a one-time action specified by the local execution policy is completed; and retain the logical secret identifier when the execution status changes due to task retry, breakpoint recovery, or execution migration, invalidate the protected execution reference corresponding to the original execution epoch, and generate a new protected execution reference based on the new execution epoch and the new checkpoint status summary; determine the execution status of the structured action based on the pre-commit status, the execution result query result corresponding to the idempotency identifier, or the protected local execution record, replace the original protected execution reference in the structured action that has not yet been executed with the new protected execution reference, prevent the repeated execution of structured actions that have been executed, and prevent automatic retry when it cannot be determined whether a non-idempotent action has been executed.

[0007] According to the above scheme, in step S1, the trusted tool registration information is stored in the trusted tool registry or policy storage within the local trusted boundary. The target tool invocation mode set is verified by the trusted execution control component for version verification, integrity verification, and anti-rollback verification relative to the local trusted baseline version, and external model modification is not allowed. When the protected execution reference is located in an unauthorized parameter position, the mode version of the target tool invocation mode is inconsistent, or the model output cannot be converted into a structured action that conforms to the corresponding mode, execution is refused. The trusted tool adapter completes late binding before the application interface request is sent, before the database connection is established, when the protected field is filled in the local browser, in the isolated parameter channel of the command line tool, or before the local tool protocol server executes the tool call, and does not return the plaintext of the sensitive data to the external model or ordinary AI Agent running component.

[0008] According to the above scheme, in step S1, a password configuration file is obtained from the password configuration registration information located within the local trusted boundary and protected by integrity. Each password configuration file includes a password configuration identifier, password configuration version, security level, key version, and algorithm configuration information for key protection, data encryption, and integrity authentication. Based on the local execution strategy, combined with the secret type of sensitive data, target tool, target parameter location, expected confidentiality period, and format constraints, a corresponding password configuration file is selected for each authorized tool and parameter location combination. The selected password configuration identifier, password configuration version, security level, and key version are further bound to the corresponding protected execution reference. The external model has no right to modify the password configuration registration information or select or downgrade the password configuration for the protected execution reference. Before parsing the protected execution reference, the consistency between the password configuration contained in the reference and the password configuration registration information is verified, and whether the anti-downgrade requirements are met is verified relative to the locally stored trusted benchmark version. When the password configuration version, key version, security level, or algorithm availability status changes, the protected execution reference that does not conform to the current valid password configuration is invalidated, and a new protected execution reference is generated according to the current valid password configuration.

[0009] According to the above scheme, in step S2, the task context data includes at least one of user sessions, uploaded files, persistent memory, session summaries, retrieval results, messages between AI Agents, and tool return data; the genealogical relationship between the source data node corresponding to the sensitive data and the derived data node generated by the sensitive data is recorded, and the derived data to be sent to the external model is replaced with one or more corresponding protected execution references according to the genealogical relationship; when it is impossible to accurately locate the sensitive segment in the derived data, the derived data is protected as a whole according to the local policy, the derived data without sensitive data is regenerated, or the sending of the derived data is blocked.

[0010] According to the above scheme, in step S2, a three-level cryptographic service system consisting of a master key, a key encryption key, and a scope data encryption key is used to encrypt and store the sensitive data, mapping metadata, and reference state. The cryptographic configuration file includes: a national cryptographic configuration that uses SM2 digital signature, SM2 key exchange protocol, or SM2 public key encryption algorithm to protect lower-level key materials, uses SM3 for digest operation or as a hash component in key derivation function, and uses SM4 authentication encryption mode or a combination of SM4 encryption and independent message authentication code to protect sensitive data and mapping state; a cryptographic configuration that uses RSA-OAEP for key transmission, uses a key negotiation algorithm based on elliptic curve cryptography for key establishment, uses RSA-PSS or ECDSA for digital signature, uses AES-GCM for authentication encryption, and uses hash functions in the SHA-256 or SHA-3 family for digest operation or key derivation; a post-quantum cryptographic configuration that uses ML-KEM to establish a shared secret and uses ML-DSA or SLH-DSA for digital signature according to authentication needs; and a hybrid cryptographic configuration.

[0011] The hybrid key establishment configuration obtains the shared secret of the classical algorithm and the shared secret of the post-quantum algorithm respectively. The algorithm identifier, parameter set, execution context and the shared secret are combined according to a predetermined encoding and then input into the key derivation function to generate a session key. The hybrid signature configuration generates a classical signature and a post-quantum signature for the same deterministic encoded message respectively, and determines that the authentication is successful only when all the required signatures are verified.

[0012] According to the above scheme, in step S4, the protected execution reference adopts a self-contained ciphertext reference or a local mapping index reference, and is further bound with the validity period, maximum number of uses, random number, action type, policy version, and target tool invocation mode mode mode version; when the target parameter position has character set and length constraints, an available character field is defined within the local trusted boundary, and a cryptographically secure random source is used to generate a high-entropy random alias that does not contain the sensitive data within the available character field, and the high-entropy random alias is atomically checked and occupied in the local mapping storage; only when the size of the available character field and the expected number of issuances meet the minimum entropy value and maximum collision probability requirements specified by the current cryptographic configuration version, and the current cryptographic configuration allows the use of the FF1 underlying block cipher, is the high-entropy random alias subjected to a format-preserving transformation using FF1; The adjustment value of FF1 is derived from the deterministic encoding of the AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier, target parameter position, and password configuration version, and the integrity of the transformation result and the binding information is further protected by message authentication code or authentication encryption. For formats containing check bits, only payloads without check bits are subjected to a reserved format transformation, and the check bits are recalculated by the trusted execution control component. The reserved format transformation does not process the plaintext of the sensitive data. When the above conditions are not met, an opaque token, a typed placeholder, or prevention of the generation of the protected execution reference is used instead.

[0013] According to the above scheme, in step S7, the pre-submission status, action completion status, execution result summary, and usage status are updated in the local state storage with atomic operations; when the task is restored or migrated, the integrity of the restoration checkpoint is verified, and only structured actions that are determined to be in the pending execution status are generated with new protected execution references according to the current valid cryptographic configuration. Completed actions are kept in the state of not being able to be executed again, and non-idempotent high-risk actions whose execution status cannot be determined are transferred to manual confirmation or compensation processing; when the cryptographic configuration version, key version, security level, or algorithm availability status changes, protected execution references that do not conform to the current valid cryptographic configuration are invalidated, and execution is not continued with plaintext processing, deactivated algorithms, or cryptographic configurations that are lower than the requirements of the local execution policy.

[0014] According to the above scheme, in step S8, when the first AI Agent delegates a task to the second AI Agent, a derived execution reference with a scope of authority no greater than the original protected execution reference and a security level no lower than the local policy requirements is generated. For delegations that cross independent local trusted boundaries, the sender's trusted execution control component determines the commonly allowed cryptographic configuration based on the certified receiver's cryptographic capability information and the local policies of both parties. Key materials that need to be kept confidential for a long time are protected by configuration using a post-quantum or hybrid key that includes an ML-KEM path. Delegation authorizations that require cross-domain authentication are protected by configuration using a post-quantum signature or a hybrid signature that simultaneously verifies classical signatures and post-quantum signatures.

[0015] According to the above scheme, in step S8, an audit record without containing plaintext sensitive data is generated; an audit-specific key is used to calculate a message authentication code to form an audit pseudonym based on the logical secret identifier or the protected execution reference identifier. Each audit record includes the audit pseudonym, AI Agent identifier, task identifier, target tool identifier, identifier of the password configuration used, version and key version, policy judgment, execution result, time information, and digest value of the previous audit record; the current digest value is calculated according to the predetermined field order and encoding method, and the current digest value is protected using the algorithm specified by the password configuration and the audit-specific key; after the password configuration is deactivated, the ability to verify historical audit records is retained, or a migration anchor is generated at the head of the historical audit chain using the currently valid password configuration.

[0016] This invention also provides a sensitive data protection and local trusted execution system for artificial intelligence agents, comprising: The execution reference generation module is used to determine the combination of authorized tools and parameter locations based on the target tool invocation pattern set and local execution strategy, and generate a protected execution reference that binds the AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier and target parameter location, and does not contain sensitive data plaintext; The model interaction and action parsing module is used to send the protected execution reference and non-sensitive context only to the external model, and parse the output of the external model into structured actions; The strategy and verification module is used to verify the consistency between structured actions and the corresponding target tool call patterns, as well as the integrity of protected execution references, execution context consistency, call permissions, and anti-replay status. The trusted tool adaptation module is used to fill the parsed sensitive data into the authorization parameter position through the isolated parameter channel before calling the target tool after all verifications have passed and the pre-submission status has been written. The status and audit module is used to atomically update the pre-commit status, action completion status, execution result summary, and reference usage status. It also invalidates the protected execution reference of the original execution epoch during task retry, breakpoint recovery, or execution migration, generates a new protected execution reference based on the new execution epoch and the new checkpoint status summary, prevents the repeated execution of already executed actions, and prevents automatic retries when it is uncertain whether a non-idempotent action has been executed.

[0017] The method for sensitive data protection and local trusted execution for artificial intelligence agents according to the present invention has the following beneficial effects: This invention prevents sensitive data in plaintext from entering the external model context. The external model cannot extend the permissions limited by the trusted tool registration information, nor can it select or reduce the local password configuration. Protected execution references can only be used under their bound AIAgent, task, execution epoch, checkpoint, tool, parameter location, and valid password configuration. Old references become invalid after changes in password configuration, key, or execution state; external references in format-restricted scenarios are still generated by local high-entropy aliases and their execution bindings. The system prevents actions determined to have been executed from being automatically repeated and stops automatic retries when it cannot be determined whether a non-idempotent action has already been executed. Attached Figure Description

[0018] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings: Figure 1 This is a flowchart illustrating the sensitive data protection and local trusted execution method for artificial intelligence agents according to the present invention. Figure 2 This is a schematic diagram of the system architecture of the method for sensitive data protection and local trusted execution of artificial intelligence agents according to the present invention; Figure 3 This is a schematic diagram illustrating the relationship between the three-level cryptographic service and cryptographic configuration of the sensitive data protection and local trusted execution method for artificial intelligence agents according to the present invention; Figure 4 This is a schematic diagram illustrating the composition and binding relationship of the protected execution reference in the sensitive data protection and local trusted execution method for artificial intelligence agents of this invention; Figure 5 This is a schematic diagram of the structured action verification and local trusted execution link of the present invention for sensitive data protection and local trusted execution method for artificial intelligence intelligent agents; Figure 6 This is a schematic diagram illustrating the reference rotation when the execution state or cryptographic state changes in the sensitive data protection and local trusted execution method for artificial intelligence agents according to the present invention. Detailed Implementation

[0019] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0020] like Figure 1 As shown, the sensitive data protection and local trusted execution method for artificial intelligence agents of the present invention includes the following steps: S1. Obtain the target tool invocation pattern set from the trusted tool registration information located within the local trusted boundary; the target tool invocation pattern set includes one or more target tool invocation patterns, each target tool invocation pattern includes at least the tool identifier, parameter type, sensitive parameter location, allowed secret type and pattern version, and has integrity authentication information.

[0021] Trusted tool registration information is stored in the trusted tool registry or policy store within the local trusted boundary. The target tool invocation pattern set is verified by the trusted execution control component for version verification, integrity verification, and rollback prevention verification relative to the local trusted baseline version, and external model modification is not allowed. Execution is refused when the protected execution reference is located in an unauthorized parameter position, the pattern version of the target tool invocation pattern is inconsistent, or the model output cannot be converted into a structured action conforming to the corresponding pattern. The trusted tool adapter completes late binding before the application interface request is sent, before the database connection is established, when the protected field is populated in the local browser, in the isolated parameter channel of the command-line tool, or before the tool invocation is executed by the local tool protocol server, and does not return the plaintext of the sensitive data to the external model or ordinary AI Agent running component.

[0022] The system retrieves cryptographic configuration files from a locally trusted and integrity-protected cryptographic configuration registration system. Each cryptographic configuration file includes a cryptographic configuration identifier, cryptographic configuration version, security level, key version, and algorithm configuration information for key protection, data encryption, and integrity authentication. Based on the local execution policy, and considering the secret type of sensitive data, target tool, target parameter location, expected confidentiality period, and format constraints, a corresponding cryptographic configuration file is selected for each authorized tool and parameter location combination. The selected cryptographic configuration identifier, cryptographic configuration version, security level, and key version are further bound to the corresponding protected execution reference. External models have no right to modify the cryptographic configuration registration information or select or downgrade the cryptographic configuration for the protected execution reference. Before parsing the protected execution reference, the system verifies the consistency between the cryptographic configuration contained in the reference and the cryptographic configuration registration information, and checks whether it meets the anti-downgrade requirements relative to the locally stored trusted baseline version. When the cryptographic configuration version, key version, security level, or algorithm availability status changes, protected execution references that do not conform to the currently valid cryptographic configuration are invalidated, and protected execution references are regenerated according to the currently valid cryptographic configuration.

[0023] S2. Obtain the task context data of the AI ​​agent, identify sensitive data in the task context data, assign logical secret identifiers to the sensitive data, and encrypt and store the sensitive data within the local trusted boundary. Task context data includes at least one of user sessions, uploaded files, persistent memory, session summaries, search results, messages between AIAgents, and tool-returned data; it records the genealogical relationship between the source data node corresponding to sensitive data and the derived data node generated by the sensitive data, and replaces the derived data to be sent to the external model with one or more corresponding protected execution references according to the genealogical relationship; when it is impossible to accurately locate sensitive segments in the derived data, it protects the derived data as a whole according to the local policy, regenerates the derived data without sensitive data, or prevents the sending of the derived data.

[0024] A three-tiered cryptographic service system consisting of a master key, a key encryption key, and a scope data encryption key is used to encrypt and store the sensitive data, mapping metadata, and reference state. The cryptographic configuration file includes: a national cryptographic configuration that uses SM2 digital signatures, SM2 key exchange protocol, or SM2 public key encryption algorithm to protect lower-level key materials, uses SM3 for digest operation or as a hash component in key derivation function, and uses SM4 authentication encryption mode or a combination of SM4 encryption and independent message authentication code to protect sensitive data and mapping state; a cryptographic configuration that uses RSA-OAEP for key transmission, uses a key negotiation algorithm based on elliptic curve cryptography for key establishment, uses RSA-PSS or ECDSA for digital signatures, uses AES-GCM for authentication encryption, and uses hash functions in the SHA-256 or SHA-3 family for digest operation or key derivation; a post-quantum cryptographic configuration that uses ML-KEM to establish a shared secret and uses ML-DSA or SLH-DSA for digital signatures as needed for authentication; and a hybrid cryptographic configuration.

[0025] S3. Based on the target tool invocation pattern set and the local execution strategy, determine the authorized tool and parameter location combination that allows the use of sensitive data. The authorized tool and parameter location combination is derived from the target tool invocation pattern set that matches the corresponding tool. S4. Generate a corresponding protected execution reference for the combination of authorized tool and parameter location. The protected execution reference has integrity authentication information and is bound to the logical secret identifier, AI Agent identifier, task identifier, execution epoch, checkpoint state summary and target tool identifier and target parameter location in the combination, and does not contain plaintext of sensitive data. The protected execution reference uses a self-contained ciphertext reference or a local mapping index reference, and is further bound to the validity period, maximum number of uses, random number, action type, policy version, and target tool invocation mode mode. When the target parameter position has character set and length constraints, an available character field is defined within the local trusted boundary. A cryptographically secure random source is used to generate a high-entropy random alias that does not contain the sensitive data within the available character field, and the high-entropy random alias is atomically checked and occupied in the local mapping storage. Only when the size of the available character field and the expected number of issuances meet the minimum entropy value and maximum collision probability requirements specified in the current cryptographic configuration version, and the current cryptographic configuration allows the use of the FF1 underlying block cipher, is the high-entropy random alias subjected to a format-preserving transformation using FF1. The adjustment value of FF1 is derived from the deterministic encoding of the AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier, target parameter position, and password configuration version, and the integrity of the transformation result and the binding information is further protected by message authentication code or authentication encryption. For formats containing check bits, only payloads without check bits are subjected to a reserved format transformation, and the check bits are recalculated by the trusted execution control component. The reserved format transformation does not process the plaintext of the sensitive data. When the above conditions are not met, an opaque token, a typed placeholder, or prevention of the generation of the protected execution reference is used instead.

[0026] S5. Replace the sensitive data in the task context data to be sent to the external model with a reference set containing the corresponding protected execution reference, and receive the output of the external model; S6. Parse the output of the external model into a structured action containing the target tool, parameter location, and protected execution references in the reference set, and verify the consistency between the structured action and the corresponding target tool call pattern in the target tool call pattern set, as well as the integrity of the protected execution references, execution context consistency, call permissions, and anti-replay status. S7. When all verifications pass, generate or obtain an idempotent identifier, atomically write it into the pre-commit state of the structured action and reserve one use of the protected execution reference. The protected execution reference is parsed by the trusted tool adapter corresponding to the target tool. Before calling the target tool with the idempotent identifier, sensitive data is filled into the target parameter position through an isolated parameter channel that does not go through the external model context, AI Agent readable logs and command line parameters. If any verification fails, prevent the parsing of the protected execution reference and the execution of the structured action. The pre-submission status, action completion status, execution result summary, and usage status are updated in the local state store with atomic operations. When a task is resumed or migrated, the integrity of the recovery checkpoint is verified. Only structured actions that are determined to be in the pending execution status are generated with new protected execution references according to the current valid cryptographic configuration. Completed actions are kept in the non-executable state, and non-idempotent high-risk actions whose execution status cannot be determined are transferred to manual confirmation or compensation processing. When the cryptographic configuration version, key version, security level, or algorithm availability status changes, protected execution references that do not conform to the current valid cryptographic configuration are invalidated, and execution is not continued with plaintext processing, deactivated algorithms, or cryptographic configurations that are lower than the requirements of the local execution policy.

[0027] S8. Upon completion of a structured action, atomically write the action completion status, execution result summary, and usage status of the protected execution reference; invalidate the protected execution reference when it reaches its maximum usage count, expires, or when a one-time action specified by the local execution policy is completed; and retain the logical secret identifier when the execution status changes due to task retry, breakpoint recovery, or execution migration, invalidate the protected execution reference corresponding to the original execution epoch, and generate a new protected execution reference based on the new execution epoch and the new checkpoint status summary; determine the execution status of the structured action based on the pre-commit status, the execution result query result corresponding to the idempotency identifier, or the protected local execution record, replace the original protected execution reference in the structured action that has not yet been executed with the new protected execution reference, prevent the repeated execution of structured actions that have been executed, and prevent automatic retry when it cannot be determined whether a non-idempotent action has been executed.

[0028] When the first AI Agent delegates a task to the second AI Agent, it generates a derived execution reference with a scope of permissions no greater than the original protected execution reference and a security level no lower than the requirements of the local policy. For delegations that cross independent local trusted boundaries, the sender's trusted execution control component determines the commonly permitted cryptographic configuration based on the certified receiver's cryptographic capability information and the local policies of both parties. Key materials that need to be kept confidential for a long time are protected by configuration using a post-quantum or hybrid key that includes an ML-KEM path. Delegation authorizations that require cross-domain authentication are protected by configuration using a post-quantum signature or a hybrid signature that simultaneously verifies classical signatures and post-quantum signatures.

[0029] Generate audit logs that do not contain plaintext sensitive data; calculate message authentication codes using the audit-specific key to the logical secret identifier or protected execution reference identifier to form audit pseudonyms. Each audit log includes the audit pseudonym, AI Agent identifier, task identifier, target tool identifier, identifier of the cryptographic configuration used, version and key version, policy judgment, execution result, time information, and digest value of the previous audit log; calculate the current digest value according to the predetermined field order and encoding method, and protect the current digest value using the algorithm and audit-specific key specified in the cryptographic configuration; after the cryptographic configuration is deactivated, retain the ability to verify historical audit logs only, or generate migration anchors for the head of the historical audit chain using the currently valid cryptographic configuration.

[0030] This invention also provides a sensitive data protection and local trusted execution system for artificial intelligence agents, comprising: an execution reference generation module for determining the authorized tool and parameter location combination based on a target tool invocation pattern set and a local execution strategy, and generating a binding AI. The protected execution reference, which includes the Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier, and target parameter position, and does not contain plaintext sensitive data, is used. The model interaction and action parsing module sends the protected execution reference and non-sensitive context only to the external model and parses the external model output into structured actions. The policy and verification module verifies the consistency between the structured actions and the corresponding target tool invocation mode, as well as the integrity of the protected execution reference, execution context consistency, invocation permissions, and anti-replay status. The trusted tool adaptation module, after passing all verifications and writing the pre-commit status, fills the parsed sensitive data into the authorization parameter position through the isolated parameter channel before invoking the target tool. The status and audit module atomically updates the pre-commit status, action completion status, execution result summary, and reference usage status. It invalidates the protected execution reference of the original execution epoch during task retry, breakpoint recovery, or execution migration, generates a new protected execution reference based on the new execution epoch and new checkpoint state summary, prevents the repeated execution of executed actions, and prevents automatic retries when it is uncertain whether a non-idempotent action has been executed.

[0031] It also includes a cryptographic configuration management and selection module, used to store integrity-protected cryptographic configuration registration information, select cryptographic configuration files according to local execution policies, bind cryptographic configuration identifiers, cryptographic configuration versions, security levels, and key versions to protected execution references, and perform cryptographic configuration consistency and anti-downgrade verification. The cryptographic configuration files are configured according to the roles of key protection, data encryption, digest or key derivation, digital signatures, and preserved format transformation algorithms, and include at least one of the following: national cryptographic configurations using SM2, SM3, and SM4; cryptographic configurations using RSA-OAEP or elliptic curve cryptography-based key establishment, RSA-PSS or ECDSA digital signatures, AES-GCM authentication encryption, and SHA-256 or SHA-3 family hash functions; post-quantum cryptographic configurations using ML-KEM to establish a shared secret and ML-DSA or SLH-DSA digital signatures; and hybrid cryptographic configurations combining classical and post-quantum algorithm paths respectively. The trusted execution control component uses AI... The Agent skill components, plugins, sidecars, standalone local gateways, local tool services, secure containers, trusted execution environments, or standalone local processes are deployed in at least one of the following forms: password configuration selection, sensitive data parsing, key operations, and target parameter population are performed by a local controlled execution module that is isolated from the ordinary AI Agent running components.

[0032] like Figure 1 As shown, the operational flow of the invention is as follows: S1. Obtain the target tool invocation pattern set from the local trusted tool registration information, and obtain at least one password configuration file with configuration identifier, version, security level and key version from the integrity-protected password configuration registration information.

[0033] S2. Identify sensitive data in the task context, generate logical secret identifiers for the sensitive data, and encrypt and store the sensitive data, mapping metadata, and reference status within the local trusted boundary.

[0034] S3. Based on the target tool invocation mode set, local execution strategy, secret type, target tool, target parameter location, expected confidentiality period and format constraints, determine the authorized tool and parameter location combination and select the corresponding password configuration file.

[0035] S4. Generate a protected execution reference for the authorized combination, which includes the bound AI Agent, task, execution epoch, checkpoint state summary, target tool, parameter location, password configuration identifier, configuration version, security level, and key version.

[0036] S5. Replace sensitive data to be sent to external models with protected execution references, and can replace corresponding derived data according to genealogical relationships.

[0037] S6. Convert the external model output into structured actions and verify the consistency between the structured actions and the corresponding target tool call patterns.

[0038] S7. Verify the integrity of the protected execution reference, execution context, calling permissions, password configuration consistency, anti-degradation status, and anti-replay status.

[0039] S8. After all checks pass, the atomic data is written to the pre-commit status and the number of uses is reserved. The trusted tool adapter binds the sensitive data in plaintext before calling the target tool. If any check fails, parsing and execution will be refused.

[0040] S9. After the action is completed, atomically write the completion status, result summary and reference usage status, and invalidate the reference according to the maximum number of uses, validity period or one-time strategy.

[0041] S10. When a retry, recovery, migration, password configuration migration, or key rotation occurs, the reference to the original execution epoch, original password configuration version, or original key version becomes invalid. A new reference is generated based on the new execution state and the currently valid password configuration. The system then decides to replace, prevent duplication, or stop automatic retrying based on the query results corresponding to the pre-commit status, idempotency flag, or local execution record.

[0042] like Figure 2 As shown, within the local trusted boundary 100, an AI Agent runtime 110, a sensitive data identification and lineage engine 120, a context protection gateway 130, a three-level cryptographic service 140, a policy and verification engine 150, a trusted tool adapter 160, local encrypted storage 170, and a status and audit management system 180 are configured, communicating with the external model service 200 and the target tool or business system 300. Trusted tool registration information and password configuration registration information are stored as protected data of the policy and verification engine 150 in the local encrypted storage 170; the algorithm implementation for password configuration is provided by the three-level cryptographic service 140 or a cryptographic module connected to it. The AI ​​Agent runtime 110 maintains the task status but does not receive sensitive data parsed by the trusted tool adapter. The context protection gateway 130 is responsible for content replacement before model invocation and action parsing after model output. The policy and verification engine 150 verifies the target tool invocation mode and the version, integrity, and rollback prevention status of the password configuration file. Based on the corresponding mode, local execution policy, execution status, and password status, it determines the authorized tool and parameter location combination and its password configuration, and forms a verification conclusion.

[0043] The Sensitive Data Identification and Lineage Engine 120 generates a logical secret identifier for each identified sensitive data item. Source nodes can correspond to user messages, file fragments, memory records, search results, or tool return values; derived nodes can correspond to summaries, task plans, structured fields, command parameters, or downstream AI Agent messages. The system establishes lineage relationship records at the processing nodes that generate derived data, recording at least the parent node, child nodes, relationship type, and sensitivity level. Relationship types include citations, extracts, summaries, format conversions, field splitting, field merging, or tool parameter passing. The system prioritizes establishing relationships based on structured field tags and processing node records; when processing unstructured text, it can combine deterministic tags, content fingerprints, and mapping records before and after generation. Sensitivity levels propagate along the lineage relationship. Derived nodes inherit the highest protection level from their parent nodes, except where local policies allow downgrading based on irreversible aggregation, minimum group size, or manual confirmation. When it is impossible to reverse locate sensitive segments, the system protects the derived data as a whole, regenerates the derived data without sensitive data locally, or prevents the transmission of the derived data to avoid downgrading to plaintext transmission when the genealogical relationship is uncertain.

[0044] like Figure 3 As shown, the three-level cryptographic service 140 includes a master key service 141, a key protection service 142, and a data protection service 143. The master key is used to encapsulate the key encryption key, but does not directly encrypt sensitive data or its mapping metadata. The key encryption key is used to encapsulate the scope data encryption key. The scope data encryption key is used to encrypt sensitive data, mapping metadata, files, memories, checkpoint states, and reference states. The cryptographic configuration registration information specifies the algorithm role, configuration version, security level, key version, and applicable conditions for the above cryptographic operations, and is verified for integrity and rollback prevention by the policy and verification engine 150. The key encryption key is isolated according to the tenant, user, communication channel, or AI Agent security domain. The scope data encryption key can be isolated according to data type, task, execution epoch, or checkpoint. When the upper-level key rotates, the corresponding lower-level key is re-encapsulated; when the scope data encryption key rotates, only the data within its scope is re-encrypted. The encryption record can include the tenant identifier, AI Agent identifier, data scope, logical secret identifier, cryptographic configuration identifier, cryptographic configuration version, and key version as additional authentication data.

[0045] Cryptographic configuration files are combined according to algorithm roles. National cryptographic standards use SM2 digital signatures, SM2 key exchange protocol, or SM2 public-key encryption algorithm to protect lower-level key materials; SM3 is used for digest operations or as a hash component in the key derivation function; and SM4 authentication encryption mode or a combination of SM4 encryption and independent message authentication codes is used to protect sensitive data and mapping states. Cryptographic configurations based on RSA, Elliptic Curve Cryptography (ECC), AES, and SHA family algorithms use RSA-OAEP for key transmission, ECC-based key negotiation algorithm for key establishment, RSA-PSS or ECDSA for digital signatures, AES-GCM for authentication encryption, and one hash function from the SHA-256 or SHA-3 family. Post-quantum cryptographic configurations use ML-KEM to establish a shared secret and ML-DSA or SLH-DSA for digital signatures as needed for authentication. Hybrid key establishment configurations obtain shared secrets for classical and post-quantum algorithms respectively, and input the algorithm identifier, parameter set, execution context, and shared secret into the key derivation function after predefined encoding to generate a session key. The hybrid signature configuration generates both a classical signature and a post-quantum signature for the same deterministic encoded message, and authentication is only considered successful when all required signatures pass verification. The local execution policy selects the cryptographic configuration based on the secret type, target tool, target parameter location, applicable specifications, expected confidentiality period, computational resources, and algorithm availability. External models cannot change the local selection by submitting algorithm names or parameters. Local encrypted storage can store key encapsulation information, cryptographic configuration registration information, sensitive data ciphertext and its policy association, the genealogical relationship between source and derived data, the context binding state of execution references, and audit chain records. Various records can include identification information, scope information, ciphertext or digest, version information, status information, and integrity verification information. The specific data organization format can be determined based on the storage medium and deployment environment.

[0046] like Figure 4As shown, protected execution references represent local sensitive data in a context visible to the external model. Before generating references, the policy and verification engine 150 verifies the version and integrity authentication information of each mode in the target tool invocation mode set, and determines the authorized tool and parameter location combination based on the corresponding mode and local execution policy. When sensitive data can be legally used by multiple tools or multiple parameter locations, the system can generate protected execution references for each authorized combination, replacing the sensitive data with the reference set; the system can also generate protected execution references bound to a set of authorized combinations that have been integrity protected. Protected execution references are bound to at least the logical secret identifier, AI Agent identifier, task identifier, execution epoch, checkpoint state digest, target tool identifier, target parameter location, password configuration identifier, password configuration version, security level, and key version, and provide integrity authentication through authentication encryption, message authentication code, or digital signature. Since the authorized combination and password configuration are determined by local trusted information before model invocation, the external model can only select combinations that have been authorized and have corresponding references, and cannot expand permissions or reduce security levels by changing tools, parameter locations, algorithm names, or configuration versions.

[0047] Self-contained ciphertext references encode the binding information into the payload and then encrypt the entire dataset. Locally mapped index references use high-entropy random aliases, and the aliases are atomically checked and stored in local encrypted storage. When the target parameter position has character set and length constraints, FF1 is used to perform a preserved format transformation on the high-entropy random aliases only when the available character fields and the expected number of signatures meet the small-field security threshold specified in the current configuration and the current configuration allows FF1 underlying block ciphers. The FF1 adjustment value is derived from the deterministic encoding of the execution context and is used to distinguish the execution context, but does not assume integrity authentication functionality; integrity is provided independently by the authentication encryption of the protected execution reference or the message authentication code. For formats containing check bits, only the payload is transformed and the check bits are recalculated by the trusted component. Preserved format transformations do not process real sensitive data; if the conditions are not met, an opaque token is used instead or generation is prevented. A protected execution reference may contain multiple pieces of information, including the reference version, mode version, password configuration identifier, password configuration version, security level, key version, logical secret identifier, AI Agent identifier, task identifier, execution epoch, checkpoint state digest, target tool identifier, target parameter location, action type, validity period, usage limit, and random number.

[0048] The AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier, target parameter location, password configuration identifier, password configuration version, and key version in the above information are used to form a joint binding between execution and password state; other information can be selected according to the policy. The system can normalize external representations with spaces, escape sequences, or capitalization, but any modifications that lead to inconsistencies in payload, length verification, password configuration consistency, or authentication information will be rejected.

[0049] like Figure 5 As shown, the external model output first enters the action parsing unit, and does not directly enter the command-line interpreter, database driver, browser, or business system. The action parsing unit generates a structured action based on the target tool invocation pattern corresponding to the selected tool in the target tool invocation pattern set. The structured action may include an action identifier, target tool identifier, parameter set, parameter position, protected execution reference, checkpoint status information, and idempotency identifier. Sensitive parameter positions only store protected execution references, and do not store sensitive data in plaintext. Each pattern in the target tool invocation pattern set declares the parameter name, type, sensitive parameter position, allowed secret type, whether echo is allowed, and invocation permissions of the corresponding tool. The pattern set and password configuration registration information are stored in a local trusted registry or policy store, protected by authentication encryption, message authentication code, or digital signature, and have monotonic update or rollback prevention versions. The pattern version carried or referenced by the model output must be consistent with the current valid version of the corresponding local tool; the password configuration version and key version bound to the protected execution reference must also be in a valid state allowed by the current policy.

[0050] For example, the password parameter location in a login tool can accept a protected execution reference of the password type, while query conditions, log parameters, or other unauthorized locations are not allowed to use that reference. Access control will fail if the structured action is inconsistent with the schema, the reference is in the wrong location, or the schema version is inconsistent.

[0051] Integrity verification confirms that the reference has not been tampered with; execution context consistency verification confirms that the AI ​​Agent, task, execution epoch, and checkpoint state digest match; call permission verification confirms that the tool, parameter location, and action type belong to the authorized combination of the reference binding; password configuration consistency and anti-downgrade verification confirm that the configuration identifier, configuration version, security level, key version, and required algorithm path conform to the current local policy; anti-replay verification confirms that the reference has not expired, has not exceeded the usage limit, and has not been consumed repeatedly. Only after all necessary verifications pass does the trusted tool adapter acquire limited parsing capabilities. The trusted tool adapter 160 is a locally controlled implementation of the target tool protocol. Its parsing capabilities are simultaneously limited by the target tool, parameter location, action type, validity period, and usage limit. For web application interfaces, the adapter fills in authentication information, session credentials, request body, or signature calculation input when establishing a protected connection and about to send a request. For databases, the adapter fills in connection credentials before establishing a connection. For browsers, the adapter unidirectionally fills in protected fields and prohibits readback through page scripts, screenshots, page document structure, or tool return values. For command-line tools, the adapter injects via standard input, protected file descriptors, in-process interfaces, or restricted temporary files. For tools using local tool protocols, the adapter resolves protected execution references in the local tool protocol server or tool gateway. The isolated parameter channel bypasses external model context, logs readable by ordinary AI Agents, and command-line argument lists. Upon completion of the call, the adapter releases relevant plaintext data, deletes short-lived temporary files, and returns only the policy-filtered execution results.

[0052] like Figure 6 As shown, the logical secret identifier can remain stable throughout the lifecycle of sensitive data, while the protected execution reference changes with the execution epoch. Figure 6 In this context, E1 and E2 represent the original execution epoch and the new execution epoch, respectively; R1 and R2 represent the original protected execution reference and the new protected execution reference, respectively; and CP1 and CP2 represent the original checkpoint state summary and the new checkpoint state summary, respectively. During initial execution, the initial state summary generated based on the task's initial state can be used as the checkpoint state summary.

[0053] Before an action is executed, the Status and Audit Management 180 query the action status using the action identifier or idempotency identifier. A pre-commit status is written within the same local status transaction, reserving one reference usage count. Then, the trusted tool adapter, carrying the idempotency identifier, invokes the target tool. After the action is executed, the action completion status, execution result summary, and reference usage status are atomically written within another local status transaction. References become invalid only when the maximum usage count is reached, the validity period expires, or a one-time action as defined by the local policy is completed.

[0054] When a task is resumed or migrated, the state management unit first verifies the integrity and origin of the recovery checkpoint, then generates a new execution epoch and a new checkpoint state digest, invalidating all protected execution references corresponding to the original execution epoch. When password configuration is migrated, keys are rotated, security levels are increased, or algorithms are deactivated, the state management unit simultaneously invalidates references bound to the original password configuration version, the original key version, or those that do not meet the new security level. The system reads the action status and only generates new references for actions in the pending execution state according to the currently valid password configuration, replacing the original references; for actions in the completed state, the completion record is retained without generating new references.

[0055] If the target tool has already generated an execution result but the local completion status update is interrupted, the recovery process determines whether the action has been completed based on the idempotency flag accepted by the target tool, the execution result query interface, or the protected local pre-commit records. If it is determined that the action has been completed, the completion status is written instead of being executed again. If it is determined that the action has not been executed, a new reference is generated. If it cannot be determined, automatic retrying of non-idempotent high-risk actions is stopped and manual confirmation or compensation processing is initiated.

[0056] Upstream AI Agents do not transmit sensitive data in plaintext or previously protected execution references to downstream AI Agents. Trusted execution control components generate derived execution references with permission scopes no greater than those of their parent references. When crossing mutually independent local trusted boundaries, the sender determines a mutually permitted cryptographic configuration based on the authenticated receiver's cryptographic capabilities and both parties' local policies; long-term confidential key materials are configured using post-quantum or hybrid keys that include ML-KEM paths, and cross-domain delegation authorization uses post-quantum signatures or hybrid signature configurations that simultaneously verify classical and post-quantum signatures.

[0057] The scope of a derived execution reference must not exceed that of its parent reference. When the parent reference is revoked, the corresponding secret is deleted, the task is terminated, or the execution epoch changes, the state management unit invalidates the derived execution reference based on the parent-child relationship.

[0058] Status and Audit Management 180 generates audit logs that do not contain plaintext sensitive data. It uses a dedicated audit key to calculate message authentication codes using logical secret identifiers or reference identifiers to form audit pseudonyms, preventing low-entropy identifiers from being enumerated or directly associated across tasks. Each log entry must at least represent a record identifier, preamble digest, audit pseudonym, AI Agent identifier, task identifier, tool identifier, password configuration identifier, password configuration version, key version, policy determination, execution result, and time information.

[0059] When generating the first audit record, the system uses a preset initial digest value as the preceding digest. The current record's digest is calculated according to a predetermined field order and encoding method, and authentication information is generated using the algorithm specified in the record's password configuration and the audit-specific key. After a password configuration is deactivated, the system retains the ability to verify historical records only, or uses the currently valid password configuration to generate a migration anchor point at the head of the historical audit chain; deactivated configurations cannot be used for issuing new records. Deleting, inserting, tampering with, swapping records, or replacing configurations will result in inconsistencies in the digest chain or authentication information.

[0060] In the business system login embodiment, the local trusted tool registry pre-stores the login tool's invocation mode, specifying that the username and password parameter positions are allowed to receive corresponding secret types, while the log and query parameter positions are not allowed to receive secrets, and also stores the mode version and integrity authentication information. The password configuration registration information stores national cryptographic standards, international cryptographic standards, and a hybrid classical and post-quantum cryptographic configuration. The system selects the currently valid configuration based on the login tool's deployment region, the expected confidentiality period of the password, and the target parameter format; for example, under the national cryptographic configuration, SM2 is used to protect the key, SM3 to generate a digest or key derivation input, and SM4 to encrypt the password and mapping state; in cross-security domain calls requiring long-term confidentiality, a hybrid classical and post-quantum configuration is used. After the user provides the username and password, the system generates logical secret identifiers for both and encrypts and stores them.

[0061] The policy and verification engines generate protected execution references for the username and password parameters of the login tool, respectively, binding the current execution epoch, checkpoint state digest, password configuration version, and key version. If the username parameter must maintain a predetermined character set and length, the system can perform an FF1 format-preserving transformation on the alias after meeting the small-field security threshold specified in the current password configuration and atomically occupying a random alias. The FF1 adjustment value is only used to distinguish the execution context; the integrity of the reference is further protected by a message authentication code or authentication encryption. The real username does not participate in this transformation. The context sent to the external model only contains the above references.

[0062] If the task resumes from the checkpoint after the login action is completed, the system invalidates the references to the original execution epoch. For login actions already recorded as completed, no new references are generated and logins are not repeated; for login actions in the pre-commit state, the system confirms the execution result through the result query corresponding to the idempotent flag or protected local records; a new reference is generated only if it is determined that the action has not yet been executed, and automatic retries are stopped if it cannot be determined. For subsequent actions that have not yet been executed, new references are generated based on the new execution epoch and the new checkpoint state summary. The original reference, even if it still exists in the model context, cache, or incomplete actions, will be rejected due to inconsistent execution states.

[0063] In the file and memory implementation, the system encrypts and stores a file containing the server address, administrator account, and access token, and records the genealogical relationships between file fragments, session memories, and digests. When constructing the model context, the access token and administrator account are replaced; the digest, for which it cannot be confirmed whether sensitive data has been removed, remains locally. When resuming a session, the system reads the memory locally and re-executes the genealogical query and reference replacement before invoking the external model again.

[0064] When the protected execution reference fails authentication, expires, reaches the maximum usage count, or is located in an incorrect parameter position, parsing and execution are refused. When the integrity verification of the target tool's call pattern set or password configuration registration information fails, version rollback occurs, password configuration is below the security level requirement, or model output is inconsistent with the corresponding pattern, execution is refused. When the model output cannot be converted into a structured action conforming to the tool call pattern, the raw free text is not executed directly. When the cryptographic service is unavailable, key decryption fails, or the required classical or post-quantum algorithm path is unavailable, a failure shutdown state is entered, without downgrading to plaintext processing, disabling algorithms, or low-security configurations. When the available character fields of a preserved format reference do not meet the entropy value or collision probability requirements specified by the local policy, an opaque token, a typed placeholder, or generation is refused; preserved format cryptographic transformations are not performed directly on real sensitive data. When the audit service is temporarily unavailable, high-risk calls are blocked according to the policy, or records are written to the protected local buffer. When the target tool call fails, the exception information only includes the error code and de-identified context, not the sensitive data plaintext. Trusted execution control components can be deployed as AI Agent skill components, protected modules within the AI ​​Agent runtime, standalone local gateways, sidecars, plugins, local tool protocol services, secure containers, or trusted execution environments. When using AI Agent skill components, the skill components trigger tool mode and password configuration verification, while the local controlled execution module completes password configuration selection, sensitive data parsing, key operations, and target parameter filling. Regardless of the deployment form, each component maintains the following functional relationships: local storage of sensitive data, joint binding of execution references with execution context and password state, structured action verification, delayed binding of trusted endpoints, anti-degradation measures, and reference invalidation when execution state or password configuration changes.

[0065] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. A method for sensitive data protection and local trusted execution for artificial intelligence agents, characterized in that, Includes the following steps: S1. Obtain the target tool invocation pattern set from the trusted tool registration information located within the local trusted boundary; S2. Obtain the task context data of the AI ​​agent, identify sensitive data in the task context data, assign logical secret identifiers to the sensitive data, and encrypt and store the sensitive data within the local trusted boundary. S3. Based on the target tool invocation pattern set and the local execution strategy, determine the authorized tool and parameter location combination that allows the use of sensitive data. The authorized tool and parameter location combination is derived from the target tool invocation pattern set that matches the corresponding tool. S4. Generate a corresponding protected execution reference for the combination of authorized tool and parameter location. The protected execution reference has integrity authentication information and is bound to the logical secret identifier, AI Agent identifier, task identifier, execution epoch, checkpoint state summary and target tool identifier and target parameter location in the combination, and does not contain plaintext of sensitive data. S5. Replace the sensitive data in the task context data to be sent to the external model with a reference set containing the corresponding protected execution reference, and receive the output of the external model; S6. Parse the output of the external model into a structured action containing the target tool, parameter location, and protected execution references in the reference set, and verify the consistency between the structured action and the corresponding target tool call pattern in the target tool call pattern set, as well as the integrity of the protected execution references, execution context consistency, call permissions, and anti-replay status. S7. When all verifications pass, generate or obtain an idempotent identifier, atomically write it into the pre-commit state of the structured action and reserve one use of the protected execution reference. The protected execution reference is parsed by the trusted tool adapter corresponding to the target tool. Before calling the target tool with the idempotent identifier, sensitive data is filled into the target parameter position through an isolated parameter channel that does not go through the external model context, AI Agent readable logs and command line parameters. If any verification fails, prevent the parsing of the protected execution reference and the execution of the structured action. S8. When a structured action is completed, atomically write the action completion status, execution result summary, and usage status of the protected execution reference; when the protected execution reference reaches its maximum usage count, expires, or a one-time action specified by the local execution policy is completed, invalidate the protected execution reference; and when the execution status changes due to task retry, breakpoint recovery, or execution migration, retain the logical secret identifier, invalidate the protected execution reference corresponding to the original execution epoch, and generate a new protected execution reference based on the new execution epoch and the new checkpoint status summary. The execution status of structured actions is determined based on the pre-commit status, the execution result query result corresponding to the idempotent flag, or the protected local execution record. The original protected execution reference in the structured actions that have not yet been executed is replaced with a new protected execution reference. The repeated execution of structured actions that have been executed is prevented, and automatic retry is prevented when it cannot be determined whether a non-idempotent action has been executed.

2. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 1, characterized in that, In step S1, the trusted tool registration information is stored in the trusted tool registry or policy storage within the local trusted boundary. The target tool invocation mode set is verified by the trusted execution control component for version verification, integrity verification, and anti-rollback verification relative to the local trusted baseline version, and external model modification is not allowed. When the protected execution reference is located in an unauthorized parameter position, the mode version of the target tool invocation mode is inconsistent, or the model output cannot be converted into a structured action that conforms to the corresponding mode, execution is refused. The trusted tool adapter completes late binding before the application interface request is sent, before the database connection is established, when the protected field is filled in the local browser, in the isolated parameter channel of the command line tool, or before the tool call is executed by the local tool protocol server, and does not return the plaintext of the sensitive data to the external model or ordinary AI Agent running component.

3. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 2, characterized in that, In step S1, a password configuration file is obtained from the password configuration registration information located within the local trusted boundary and protected by integrity. Each password configuration file includes a password configuration identifier, password configuration version, security level, key version, and algorithm configuration information for key protection, data encryption, and integrity authentication. Based on the local execution policy, and combined with the secret type of sensitive data, target tool, target parameter location, expected confidentiality period, and format constraints, a corresponding password configuration file is selected for each authorized tool and parameter location combination. The selected password configuration identifier, password configuration version, security level, and key version are further bound to the corresponding protected execution reference. The external model has no right to modify the password configuration registration information or select or downgrade the password configuration for the protected execution reference. Before parsing the protected execution reference, the consistency between the password configuration contained in the reference and the password configuration registration information is verified, and whether the anti-downgrade requirements are met is verified relative to the locally stored trusted benchmark version. When the password configuration version, key version, security level, or algorithm availability status changes, protected execution references that do not conform to the current valid password configuration are invalidated, and protected execution references are regenerated according to the current valid password configuration.

4. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 1, characterized in that, In step S2, the task context data includes at least one of user sessions, uploaded files, persistent memory, session summaries, retrieval results, messages between AI Agents, and tool return data; the genealogical relationship between the source data node corresponding to the sensitive data and the derived data node generated by the sensitive data is recorded, and the derived data to be sent to the external model is replaced with one or more corresponding protected execution references according to the genealogical relationship; When it is impossible to accurately locate sensitive segments in derived data, the derived data is protected as a whole according to the local policy, the derived data without sensitive data is regenerated, or the transmission of the derived data is prevented.

5. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 4, characterized in that, In step S2, a three-level cryptographic service system consisting of a master key, a key encryption key, and a scope data encryption key is used to encrypt and store the sensitive data, mapping metadata, and reference status. The cryptographic configuration file includes: a national cryptographic configuration that uses SM2 digital signatures, SM2 key exchange protocol or SM2 public key encryption algorithm to protect lower-level key materials, uses SM3 for digest operation or as a hash component in key derivation function, and uses SM4 authentication encryption mode or a combination of SM4 encryption and independent message authentication code to protect sensitive data and mapping state; a cryptographic configuration that uses RSA-OAEP for key transmission, uses a key negotiation algorithm based on elliptic curve cryptography for key establishment, uses RSA-PSS or ECDSA for digital signatures, uses AES-GCM for authentication encryption, and uses hash functions in the SHA-256 or SHA-3 family for digest operation or key derivation; a post-quantum cryptographic configuration that uses ML-KEM to establish a shared secret and uses ML-DSA or SLH-DSA for digital signatures as needed for authentication; and a hybrid cryptographic configuration.

6. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 1, characterized in that, In step S4, the protected execution reference adopts a self-contained ciphertext reference or a local mapping index reference, and is further bound with the validity period, maximum number of uses, random number, action type, policy version, and target tool invocation mode mode. When the target parameter position has character set and length constraints, an available character field is defined within the local trusted boundary. A cryptographically secure random source is used to generate a high-entropy random alias that does not contain the sensitive data within the available character field, and the high-entropy random alias is atomically checked and occupied in the local mapping storage. Only when the size of the available character field and the expected number of issuances meet the minimum entropy value and maximum collision probability requirements specified by the current cryptographic configuration version, and the current cryptographic configuration allows the use of the FF1 underlying block cipher, is the high-entropy random alias subjected to a format-preserving transformation using FF1. The adjustment value of FF1 is derived from the deterministic encoding of the AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier, target parameter position, and password configuration version, and the integrity of the transformation result and the binding information is further protected by message authentication code or authentication encryption. For formats containing check bits, only payloads without check bits are subjected to a reserved format transformation, and the check bits are recalculated by the trusted execution control component. The reserved format transformation does not process the plaintext of the sensitive data. When the above conditions are not met, an opaque token, a typed placeholder, or prevention of the generation of the protected execution reference is used instead.

7. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 1, characterized in that, In step S7, the pre-submission status, action completion status, execution result summary, and usage status are updated in the local state storage with atomic operations. When a task is resumed or migrated, the integrity of the recovery checkpoint is verified. Only structured actions that are determined to be in the pending execution status are generated with new protected execution references according to the current valid cryptographic configuration. Completed actions are kept in the state of not being able to be executed again, and non-idempotent high-risk actions whose execution status cannot be determined are transferred to manual confirmation or compensation processing. When the cryptographic configuration version, key version, security level, or algorithm availability status changes, protected execution references that do not conform to the current valid cryptographic configuration are invalidated, and execution is not continued with plaintext processing, deactivated algorithms, or cryptographic configurations that are lower than the requirements of the local execution policy.

8. The method for sensitive data protection and local trusted execution of artificial intelligence agents according to claim 1, characterized in that, In step S8, when the first AI Agent delegates a task to the second AI Agent, a derived execution reference with a scope of authority no greater than the original protected execution reference and a security level no lower than the local policy requirements is generated. For delegations that cross independent local trusted boundaries, the sender's trusted execution control component determines the commonly allowed cryptographic configuration based on the certified receiver's cryptographic capability information and the local policies of both parties. Key materials that need to be kept confidential for a long time are protected by configuration using a post-quantum or hybrid key that includes an ML-KEM path. Delegation authorizations that require cross-domain authentication are protected by configuration using a post-quantum signature or a hybrid signature that simultaneously verifies classical signatures and post-quantum signatures.

9. The method for sensitive data protection and local trusted execution for artificial intelligence agents according to claim 1, characterized in that, In step S8, an audit record without plaintext sensitive data is generated; an audit pseudonym is formed by calculating a message authentication code using the audit-specific key to the logical secret identifier or the protected execution reference identifier. Each audit record includes the audit pseudonym, AI Agent identifier, task identifier, target tool identifier, identifier of the password configuration used, version and key version, policy judgment, execution result, time information, and digest value of the previous audit record; the current digest value is calculated according to the predetermined field order and encoding method, and the current digest value is protected using the algorithm and audit-specific key specified in the password configuration; after the password configuration is deactivated, the ability to verify historical audit records is retained, or a migration anchor point is generated at the head of the historical audit chain using the currently valid password configuration.

10. A sensitive data protection and local trusted execution system for artificial intelligence agents, characterized in that, include: The execution reference generation module is used to determine the combination of authorized tools and parameter locations based on the target tool invocation pattern set and local execution strategy, and generate a protected execution reference that binds the AI ​​Agent identifier, task identifier, execution epoch, checkpoint state summary, target tool identifier and target parameter location, and does not contain sensitive data plaintext; The model interaction and action parsing module is used to send the protected execution reference and non-sensitive context only to the external model, and parse the output of the external model into structured actions; The strategy and verification module is used to verify the consistency between structured actions and the corresponding target tool call patterns, as well as the integrity of protected execution references, execution context consistency, call permissions, and anti-replay status. The trusted tool adaptation module is used to fill the parsed sensitive data into the authorization parameter position through the isolated parameter channel before calling the target tool after all verifications have passed and the pre-submission status has been written. The status and audit module is used to atomically update the pre-commit status, action completion status, execution result summary, and reference usage status. It also invalidates the protected execution reference of the original execution epoch during task retry, breakpoint recovery, or execution migration, generates a new protected execution reference based on the new execution epoch and the new checkpoint status summary, prevents the repeated execution of already executed actions, and prevents automatic retries when it is uncertain whether a non-idempotent action has been executed.