End-side model tool invocation side effect execution isolation management method and device, electronic equipment and storage medium
By introducing permission isolation and two-level verification mechanisms between the edge-side inference service and the system capability gateway in the artificial intelligence terminal, the problems of permission ambiguity and high risk caused by the edge-side inference service directly executing system operations are solved, and a safe and stable tool calling process is realized.
Patent Information
- Application Number
- CN202611433999.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-11-24
AI Technical Summary
In existing technologies, the edge-side inference service of artificial intelligence terminals is tightly coupled with the execution logic of high-risk system tools, resulting in blurred permission boundaries, risks of accidental triggering and unauthorized operations, and impacting system stability and security when model services or backend tools malfunction.
User request data is obtained through the edge-side inference service, intent recognition and parameter extraction are performed, candidate tool call data is generated, and after pre-verification, it is converted into a structured protocol request. The request is then sent to an independent system capability gateway through the local loopback communication channel for secondary verification and execution, ensuring access control and separation of responsibilities.
It significantly improves system security, avoids the risk of unauthorized access, enhances stability and resource controllability, reduces unnecessary communication overhead, and improves processing efficiency and user experience.
Smart Images

Figure CN123163897A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence terminals and edge computing technology, specifically to a method for obtaining user request data corresponding to the current session through edge-side inference services. Background Technology
[0002] With the widespread adoption of AI-powered devices such as AI-powered smart cash registers and AI-powered smartphones, edge-side large language models (LLMs) are increasingly used to understand user natural language requests and trigger corresponding system operations, such as payments, system settings, and hardware calls. To achieve these functions, edge-side models typically need to have the ability to invoke tools, i.e., generate structured tool call requests.
[0003] However, existing technical solutions often tightly couple model inference services with the execution logic of high-risk system tools. For example, the tool implementation is directly embedded in the model service process, or the model service is placed in a domain with high privileges.
[0004] This type of solution has significant technical drawbacks: because the edge-side inference service directly holds and executes system-level operations, it directly binds uncontrollable model outputs to high-risk system side effects (such as payments and hardware control), resulting in blurred permission boundaries. This not only introduces risks of accidental triggering and unauthorized operations, but also easily affects the stability and security of the main interaction chain when the model service or backend tools are upgraded or encounter anomalies. Especially in resource-constrained environments such as mobile devices, the lack of an effective isolation mechanism can lead to uncontrollable system resource consumption and difficulties in anomaly recovery. Summary of the Invention
[0005] In view of the aforementioned problems, this application is proposed to provide a method, apparatus, electronic device, and storage medium for isolating and controlling the execution of side effects of end-side model tool calls, which overcomes or at least partially solves the aforementioned problems, including: A method for isolating and managing the execution of side effects of edge-side model tool calls, applied to artificial intelligence terminals, includes: Obtain user request data corresponding to the current session through the client-side inference service; The client-side model is invoked to perform intent recognition and parameter extraction on the user request data, generating candidate tool invocation data; The candidate tool call data is pre-validated to obtain the pre-validation result; If the pre-verification result is a successful verification, the candidate tool call data is converted into a structured protocol request and sent to the system capability gateway independent of the end-side inference service through the local loopback communication channel. The system capability gateway is invoked to perform a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and the secondary verification result is obtained. If the secondary verification result is allowed to execute, then the corresponding target system tool is requested to be executed based on the structured protocol, the execution result is obtained, and the execution result is sent back to the end-side inference service through the local loopback communication channel; The execution result is written into the dialogue context of the current session through the edge inference service, and the natural language result corresponding to the user request data is generated and output.
[0006] Further, the candidate tool invocation data includes the tool name, invocation parameters, and session identifier. The step of converting the candidate tool invocation data into a structured protocol request and sending the structured protocol request to a system capability gateway independent of the end-side inference service via a local loopback communication channel includes: The tool name, the call parameters, and the session identifier are encapsulated into a structured protocol request, and the call source identifier is carried in the structured protocol request; The structured protocol request is sent to the system capability gateway through the local loopback communication channel, wherein the end-side inference service and the system capability gateway run in different permission domains of the same artificial intelligence terminal.
[0007] Furthermore, the structured protocol request adopts the JSON-RPC tools / call method format of the Model Context Protocol. The structured protocol request includes a method name field, a parameter field, and a request identifier field, wherein the parameter field carries the tool name and the call parameters.
[0008] Furthermore, the system capability gateway performs a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules to obtain the secondary verification result, including: The system capability gateway is invoked to parse the structured protocol request, thereby obtaining the tool name and invocation source identifier in the structured protocol request; Search the tool registration entry in the tool whitelist that matches the tool name; The call source identifier is authenticated and verified according to the caller rules. If the tool registration item exists and the authentication verification passes, the result of the secondary verification is determined to be "allow execution"; otherwise, the result of the secondary verification is determined to be "reject execution".
[0009] Furthermore, after the system capability gateway performs a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtains the secondary verification result, the process further includes: If the result of the secondary verification is rejection, the system capability gateway is invoked to generate a standard error response containing an error code and error description, and the standard error response is sent back to the end-side inference service through the local loopback communication channel.
[0010] Further, the pre-validation of the candidate tool call data to obtain the pre-validation result includes: The candidate tool call data are subjected to tool type validity verification, parameter integrity verification, and immediate execution intent verification, respectively. If the tool type validity check, the parameter integrity check, and the immediate execution intent check all pass, then the pre-verification result is determined to be a successful check; otherwise, the pre-verification result is determined to be a failed check.
[0011] Furthermore, after pre-validating the candidate tool call data and obtaining the pre-validation result, the method further includes: If the pre-verification result is that the verification fails, then based on the missing fields or abnormal items determined by one or more of the tool type legality verification, the parameter integrity verification, and the immediate execution intent verification, an abnormal result containing clarification inquiry information and / or refusal to execute prompt information is generated. The abnormal result is output as the response corresponding to the user request data in the current session, and the forwarding process of the structured protocol request is terminated, without sending the structured protocol request to the system capability gateway.
[0012] A device for isolating and controlling the execution of side effects of edge-side model tool calls, applied to an artificial intelligence terminal, characterized in that it includes: The acquisition module is used to obtain user request data corresponding to the current session through the client-side inference service; The generation module is used to call the client-side model to perform intent recognition and parameter extraction on the user request data, and generate candidate tool call data; The pre-verification module is used to pre-verify the candidate tool call data and obtain the pre-verification result; The conversion module is used to convert the candidate tool call data into a structured protocol request if the pre-verification result is a verification pass, and send the structured protocol request to the system capability gateway independent of the end-side inference service through the local loopback communication channel. The secondary verification module is used to call the system capability gateway to perform secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtain the secondary verification result; The execution module is used to request the execution of the corresponding target system tool based on the structured protocol if the secondary verification result is allowed to execute, obtain the execution result, and send the execution result back to the end-side inference service through the local loopback communication channel; The output module is used to write the execution result into the dialogue context of the current session through the end-side inference service, and generate and output the natural language result corresponding to the user request data.
[0013] A computer electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When executed by the processor, the computer program implements the steps of the side effect execution isolation control method of the end-side model tool call as described above.
[0014] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the side-effect execution isolation control method as described above for the end-side model tool invocation.
[0015] This application has the following advantages: In the embodiments of this application, addressing the existing problem of "ambiguous permissions, high risk, and poor stability due to direct control of system operations by AI terminals via edge-side inference services," this application provides a solution to "isolate and manage tool call intentions generated by the edge-side model from system side effects." Specifically, this involves: "obtaining user request data corresponding to the current session through the edge-side inference service; calling the edge-side model to perform intent recognition and parameter extraction on the user request data to generate candidate tool call data; pre-verifying the candidate tool call data to obtain a pre-verification result; if the pre-verification result is a pass, converting the candidate tool call data into a structured protocol request, and..." The structured protocol request is sent to a system capability gateway independent of the edge-side inference service via a local loopback communication channel. The system capability gateway performs a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, obtaining a secondary verification result. If the secondary verification result allows execution, the corresponding target system tool is executed based on the structured protocol request, obtaining an execution result, and the execution result is sent back to the edge-side inference service via the local loopback communication channel. The edge-side inference service writes the execution result into the dialogue context of the current session, generating and outputting the natural language result corresponding to the user request data. This application effectively solves the problems of ambiguous permissions, high risk, and poor stability in artificial intelligence terminals caused by the edge-side inference service directly controlling system operations by strictly separating responsibility and isolating permissions for tool call generation and execution, and introducing local loopback communication and a two-level verification mechanism. Specifically, the edge-side inference service is only responsible for generating structured candidate tool call data and performing pre-verification, and does not perform any high-risk system operations itself, thus following the principle of least privilege. System side effects are executed by a system capability gateway running independently in a high-privilege domain, after secondary verification based on tool whitelists and caller rules. This design, combined with a local loopback communication channel, ensures low latency and reliability of intent transmission while physically isolating low-privilege inference processes from high-privilege system operations. Through a series of synergistic technical features, the following beneficial effects are achieved: significantly improved system security, avoiding the risk of unauthorized access due to uncertain model output; enhanced system stability, as the decoupling of the end-side inference service from system tool execution ensures that anomalies or upgrades on either side will not directly interrupt the main interaction link; improved resource controllability, with structured protocols and verification mechanisms making resource consumption predictable and manageable. Furthermore, by pre-verifying candidate tool call data, invalid requests with incomplete parameters or unclear intents can be intercepted in advance, reducing unnecessary communication overhead and gateway load, further improving processing efficiency and user experience. Attached Figure Description
[0016] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the steps of an edge-side model tool call side effect execution isolation and control method according to an embodiment of this application; Figure 2 This is a structural block diagram of a device for isolating and controlling the execution of side effects of end-side model tool calls, provided in an embodiment of this application. Figure 3 This is a schematic diagram of the structure of a computer electronic device provided in an embodiment of the present invention; 1. A computer electronic device; 2. An external device; 3. A processing unit; 4. A bus; 5. A network adapter; 6. An I / O interface; 7. A display; 8. Memory; 9. Random access memory; 10. A cache memory; 11. A storage system; 12. A program / utility; 13. A program module. Detailed Implementation
[0018] To make the objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0019] The side effect execution isolation and control method for edge-side model tool calls provided in this application is applicable to the operating environments of various artificial intelligence terminals. These artificial intelligence terminals include, but are not limited to, AI smart cash registers, AI smart cash register tablets, AI smart POS machines, AI smartphones, AI smart handheld terminals, AI tablets, and other smart terminal devices with local model inference capabilities, AIAgent orchestration capabilities, or system capability gateways. On such terminals, the edge-side inference service runs in a low-privilege domain, responsible for natural language understanding and generating tool call intents; the system capability gateway runs in a high-privilege domain, responsible for controlled execution of operations with system side effects, such as payment, input, system settings, and peripheral control. The two establish a connection through a local loopback communication channel, forming a closed loop for edge-side tool calls with isolated permissions.
[0020] It should be noted that, for ease of understanding of the technical solution of this application, the following explanations are provided for the key terms involved in the embodiments of this application: Edge-side inference service refers to the model inference service process that runs locally on the AI terminal. It is responsible for understanding user requests and generating structured tool call data, but it does not have the ability to directly execute system-level operations.
[0021] The system capability gateway refers to a high-privilege local gateway process that runs independently of the end-side inference service and is responsible for verifying and executing system side effect operations under controlled conditions.
[0022] Candidate tool call data refers to structured data generated by the edge model after identifying the intent and extracting parameters of the user request, which has not yet been verified. It represents the intent of the tool call to be executed by the model.
[0023] A structured protocol request is a request message that encapsulates candidate tool call data according to a preset protocol format and can be transmitted in a standardized manner between different processes.
[0024] A tool whitelist is a set of registration information maintained by the system capability gateway to specify which tools are allowed to be invoked.
[0025] Caller rules refer to the rule information maintained by the system capability gateway side for authenticating and verifying the identity of the caller who initiates the call request.
[0026] Pre-verification refers to the local verification process performed by the edge-side inference service before sending candidate tool call data outwards.
[0027] Secondary verification refers to a gateway-side verification process that is independent of pre-verification, performed by the system capability gateway after receiving a structured protocol request.
[0028] A local loopback communication channel refers to a local communication link within the same artificial intelligence terminal that enables data communication between different processes or different permission domains.
[0029] Reference Figure 1 This application illustrates a method for isolating and managing the execution of side effects of edge model tool calls, provided in an embodiment of this application. This method is applied to an artificial intelligence terminal and specifically includes: S101. Obtain the user request data corresponding to the current session through the client-side inference service; S102. The client-side model is invoked to perform intent recognition and parameter extraction on the user request data to generate candidate tool invocation data; S103. Perform pre-verification on the candidate tool call data to obtain the pre-verification result; S104. If the pre-verification result is a successful verification, the candidate tool call data is converted into a structured protocol request, and the structured protocol request is sent to the system capability gateway independent of the end-side inference service through the local loopback communication channel. S105. The system capability gateway is invoked to perform a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and the secondary verification result is obtained. S106. If the secondary verification result is allowed to execute, then the corresponding target system tool is requested to be executed based on the structured protocol to obtain the execution result, and the execution result is sent back to the end-side inference service through the local loopback communication channel. S107. The execution result is written into the dialogue context of the current session through the terminal inference service, and the natural language result corresponding to the user request data is generated and output.
[0030] In the embodiments of this application, the above steps work collaboratively. The edge-side inference service is only responsible for understanding user intent, generating structured candidate tool call data, and performing local pre-verification. It does not directly execute any operations with system side effects in the entire processing chain. The system capability gateway, as a high-privilege process independent of the edge-side inference service, is responsible for tool whitelist verification, caller authentication, and execution of target system tools. Data is transmitted between the two through a local loopback communication channel, which forcibly isolates the model inference logic of the low-privilege end from the system side effect execution logic of the high-privilege end at process and permission boundaries. From the perspective of the overall data flow, user request data is first parsed and structured in the low-privilege domain, and then crosses the permission boundary into the high-privilege domain in the form of a structured protocol request. After secondary verification, the system capability gateway executes the specific system operation, and the execution result flows back to the edge-side inference service along the local loopback communication channel and is incorporated into the dialogue context. This closed-loop design effectively avoids uncontrollable model output directly affecting high-risk system operations, thereby ensuring that the entire edge-side tool call chain is implementable, verifiable, and reproducible, while achieving mandatory isolation and control of side effect execution.
[0031] As a specific implementation, the edge-side inference service can carry the inference capabilities of a large language model through a local model service process, while the system capability gateway can run in a high-privilege environment with system-level permission identifiers (such as a pre-built application environment with system user identifiers). The two communicate via a local loopback protocol. The edge-side inference service maintains the session context locally, inputting the user's natural language request along with the current session's dialogue context into the edge-side model for inference. The edge-side model determines whether a tool call request exists based on intent recognition, and if so, performs parameter extraction, producing candidate tool call data containing the tool name, call parameters, and session identifier. Subsequently, the edge-side inference service performs pre-validation on this candidate tool call data; only data that passes pre-validation is further encapsulated into a structured protocol request. For example, in an AI-powered smart POS device, when a user says "payment 12.8 yuan," the edge-side inference service, through the edge-side model, recognizes this as a payment tool call intent, extracts the amount parameter "12.8 yuan" and the payment mode parameter, and then generates candidate tool call data for the payment tool. After pre-verification, the data is converted into a structured protocol request and sent to the system capability gateway via the local loopback communication channel. The system capability gateway, after secondary verification confirming that the tool is on the whitelist and that the calling source authentication is successful, invokes the payment opening tool to trigger the payment interface. The execution result is then sent back to the client-side inference service and written into the dialogue context, ultimately outputting a natural language confirmation result to the user. Throughout this process, the client-side inference service never directly interacts with the payment interface opening operation; the payment side effects are entirely controlled and executed by the system capability gateway within a high-privilege domain.
[0032] This application's embodiments effectively solve the problems of ambiguous permissions, high risk, and poor stability caused by the direct control of system operations by the edge-side inference service in AI terminals by strictly separating responsibility and isolating permissions for tool call generation and execution, and introducing local loopback communication and a two-level verification mechanism. Specifically, the edge-side inference service is only responsible for generating structured candidate tool call data and performing pre-verification, and does not perform any high-risk system operations itself, thus adhering to the principle of least privilege. System side effects are executed by the system capability gateway, which runs independently in a high-privilege domain, after secondary verification based on the tool whitelist and caller rules. This design, combined with the local loopback communication channel, ensures low latency and reliability of intent transmission, while physically isolating the low-privilege inference process from the high-privilege system operations. Through the synergistic effect of a series of technical features, the following beneficial effects are achieved: significantly improved system security, avoiding the risk of unauthorized access due to uncertain model output; enhanced system stability, because the decoupling of the edge-side inference service and system tool execution ensures that anomalies or upgrades of either party will not directly interrupt the main interaction link; and improved resource controllability, as the structured protocol and verification mechanism make resource consumption predictable and manageable. Furthermore, by pre-validating the data called by candidate tools, invalid requests with incomplete parameters or unclear intent can be intercepted in advance, reducing unnecessary communication overhead and gateway load, and further improving processing efficiency and user experience.
[0033] The method for isolating and controlling the execution of side effects of end-side model tool calls in this exemplary embodiment will be further explained below.
[0034] In one embodiment of the present invention, the candidate tool invocation data includes the tool name, invocation parameters and session identifier. The specific process of step S104, "converting the candidate tool invocation data into a structured protocol request and sending the structured protocol request to the system capability gateway independent of the end-side inference service through the local loopback communication channel", can be further explained in conjunction with the following description.
[0035] As described in the following steps, the tool name, the calling parameters, and the session identifier are encapsulated into the structured protocol request, and the calling source identifier is carried in the structured protocol request; the structured protocol request is sent to the system capability gateway through the local loopback communication channel, wherein the end-side inference service and the system capability gateway run in different permission domains of the same artificial intelligence terminal.
[0036] In this embodiment, the tool name is used to uniquely identify the target system tool, the call parameters describe the parameter values required to execute the target system tool, the session identifier is used to associate the current tool call request with the current session context, and the call source identifier is used to authenticate the initiator on the system capability gateway side. The encapsulated structured protocol request carries both business information and session location information before crossing the permission boundary, enabling the system capability gateway to fully trace the call chain during subsequent secondary verification and tool execution. The edge-side inference service and the system capability gateway run in different permission domains of the same artificial intelligence terminal. This design means that model inference activities are constrained within the low permission domain, and tool execution capabilities are constrained within the high permission domain. The permission boundary corresponds one-to-one with the process boundary, thereby implementing the constraint condition of side-effect execution isolation at the physical level. This approach brings significant benefits: even if the edge-side model generates abnormal or malicious tool call intentions, the edge-side inference service itself cannot directly execute the system tool. It must enter the system capability gateway for secondary verification through the local loopback communication channel. The single exit characteristic of permissions fundamentally suppresses the risk of unauthorized execution. As a specific implementation, the edge inference service can run in a low-privilege sandbox application environment, while the system capability gateway acts as a high-privilege pre-built application and interacts with the system capability module in a controlled manner. Both reside on the same artificial intelligence terminal and complete cross-permission domain data transmission through a local loopback communication channel, avoiding additional latency and leakage risks via external networks.
[0037] In one embodiment of the present invention, the structured protocol request adopts the JSON-RPCtools / call method format of the Model Context Protocol. The structured protocol request includes a method name field, a parameter field, and a request identifier field, wherein the parameter field carries the tool name and the call parameters.
[0038] In this embodiment, the method name field identifies the request as a `tools / call` method, the parameter field carries the specific tool name and call parameters, and the request identifier field is used to locate the corresponding request in the subsequent response message. The model context protocol provides a standardized message structure for interaction between the client-side inference service and the system capability gateway, while JSON-RPC provides a lightweight and easily parsed encoding convention for remote procedure calls. The combination of these two ensures that the semantics and format of cross-process communication are clearly verifiable. This approach offers significant advantages: due to the standardized message format, the system capability gateway can parse requests from the client-side inference service without relying on specific development frameworks or proprietary protocols, reducing the coupling and maintenance costs of the communication link, and providing a foundation for interoperability between different model services and different Agent frameworks. As a specific implementation, the client-side inference service can set up a dedicated protocol client component to construct `tools / call` messages according to the JSON-RPC format and send them to the local loopback address of the system capability gateway; the system capability gateway can set up a corresponding protocol distribution component to parse the method name field, extract the tool name and call parameters from the parameter field, and organize the return of the response message according to the request identifier field.
[0039] In one embodiment of the present invention, the specific process of step S105, "calling the system capability gateway to perform secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtaining the secondary verification result," can be further explained in conjunction with the following description.
[0040] As described in the following steps, the system capability gateway is invoked to parse the structured protocol request to obtain the tool name and call source identifier in the structured protocol request; a tool registration item matching the tool name is searched in the tool whitelist; the call source identifier is authenticated and verified according to the caller rules; if the tool registration item exists and the authentication and verification pass, the secondary verification result is determined to be allowed to execute; otherwise, the secondary verification result is determined to be refused to execute.
[0041] In this embodiment, the secondary verification includes two dimensions: tool legitimacy verification and call source authentication verification. The tool whitelist maintains registration information for tools that are allowed to be called. After parsing the tool name, the system capability gateway first checks if a corresponding tool registration entry exists in the whitelist. If not, the tool call intent belongs to an unregistered capability and should be rejected. The caller rules specify which call source identifiers are authorized to initiate tool call requests to the system capability gateway, and the system capability gateway uses this to authenticate the call source. Only when both conditions are met—the tool registration entry exists and the authentication verification passes—is the secondary verification result determined as allowing execution. This approach offers significant advantages: it establishes an authoritative verification checkpoint independent of the client-side inference service on the high-privilege side. Even if the pre-verification in the low-privilege domain is bypassed or misjudged due to abnormal model behavior, the system capability gateway can still intercept requests based on its own whitelist and caller rules, forming a defense-in-depth isolation system. As a specific implementation method, the tool whitelist can be indexed by tool name, and each tool registration item can also contain corresponding parameter rules. While searching for tool registration items, the system capability gateway can further verify whether the calling parameters conform to the parameter rules of the tool, thus constraining the triggering conditions of side effects execution from both the tool and parameter dimensions.
[0042] In one embodiment of the present invention, the specific features of the "side effect execution isolation and control method of end-side model tool call" after step S105 can be further described in conjunction with the following description.
[0043] As described in the following steps, if the result of the secondary verification is a rejection, the system capability gateway is invoked to generate a standard error response containing an error code and an error description, and the standard error response is sent back to the end-side inference service through the local loopback communication channel.
[0044] In this embodiment, when the system capability gateway determines that the secondary verification has failed, it does not simply discard the request, but generates a structured standard error response. This standard error response includes an error code and an error description. The error code identifies the specific reason for the refusal to execute, and the error description provides readable supplementary information. After the standard error response is transmitted back to the edge-side inference service along the local loopback communication channel, the edge-side inference service can update the session context and output corresponding prompts to the user. This approach offers significant advantages: abnormal paths are also incorporated into the standardized protocol processing flow, allowing the caller to accurately perceive the reason for the request rejection, avoiding the black-box problem of interaction and repeated invalid calls caused by missing error information. As a specific implementation, error codes can be categorized into tool unregistered, unauthorized call source, parameters not conforming to rules, execution timeout, etc. After receiving the standard error response, the edge-side inference service can decide whether to output a clarification query to the user, provide alternative suggestions, or directly terminate the current tool call process based on the error code.
[0045] In one embodiment of the present invention, the specific process of "pre-verifying the candidate tool call data and obtaining the pre-verification result" in step S103 can be further explained in conjunction with the following description.
[0046] As described in the following steps, the candidate tool call data is subjected to tool type validity verification, parameter integrity verification, and immediate execution intent verification respectively; if the tool type validity verification, parameter integrity verification, and immediate execution intent verification all pass, the pre-verification result is determined to be verification passed; otherwise, the pre-verification result is determined to be verification failed.
[0047] In this embodiment, the tool type validity check determines whether the tool type specified in the candidate tool call data belongs to one of the tool categories authorized for request by the end-side inference service; the parameter integrity check checks whether all required parameter fields in the candidate tool call data are complete and whether their values are reasonable; and the immediate execution intent check determines whether the user's current request truly expresses the intention to immediately execute the tool operation, rather than merely mentioning the relevant tool in a consultation, inquiry, or hypothetical statement. The three checks are performed sequentially, and the pre-check result is determined to be valid only when all checks pass. This approach offers significant advantages: by performing thorough local checks before the request leaves the low-privilege domain, most invalid, incomplete, or ambiguous tool call requests can be intercepted at the source of the data flow, significantly reducing invalid traffic on the local loopback communication channel and the verification burden on the system capability gateway side, while also avoiding the risk of ambiguous intents being directly sent to the high-privilege domain. As a specific implementation method, for payment tool calls, parameter integrity verification can require the existence of explicit amount parameters and explicit expression of payment intention; for cases where the amount appears in the consultation text but lacks an immediate payment intention, the immediate execution of intention verification will be judged as failing, thereby preventing consultation content from being mistakenly triggered to generate payment operations.
[0048] In one embodiment of the present invention, the specific features of the "side effect execution isolation and control method for end-side model tool calls" after step S103 can be further described in conjunction with the following description.
[0049] As described in the following steps, if the pre-verification result is a verification failure, an abnormal result containing clarification query information and / or refusal to execute prompt information is generated based on the missing fields or abnormal items determined by one or more of the tool type legality verification, the parameter integrity verification, and the immediate execution intent verification; the abnormal result is output as the response corresponding to the user request data in the current session, and the forwarding process of the structured protocol request is terminated, and the structured protocol request is not sent to the system capability gateway.
[0050] In this embodiment, when pre-verification fails, the edge-side inference service will not proceed to the subsequent protocol conversion and transmission process. Instead, it will directly generate an exception result in the current session and output it to the user. The specific content of the exception result depends on the specific verification item that failed in the pre-verification: if it fails due to incomplete parameters, the exception result may include clarification queries to guide the user to supplement the missing required parameters; if it fails due to an invalid tool type or intent verification failure, the exception result may include a refusal to execute message to inform the user that the current request cannot trigger the corresponding system operation. By directly terminating the forwarding process of structured protocol requests under the condition of pre-verification failure, it can be ensured that any candidate tool call data that has not been pre-verified cannot reach the system capability gateway. This approach can bring significant benefits: on the one hand, it ensures that all requests received by the system capability gateway have undergone a basic round of legality screening, reducing the possibility of high-privilege domains being interfered with by invalid or improper requests; on the other hand, for the user, the exception result is output as a response in the current session, with timely and clear interactive feedback, avoiding the phenomenon of long periods of no response or delayed erroneous responses after the request is sent. When an abnormal result includes clarification queries, the edge-side inference service can guide the user to provide supplementary explanations for missing fields or abnormal items. Upon receiving the supplemented user request data, the edge-side inference service will re-execute the intent recognition, parameter extraction, and pre-validation processes. When an abnormal result includes a rejection message, the edge-side inference service can explicitly inform the user in the current session that the request is not allowed to be executed, avoiding misunderstandings about the operation results.
[0051] As can be seen from the above embodiments, the side effect execution isolation and control method for end-side model tool calls provided in this application manages the generation, pre-verification, protocol conversion, gateway secondary verification, high-privilege execution, and result feedback of candidate tool call data as a complete closed loop at the data flow level. The end-side inference service is only responsible for generating structured tool call intents and performing pre-verification locally. The system capability gateway independently undertakes the responsibilities of tool whitelist verification, caller authentication, and target system tool execution. The two are connected through a local loopback communication channel, forming a mandatory boundary between low-privilege model inference and high-privilege side effect execution at the permission domain level. This boundary ensures that there is always an independent, verifiable gateway link with authoritative decision-making capabilities between the generation of the request and the actual triggering of system side effects, achieving effective isolation between end-side model tool call intents and high-risk system operation execution. From a stability perspective, since requests are not directly bound to volatile backends or system capabilities, but rather undergo intermediate coordination, gateway verification, and controlled execution, backend switching, process restarts, or resource releases will not directly disrupt the user interface and interaction chain. From a security perspective, since system side effects and high-risk tools are centrally verified and executed by a high-privilege system capability gateway, low-privilege model services or agents will not directly obtain system privileges, fundamentally suppressing the risk of unauthorized execution. From an observability perspective, progress information, error information, and final results generated during execution are all returned along the local loopback communication channel through standardized data structures, allowing the caller to identify the current verification, execution, rejection, or completion status. From a resource efficiency perspective, pre-verification completes a round of early interception of invalid requests within the low-privilege domain, and the standardized format of structured protocol requests makes communication overhead predictable and manageable. The overall design meets the low-latency and low-overhead operation requirements of AI terminals under resource-constrained conditions.
[0052] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0053] Reference Figure 2 This illustration shows a device 200 for isolating and controlling the execution side effects of edge model tool calls according to an embodiment of this application. This device is used to implement the method for isolating and controlling the execution side effects of edge model tool calls provided in this embodiment. The device is applied to an artificial intelligence terminal and specifically includes: The acquisition module 201 is used to obtain user request data corresponding to the current session through the client-side inference service; The generation module 202 is used to call the terminal model to perform intent recognition and parameter extraction on the user request data, and generate candidate tool call data; The pre-verification module 203 is used to pre-verify the candidate tool call data and obtain the pre-verification result; The conversion module 204 is used to convert the candidate tool call data into a structured protocol request if the pre-verification result is a verification pass, and send the structured protocol request to the system capability gateway independent of the end-side inference service through the local loopback communication channel. The secondary verification module 205 is used to call the system capability gateway to perform secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtain the secondary verification result; The execution module 206 is used to request the execution of the corresponding target system tool based on the structured protocol if the secondary verification result is allowed to execute, obtain the execution result, and send the execution result back to the end-side inference service through the local loopback communication channel; The output module 207 is used to write the execution result into the dialogue context of the current session through the end-side inference service, and generate and output the natural language result corresponding to the user request data.
[0054] In one embodiment of the present invention, the candidate tool invocation data includes a tool name, invocation parameters, and a session identifier, and the conversion module 204 is further configured to: The tool name, the call parameters, and the session identifier are encapsulated into a structured protocol request, and the call source identifier is carried in the structured protocol request; The structured protocol request is sent to the system capability gateway through the local loopback communication channel, wherein the end-side inference service and the system capability gateway run in different permission domains of the same artificial intelligence terminal.
[0055] In one embodiment of the present invention, the structured protocol request adopts the JSON-RPCtools / call method format of the Model Context Protocol. The structured protocol request includes a method name field, a parameter field, and a request identifier field, wherein the parameter field carries the tool name and the call parameters.
[0056] In one embodiment of the present invention, the secondary verification module 205 is further configured to: The system capability gateway is invoked to parse the structured protocol request, thereby obtaining the tool name and invocation source identifier in the structured protocol request; Search the tool registration entry in the tool whitelist that matches the tool name; The call source identifier is authenticated and verified according to the caller rules. If the tool registration item exists and the authentication verification passes, the result of the secondary verification is determined to be "allow execution"; otherwise, the result of the secondary verification is determined to be "reject execution".
[0057] In one embodiment of the present invention, the side effect execution isolation and control device 200 invoked by the end-side model tool is further configured to: If the result of the secondary verification is rejection, the system capability gateway is invoked to generate a standard error response containing an error code and error description, and the standard error response is sent back to the end-side inference service through the local loopback communication channel.
[0058] In one embodiment of the present invention, the pre-verification module 203 is further configured to: The candidate tool call data are subjected to tool type validity verification, parameter integrity verification, and immediate execution intent verification, respectively. If the tool type validity check, the parameter integrity check, and the immediate execution intent check all pass, then the pre-verification result is determined to be a successful check; otherwise, the pre-verification result is determined to be a failed check.
[0059] In one embodiment of the present invention, the side effect execution isolation and control device 200 invoked by the end-side model tool is further configured to: If the pre-verification result is that the verification fails, then based on the missing fields or abnormal items determined by one or more of the tool type legality verification, the parameter integrity verification, and the immediate execution intent verification, an abnormal result containing clarification inquiry information and / or refusal to execute prompt information is generated. The abnormal result is output as the response corresponding to the user request data in the current session, and the forwarding process of the structured protocol request is terminated, without sending the structured protocol request to the system capability gateway.
[0060] Reference Figure 3 The illustration shows a computer electronic device 1 for implementing the side effect execution isolation and control method of the end-side model tool call of the present invention, which may specifically include: The computer electronic device 1 is manifested in the form of a general computing device, including: one or more processors or processing units 3, memory 8, and a bus 4 connecting different system components (including memory 8 and processing unit 3).
[0061] Bus 4 represents one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Audio / Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0062] Computer electronic device 1 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by computer electronic device 1, including volatile and non-volatile media, removable and non-removable media.
[0063] Memory 8 may include computer system readable media in the form of volatile memory, such as random access memory 9 and / or cache memory 10. A computer electronic device 1 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 11 may be used to read and write non-removable, non-volatile magnetic media (commonly referred to as a "hard disk drive"). Although Figure 3 As not shown, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 4 via one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 13 configured to perform the functions of the embodiments of this application.
[0064] A program / utility 12 having a set (at least one) of program modules 13 may be stored, for example, in memory. Such program modules 13 include—but are not limited to—an operating system, one or more application programs, other program modules 13, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 13 typically perform the functions and / or methods described in the embodiments of this application.
[0065] The computer electronic device 1 can also communicate with one or more external devices 2 (e.g., keyboard, pointing device, display 7, camera, etc.), and with one or more devices that enable an operator to interact with the computer electronic device 1, and / or with any device that enables the computer electronic device 1 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed through the I / O interface 6. Furthermore, the computer electronic device 1 can also communicate with one or more networks (e.g., local area network (LAN)), wide area network (WAN), and / or public networks (e.g., the Internet) through the network adapter 5. Figure 3 As shown, network adapter 5 communicates with other modules of computer electronic device 1 via bus 4. It should be understood that, although... Figure 3Not shown, it may be combined with other hardware and / or software modules, including but not limited to: microcode, device drivers, redundant processing unit 3, external disk drive array, RAID system, tape drive and data backup storage system 11, etc.
[0066] The processing unit 3 executes various functional applications and data processing by running programs stored in memory 8, such as implementing the side effect execution isolation and control method of the end-side model tool call provided in the embodiments of this application.
[0067] That is, when the processing unit 3 executes the above program, it performs the following: obtaining user request data corresponding to the current session through the end-side inference service; calling the end-side model to perform intent recognition and parameter extraction on the user request data to generate candidate tool call data; performing pre-validation on the candidate tool call data to obtain a pre-validation result; if the pre-validation result is valid, converting the candidate tool call data into a structured protocol request and sending the structured protocol request to the system capability gateway independent of the end-side inference service through the local loopback communication channel; calling the system capability gateway to perform secondary validation on the structured protocol request based on a preset tool whitelist and caller rules to obtain a secondary validation result; if the secondary validation result is allowed to execute, executing the corresponding target system tool based on the structured protocol request to obtain an execution result, and sending the execution result back to the end-side inference service through the local loopback communication channel; writing the execution result into the dialogue context of the current session through the end-side inference service, generating and outputting the natural language result corresponding to the user request data.
[0068] In the embodiments of this application, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the side effect execution isolation and control method for end-side model tool calls as provided in all embodiments of this application.
[0069] That is, when the program is executed by the processor, it implements the following: obtaining user request data corresponding to the current session through the edge-side inference service; calling the edge-side model to perform intent recognition and parameter extraction on the user request data to generate candidate tool call data; performing pre-validation on the candidate tool call data to obtain a pre-validation result; if the pre-validation result is valid, converting the candidate tool call data into a structured protocol request and sending the structured protocol request to the system capability gateway independent of the edge-side inference service through the local loopback communication channel; calling the system capability gateway to perform a secondary validation on the structured protocol request based on a preset tool whitelist and caller rules to obtain a secondary validation result; if the secondary validation result is allowed to execute, executing the corresponding target system tool based on the structured protocol request to obtain an execution result, and sending the execution result back to the edge-side inference service through the local loopback communication channel; and writing the execution result into the dialogue context of the current session through the edge-side inference service to generate and output the natural language result corresponding to the user request data.
[0070] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0071] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0072] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as a standalone software package, partially on the operator's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the operator's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably.
[0073] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0074] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0075] The foregoing has provided a detailed description of the method, apparatus, electronic device, and storage medium for isolating and controlling the side effects of edge model tool calls provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for isolating and controlling the execution of side effects of edge-side model tool calls, applied to artificial intelligence terminals, characterized in that, include: Obtain user request data corresponding to the current session through the client-side inference service; The client-side model is invoked to perform intent recognition and parameter extraction on the user request data, generating candidate tool invocation data; The candidate tool call data is pre-validated to obtain the pre-validation result; If the pre-verification result is a successful verification, the candidate tool call data is converted into a structured protocol request and sent to the system capability gateway independent of the end-side inference service through the local loopback communication channel. The system capability gateway is invoked to perform a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and the secondary verification result is obtained. If the secondary verification result is allowed to execute, then the corresponding target system tool is requested to be executed based on the structured protocol, the execution result is obtained, and the execution result is sent back to the end-side inference service through the local loopback communication channel; The execution result is written into the dialogue context of the current session through the edge inference service, and the natural language result corresponding to the user request data is generated and output.
2. The method according to claim 1, characterized in that, The candidate tool invocation data includes the tool name, invocation parameters, and session identifier. Converting the candidate tool invocation data into a structured protocol request and sending the structured protocol request to a system capability gateway independent of the edge-side inference service via a local loopback communication channel includes: The tool name, the call parameters, and the session identifier are encapsulated into a structured protocol request, and the call source identifier is carried in the structured protocol request; The structured protocol request is sent to the system capability gateway through the local loopback communication channel, wherein the end-side inference service and the system capability gateway run in different permission domains of the same artificial intelligence terminal.
3. The method according to claim 2, characterized in that, The structured protocol request adopts the JSON-RPC tools / call method format of the Model Context Protocol. The structured protocol request includes a method name field, a parameter field, and a request identifier field, wherein the parameter field carries the tool name and the call parameters.
4. The method according to claim 1, characterized in that, The system capability gateway performs a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules to obtain the secondary verification result, including: The system capability gateway is invoked to parse the structured protocol request, thereby obtaining the tool name and invocation source identifier in the structured protocol request; Search the tool registration entry in the tool whitelist that matches the tool name; The call source identifier is authenticated and verified according to the caller rules. If the tool registration item exists and the authentication verification passes, the secondary verification result is determined to be "execution allowed"; otherwise, the secondary verification result is determined to be "execution rejected".
5. The method according to claim 4, characterized in that, After the system capability gateway performs a secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtains the secondary verification result, the process further includes: If the result of the secondary verification is rejection, the system capability gateway is invoked to generate a standard error response containing an error code and error description, and the standard error response is sent back to the end-side inference service through the local loopback communication channel.
6. The method according to claim 1, characterized in that, The pre-validation of the candidate tool call data to obtain the pre-validation result includes: The candidate tool call data are subjected to tool type validity verification, parameter integrity verification, and immediate execution intent verification, respectively. If the tool type validity check, the parameter integrity check, and the immediate execution intent check all pass, then the pre-verification result is determined to be a successful check; otherwise, the pre-verification result is determined to be a failed check.
7. The method according to claim 6, characterized in that, After pre-validating the candidate tool call data and obtaining the pre-validation result, the method further includes: If the pre-verification result is that the verification fails, then based on the missing fields or abnormal items determined by one or more of the tool type legality verification, parameter integrity verification and instant execution intent verification, an abnormal result containing clarification query information and / or refusal to execute prompt information is generated. The abnormal result is output as the response corresponding to the user request data in the current session, and the forwarding process of the structured protocol request is terminated, without sending the structured protocol request to the system capability gateway.
8. A device for isolating and controlling the execution of side effects of edge-side model tool calls, applied to an artificial intelligence terminal, characterized in that, include: The acquisition module is used to obtain user request data corresponding to the current session through the client-side inference service; The generation module is used to call the client-side model to perform intent recognition and parameter extraction on the user request data, and generate candidate tool call data; The pre-verification module is used to pre-verify the candidate tool call data and obtain the pre-verification result; The conversion module is used to convert the candidate tool call data into a structured protocol request if the pre-verification result is a verification pass, and send the structured protocol request to the system capability gateway independent of the end-side inference service through the local loopback communication channel. The secondary verification module is used to call the system capability gateway to perform secondary verification on the structured protocol request based on a preset tool whitelist and caller rules, and obtain the secondary verification result; The execution module is used to request the execution of the corresponding target system tool based on the structured protocol if the secondary verification result is allowed to execute, obtain the execution result, and send the execution result back to the end-side inference service through the local loopback communication channel; The output module is used to write the execution result into the dialogue context of the current session through the end-side inference service, and generate and output the natural language result corresponding to the user request data.
9. A computer electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, it implements the steps of the side-effect execution isolation control method called by the end-side model tool as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the side-effect execution isolation control method of the end-side model tool call as described in any one of claims 1 to 7.
