Low token automatic execution method and system based on OpenClaw and RPA
By optimizing the integration of OpenClaw and RPA through layered invocation and caching mechanisms, the problems of high token consumption, low execution efficiency, and insufficient scenario adaptability are solved, enabling efficient and stable automated execution in cross-border e-commerce and financial scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN JUDAO STAR MAP OVERSEAS INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-04-15
- Publication Date
- 2026-07-10
AI Technical Summary
OpenClaw suffers from excessive token consumption, low execution efficiency, poor tool reusability, and insufficient scenario adaptability in cross-border e-commerce and financial scenarios, failing to meet the high-frequency and precise automation needs.
A layered invocation strategy is adopted, calling the large model LLM only at task startup, exception occurrence, and result aggregation nodes, with intermediate steps executed by the RPA tool library; a context token threshold and caching mechanism are set to limit the number of historical interaction rounds; and a standardized AIAgent platform interface is provided to support cross-platform switching.
It reduces token consumption, improves execution efficiency and stability, adapts to vertical scenario needs, reduces development costs, and achieves seamless cross-platform switching.
Smart Images

Figure CN122363773A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence agent and process automation technology, specifically a low-token automated execution method and system based on OpenClaw and RPA. Background Technology
[0002] With the integration of artificial intelligence and automation technologies, OpenClaw, as an AIAgent framework that combines Large Language Model (LLM) and RPA execution engine, is widely used in various automation scenarios (such as cross-border e-commerce order management, financial report processing, and batch data entry). However, it faces the following technical challenges in practical applications: 1. Excessive Token Consumption: In the native mode of OpenClaw, the LLM needs to participate in the entire task execution process. Every step of the operation requires calling the large model to generate instructions, and the historical context expands infinitely, resulting in a surge in token usage and increasing the cost of calling the large model. This is especially true in scenarios such as cross-border e-commerce batch order processing and financial high-frequency reconciliation, where the cost pressure is significant.
[0003] 2. Low execution efficiency: The LLM-driven mode has response delays, and context redundancy can easily lead to instruction parsing errors, which in turn affects the stability of RPA execution and cannot meet the high-frequency and accurate automation needs such as real-time processing of cross-border e-commerce orders and rapid generation of financial regulatory reports.
[0004] 3. Poor tool reusability: The calls to RPA tool functions and OpenClaw lack a standardized scheduling mechanism, making it difficult to reuse tool functions in different scenarios. This results in high development costs and issues such as chaotic calls and execution failures. It is particularly unsuitable for scenarios involving cross-border e-commerce multi-platform adaptation and financial multi-process reuse.
[0005] 4. Insufficient scenario adaptability: Existing OpenClaw and RPA integration solutions are mostly general-purpose and have not been optimized for vertical scenarios such as cross-border e-commerce and finance (e.g., cross-border e-commerce customs declaration, financial credit review, and interbank reconciliation), thus failing to meet the dual goals of scenario requirements and token cost reduction. Summary of the Invention
[0006] In order to overcome the shortcomings of the prior art, this invention provides a low-token automated execution method and system based on OpenClaw and RPA, so as to at least partially solve the above-mentioned technical problems.
[0007] The technical solution adopted in this invention is as follows: This invention proposes a low-token automated execution method based on OpenClaw and RPA, comprising the following steps: Step 1: Receive natural language instructions and parse the natural language instructions into standardized task parameters using a preset structured instruction template. The structured instruction template includes task type, scenario parameters, input data, output format, throttling rules, and execution constraints. Step 2: Call the large model LLM only at the task start node, the exception occurrence node, and the result summary node. Specifically, the RPA execution sequence is generated at the task start node, the error correction plan is generated at the exception occurrence node, and the natural language feedback is generated at the result summary node. The intermediate execution steps do not trigger the large model LLM call. Step 3: Activate the dynamic token throttling mechanism, set the maximum token threshold for the context, perform automatic cleanup of non-critical contexts, retain important memory entries marked, and limit the number of historical interaction rounds; Step 4: Schedule the preset RPA tool function library to execute the operations corresponding to the standardized task parameters, cache the same task parameters, and when the cache is hit, directly return the stored execution result without re-calling the large model LLM; Step 5: Generate structured execution results, and convert the structured execution results into natural language feedback through the large model LLM of the result aggregation node; Step 6: Provide a standardized AIAgent platform interface to support seamless switching between the OpenClaw framework and other similar AIAgent platforms. During the switching process, only the interface configuration parameters need to be modified without changing the core execution logic.
[0008] In one embodiment of the present invention, the scenario parameters are adapted to vertical business scenarios, which include cross-border e-commerce scenarios or financial scenarios. The scenario parameters for cross-border e-commerce scenarios include at least one of platform type, order information, logistics method and customs declaration information, while the scenario parameters for financial scenarios include at least one of business type, data standard, regulatory requirements and account information.
[0009] In one embodiment of the present invention, in the dynamic token throttling mechanism, the identification method for important memory entries is manual user marking or automatic identification by the system based on core task parameters and execution results. The automatic cleanup cycle is dynamically adjusted according to the frequency of task types, with the cleanup cycle for high-frequency tasks being shorter than that for low-frequency tasks.
[0010] In one embodiment of the present invention, the preset RPA tool function library includes cross-border e-commerce specific functions and financial specific functions. The cross-border e-commerce specific functions include order synchronization functions and customs declaration data verification functions. The financial specific functions include credit review functions and regulatory report generation functions. The RPA tool function library supports users to add and modify functions and access the system through a registration mechanism.
[0011] In one embodiment of the present invention, the other similar AIAgent platforms include at least one of WorkBuddy, CoPaw, KimiClaw, LobsterAI, or ManusAI, and the standardized AIAgent platform interface supports switching between different platforms by configuring the interface address, calling key, and request format.
[0012] In one embodiment of the present invention, the caching mechanism of the RPA tool function library sets a cache expiration time. When the task parameters exceed the set cache expiration time, the corresponding cached data is cleared and the RPA tool function is re-triggered to execute.
[0013] In one embodiment of the present invention, at the node where the exception occurs, the large model LLM call process includes parsing the error log generated by the RPA execution failure, determining the error type, generating a targeted correction plan, and having the RPA tool function library re-execute the task according to the correction plan.
[0014] In one embodiment of the present invention, a system based on a low-token automated execution method using OpenClaw and RPA includes: The instruction parsing module is used to receive natural language instructions and parse the natural language instructions into standardized task parameters using a preset structured instruction template; The LLM layered invocation module is used to control the large model LLM to be invoked only at the task start node, the exception occurrence node, and the result summary node, generating the RPA execution sequence, error correction scheme and natural language feedback, and blocking the LLM invocation in the intermediate execution steps; The Token Throttling module is used to set the maximum token threshold for a context, perform automatic cleanup of non-critical contexts, retain important memory entries that have been marked, and limit the number of historical interaction rounds. The RPA tool scheduling module is used to manage the preset RPA tool function library, perform task scheduling and cache the same task parameters, and directly return the execution result when the cache is hit; The results output module is used to receive the structured execution results after the RPA tool function has been executed, and convert them into natural language feedback through LLM; The platform compatibility module provides a standardized AIAgent platform interface, supporting seamless switching between the OpenClaw framework and other similar AIAgent platforms, requiring only modification of interface configuration parameters during switching.
[0015] In one embodiment of the present invention, the preset structured instruction template configured by the instruction parsing module can be customized according to vertical business scenarios, including cross-border e-commerce scenarios and financial scenarios. The customized instruction template includes at least one exclusive parameter among platform type, order information, business type, and regulatory requirements.
[0016] In one embodiment of the present invention, the RPA tool scheduling module integrates a cache unit, which is used to store task parameters and corresponding execution results, and supports setting a cache expiration time. When the expiration time is reached, the cached data is automatically cleared.
[0017] The beneficial effects of the technical solution of this invention are as follows: This invention utilizes a large model to generate an initial execution sequence at the task initiation node, determining the order and logic of RPA tool calls. The intermediate execution phase is entirely managed by the RPA tool library, running automatically according to the predetermined sequence, blocking any large model calls and cutting off the token consumption paths generated by numerous routine operations. When encountering network interruptions, interface changes, or data format errors, the process jumps to the exception node, where the large model intervenes to analyze error logs and generate targeted correction solutions, which are then reinjected into the execution flow. Finally, the large model is only called at the result aggregation node to convert structured results into natural language feedback. This layered calling mode concentrates the large model's computing resources on key decision points and error correction stages, decoupling a large number of repetitive and deterministic operations from the large model's computing power, fundamentally reducing overall token consumption, and simultaneously improving the system's response speed and stability in handling complex tasks.
[0018] This invention sets a maximum context token threshold, allowing the system to monitor the length of historical content in the current interaction in real time. Once the threshold is approached, an automatic cleanup process is initiated, removing non-critical context information and retaining only marked important memory entries. The retention of important memory entries depends on manual marking or automatic identification by the system based on core task parameters, ensuring that critical business data is not mistakenly deleted. Simultaneously, the system limits the number of historical interaction rounds to prevent performance degradation or uncontrolled costs caused by unlimited context expansion. This allows the system to maintain necessary context coherence within a limited token budget. In scenarios handling high-frequency tasks, dynamically adjusting the cleanup cycle effectively frees up space and avoids computational bottlenecks caused by excessively long contexts.
[0019] This invention utilizes a caching unit integrated into the RPA tool scheduling module to achieve intelligent reuse of identical task parameters. The hash value of the task parameters is used as an index key, and standardized parameter combinations are bound and stored with the execution results. When the cache is hit and the preset expiration time has not exceeded, the system directly returns the stored execution result, skipping subsequent large model calls and RPA execution processes. To address the timeliness requirements of business data, the system supports setting differentiated cache expiration times, ensuring that tasks sensitive to data freshness (such as cross-border e-commerce order status and financial account balances) are updated promptly, avoiding business risks caused by long-term reuse of old data.
[0020] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0021] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a method framework diagram of the low-token automated execution method based on OpenClaw and RPA proposed in this embodiment of the invention; Figure 2 This is a functional diagram of the first method of the low-token automated execution method based on OpenClaw and RPA proposed in an embodiment of the present invention; Figure 3 This is a functional diagram of the second method of the low-token automated execution method based on OpenClaw and RPA proposed in an embodiment of the present invention; Figure 4 This is a module framework diagram of the low-token automated execution system based on OpenClaw and RPA proposed in this embodiment of the invention; Figure 5 This is a module functional diagram of the low-token automated execution system based on OpenClaw and RPA proposed in an embodiment of the present invention. Detailed Implementation
[0022] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0023] The following describes a low-token automated execution method and system based on OpenClaw and RPA according to an embodiment of the present invention, with reference to the accompanying drawings.
[0024] like Figures 1 to 5 As shown, this embodiment of the invention provides a low-token automated execution method based on OpenClaw and RPA, including the following steps: Step 1: Receive natural language instructions and parse them into standardized task parameters using a preset structured instruction template. The structured instruction template includes task type, scenario parameters, input data, output format, throttling rules, and execution constraints. Step 2: Call the large model LLM only at the task start node, the exception occurrence node, and the result summary node. Specifically, the RPA execution sequence is generated at the task start node, the error correction plan is generated at the exception occurrence node, and the natural language feedback is generated at the result summary node. The intermediate execution steps do not trigger the large model LLM call. Step 3: Activate the dynamic token throttling mechanism, set the maximum token threshold for the context, perform automatic cleanup of non-critical contexts, retain important memory entries marked, and limit the number of historical interaction rounds; Step 4: Schedule the pre-defined RPA tool function library to execute the operations corresponding to the standardized task parameters, cache the same task parameters, and when the cache is hit, directly return the stored execution result without re-calling the large model LLM; Step 5: Generate structured execution results and convert them into natural language feedback through the large model LLM of the result aggregation node; Step 6: Provide a standardized AIAgent platform interface to support seamless switching between the OpenClaw framework and other similar AIAgent platforms. During the switching process, only the interface configuration parameters need to be modified without changing the core execution logic.
[0025] In specific applications, during the instruction receiving and parsing phase, the system introduces a pre-defined structured instruction template. This template specifies the task type, scenario parameters, input data, output format, throttling rules, and execution constraints. When a user inputs a natural language instruction, the system first extracts and standardizes the task parameters based on the template, transforming the unstructured natural language into a machine-recognizable set of parameters. This lays the data foundation for subsequent low-token execution. The application of the structured instruction template allows the system to predefine task boundaries, avoiding redundant calculations when large models process long texts, while ensuring the standardization of input data across different business scenarios.
[0026] In terms of core execution logic, this solution adopts a node-based invocation strategy. The system activates the large model LLM only at three specific moments: the task initiation node, the exception occurrence node, and the result aggregation node. At the task initiation node, the large model generates an initial RPA execution sequence based on standardized task parameters, determining the order of subsequent operations. During the intermediate execution phase, the system is entirely taken over by the pre-defined RPA utility library, running automatically according to the predetermined execution sequence without triggering any large model invocations, thus cutting off most of the token consumption generated by routine operations. When an unhandled exception is encountered during execution, the process jumps to the exception occurrence node, where the large model intervenes to analyze the error log and generate a targeted correction plan, which is then reinjected into the execution flow. Finally, after all task steps are completed, the process converges at the result aggregation node, where the large model converts the structured execution results into natural language feedback.
[0027] To further ensure the stability and cost-effectiveness of the system during long-term operation, this solution integrates a dynamic token throttling mechanism. This mechanism sets a maximum token threshold for the context. Once the historical content of the current interaction approaches the threshold, the system initiates an automatic cleanup process, removing non-critical context information and retaining only marked important memory entries. Simultaneously, the system limits the number of rounds of historical interactions to prevent the context from expanding indefinitely. The retention of important memory entries relies on manual marking or automatic identification by the system based on core task parameters, ensuring that critical business data is not mistakenly deleted. This allows the system to maintain necessary contextual continuity within a limited token budget, avoiding performance degradation or uncontrolled costs due to excessively long contexts.
[0028] In terms of execution efficiency optimization, the system introduces a task parameter-based caching mechanism. When scheduling operations from the pre-defined RPA utility function library, the system performs hash calculations on the input task parameters and stores the corresponding execution results. When the same task parameters are received subsequently, the system directly retrieves the cached results and returns the stored results, without needing to call the large model again to generate a new execution sequence or directly repeat the RPA operation.
[0029] Furthermore, this solution features a standardized AIAgent platform interface, enabling seamless switching between the OpenClaw framework and other similar AIAgent platforms (such as WorkBuddy, CoPaw, and KimiClaw). The interface shields users from the differences between underlying platforms, ensuring that the execution logic remains unchanged. When switching platforms, only the interface configuration parameters need to be modified, including the interface address, calling key, and request format. There is no need to rewrite core code or adjust the task execution flow. This not only improves system compatibility and scalability but also facilitates migration between different technology stacks, avoiding the high reconstruction costs associated with changing the underlying platform.
[0030] In one specific implementation, the scenario parameters are adapted to vertical business scenarios, including cross-border e-commerce scenarios or financial scenarios. The scenario parameters for cross-border e-commerce scenarios include at least one of platform type, order information, logistics method and customs declaration information, while the scenario parameters for financial scenarios include at least one of business type, data standard, regulatory requirements and account information.
[0031] In the dynamic token throttling mechanism, important memory entries are identified either by manual user marking or by automatic identification by the system based on core task parameters and execution results. The automatic cleanup cycle is dynamically adjusted according to the frequency of task types, with the cleanup cycle for high-frequency tasks being shorter than that for low-frequency tasks.
[0032] In specific applications, during the scenario parameter adaptation stage, the system maps natural language commands to standardized parameters specific to a particular domain based on preset instruction templates. For example, the parameter set for cross-border e-commerce scenarios explicitly includes at least one of platform type, order information, logistics method, and customs declaration information. For financial scenarios, it includes at least one of business type, data standard, regulatory requirements, and account information. This parameter classification allows the system to differentiate its processing based on the business logic differences across industries. For instance, in cross-border e-commerce, the platform type determines the scope of RPA tool libraries invoked, order information and logistics method are associated with specific order placement and delivery operation sequences, and customs declaration information triggers specific compliance verification processes. In financial scenarios, the business type defines the compliant path of fund flows, data standards and regulatory requirements constrain the format and content of output data, and account information is a necessary credential for executing transaction operations. By refining and solidifying scenario parameters into instruction templates, the system can lock in business boundaries before execution, avoiding ambiguity and redundant calculations when large models process general instructions, ensuring the accuracy and specificity of subsequent RPA execution sequence generation.
[0033] Furthermore, during the operation of the dynamic token throttling mechanism, the system employs a dual identification strategy to determine the retention range of important memory entries. On the one hand, it supports manual users to actively mark key contexts through the interactive interface; on the other hand, the system automatically identifies them based on the semantic weights of task parameters and execution results. When the current interaction round or context length is detected to be approaching the preset maximum token threshold, the system initiates a cleanup procedure to remove non-critical historical interaction records. The length of the cleanup cycle is dynamically adjusted according to the frequency of the task type. The cleanup cycle for high-frequency tasks is set to a shorter time interval, while the cleanup cycle for low-frequency tasks is correspondingly extended. Based on actual operational data analysis, high-frequency tasks often generate a large number of repetitive interactions in a short period of time. If not cleaned up in time, they will quickly exhaust the token quota. Therefore, shortening the cleanup cycle can effectively free up space. Low-frequency tasks have sparse interactions, and extending the cleanup cycle helps maintain the continuity of business context for a longer period of time, reducing the risk of task interruption caused by frequent context resets.
[0034] In one specific implementation, the pre-defined RPA tool function library includes functions specifically for cross-border e-commerce and functions specifically for finance. The cross-border e-commerce functions include order synchronization functions and customs data verification functions, while the finance functions include credit review functions and regulatory report generation functions. The RPA tool function library allows users to add and modify functions and access the system through a registration mechanism. Other similar AIAgent platforms include at least one of WorkBuddy, CoPaw, KimiClaw, LobsterAI, or ManusAI. The standardized AIAgent platform interface supports switching between different platforms by configuring the interface address, calling key, and request format.
[0035] In specific applications, this invention's embodiments include a cross-border e-commerce-specific function set that embeds order synchronization and customs declaration data verification functions. The order synchronization function is responsible for connecting to the data interfaces of different e-commerce platforms, automatically capturing and standardizing order status, logistics trajectory, and inventory information. The customs declaration data verification function performs logical verification on the declared data according to the customs coding rules of the target market, ensuring that the data format meets import and export compliance requirements. Similarly, the financial-specific function set embeds credit review and regulatory report generation functions. The credit review function performs multi-dimensional cross-validation of applicant data based on a preset risk control model. The regulatory report generation function automatically generates formatted reports according to the data standards stipulated by regulatory agencies. This approach of transforming general RPA capabilities into industry-specific business logic functions allows the system to perform tasks without calling large models for general logical reasoning, directly calling pre-defined, highly deterministic functions to complete specific operations, thereby reducing token consumption and improving execution accuracy.
[0036] Furthermore, to adapt to ever-changing business needs and technological iterations, the RPA tool function library introduces a dynamic registration mechanism, supporting users to add custom functions or modify existing function logic. When users need to handle new business scenarios, they only need to write function code according to the system-defined interface specifications and submit a registration request. The system will automatically include it in the scheduling pool without refactoring the core execution engine. This enables rapid response to the launch of new cross-border e-commerce platforms or the introduction of new financial regulations, avoiding the cumbersome process of retraining the model or modifying the underlying code for each business change in traditional solutions.
[0037] Regarding platform compatibility, this solution defines a standardized AIAgent platform interface, shielding the underlying differences between the OpenClaw framework and other similar AIAgent platforms. The system supports seamless switching between multiple mainstream platforms such as WorkBuddy, CoPaw, KimiClaw, LobsterAI, and ManusAI. The switching process only requires adjusting interface configuration parameters, including specifying the interface address of the target platform, updating the calling key, and adapting to specific request message formats. This allows upper-layer business applications to no longer be bound to a single underlying platform. Users can flexibly choose or migrate to different AIAgent platforms based on factors such as computing power cost, response speed, or service stability. Through a unified interface layer, the system achieves the effect of "develop once, deploy everywhere," effectively reducing the migration costs and risks incurred by enterprises due to changing the underlying technology stack.
[0038] In one specific implementation, the caching mechanism of the RPA tool function library sets a cache expiration time. When the task parameters exceed the set cache expiration time, the corresponding cached data is cleared and the RPA tool function is re-triggered. At the node where the exception occurs, the large model LLM call process includes parsing the error log generated by the RPA execution failure, determining the error type, and generating a targeted correction plan. The RPA tool function library then re-executes the task according to the correction plan.
[0039] In practical applications, during the caching mechanism operation phase of this invention, the system binds a specific cache expiration time parameter to each execution result in the RPA tool function library. This parameter is dynamically set based on the update frequency of business data and the task type. When the system receives a new task request, it first checks if a matching task parameter cache exists. If the cache is hit and the current time does not exceed the preset expiration threshold, the stored execution result is returned directly, avoiding repeated calls to external interfaces and large model resources. Once the system detects that the current time has exceeded the set cache expiration time, it automatically determines that the cached data has expired, immediately clears the corresponding historical data records, and forcibly triggers the RPA tool function to re-execute the complete operation process. This ensures that data with extremely high timeliness requirements, such as cross-border e-commerce order status and financial account balances, are always up-to-date, preventing business logic errors or compliance risks caused by long-term reuse of old data. Simultaneously, it retains the core advantage of the caching mechanism in saving token consumption in high-frequency repetitive tasks, achieving a balance between data real-time performance and execution efficiency.
[0040] Furthermore, in the anomaly handling phase, the system establishes an intelligent diagnosis and repair path based on the large-scale model LLM. When an RPA tool function encounters network interruption, interface change, or data format error during the execution of standardized task parameters, leading to execution failure, the process automatically jumps to the node where the anomaly occurred. At this point, the system completely inputs the raw error logs generated by the RPA execution failure into the large-scale model LLM. The large-scale model performs in-depth analysis of the log content to identify the root cause and specific type of the error, such as distinguishing between temporary network fluctuations and structural data mismatches. Based on the analysis results, the large-scale model generates targeted correction solutions, including specific parameter adjustment strategies, alternative execution paths, or data cleaning rules. Subsequently, the RPA tool function library receives the correction solutions, transforms them into executable instruction sequences, and re-initiates task execution. This enables the system to cope with unknown error scenarios, dynamically adjust execution strategies according to actual error situations, and improve the self-healing capability and final success rate of tasks in complex business scenarios.
[0041] In one specific implementation, a system based on the low-token automated execution method of OpenClaw and RPA includes: The instruction parsing module is used to receive natural language instructions and parse them into standardized task parameters using a preset structured instruction template. The LLM layered invocation module is used to control the large model LLM to be invoked only at the task start node, the exception occurrence node, and the result summary node, generating the RPA execution sequence, error correction scheme and natural language feedback, and blocking the LLM invocation in the intermediate execution steps; The Token Throttling module is used to set the maximum token threshold for a context, perform automatic cleanup of non-critical contexts, retain important memory entries that have been marked, and limit the number of historical interaction rounds. The RPA tool scheduling module is used to manage the preset RPA tool function library, perform task scheduling and cache the same task parameters, and directly return the execution result when the cache is hit; The results output module is used to receive the structured execution results after the RPA tool function has been executed, and convert them into natural language feedback through LLM; The platform compatibility module provides a standardized AIAgent platform interface, supporting seamless switching between the OpenClaw framework and other similar AIAgent platforms, requiring only modification of interface configuration parameters during switching.
[0042] In specific applications of this invention, the instruction parsing module serves as the system's entry point. It is responsible for receiving natural language instructions input by the user and converting them into standardized task parameters based on a preset structured instruction template. The template specifies the task type, scenario parameters, input data, output format, throttling rules, and execution constraints, enabling unstructured natural language to be quickly mapped into machine-recognizable deterministic data. This addresses the fuzzy reasoning requirements when processing initial instructions, establishing subsequent execution logic on a clear data foundation, thereby reducing the token usage at the input end. The generation of standardized task parameters not only standardizes the input format under different business scenarios but also provides a unified interface standard for subsequent RPA tool calls, ensuring logical consistency when the system handles specific tasks such as cross-border e-commerce order synchronization or financial report generation.
[0043] Furthermore, the LLM layered invocation module only allows the large model to intervene at three key nodes: the task initiation node, the exception occurrence node, and the result aggregation node. At the task initiation node, the large model generates an initial RPA execution sequence based on standardized task parameters, determining the order of subsequent operations. During the intermediate execution phase, the system is completely taken over by the RPA utility library, running automatically according to the predetermined execution sequence, blocking any large model invocations and cutting off most of the token consumption generated by routine operations. When an unmanageable exception is encountered during execution, the process jumps to the exception occurrence node, where the large model intervenes to analyze error logs and generate targeted correction solutions, which are then reinjected into the execution flow. Finally, after all task steps are completed, the process converges at the result aggregation node, where the large model only converts the structured execution results into natural language feedback. This completely removes a large number of repetitive and deterministic operations from the large model's computing power, fundamentally reducing the overall token consumption.
[0044] Furthermore, the Token throttling module ensures the system's stability and economy during long-term operation. It prevents resource overload by setting a maximum context token threshold. When the historical content of the current interaction approaches the threshold, the system initiates an automatic cleanup process, removing non-critical context information and retaining only marked important memory entries. The retention of important memory entries relies on manual marking or automatic identification by the system based on task parameters, ensuring that critical business data is not mistakenly deleted. Simultaneously, the system limits the number of rounds of historical interactions to prevent the context from expanding indefinitely. This allows the system to maintain necessary context coherence within a limited token budget, avoiding performance degradation or cost overruns due to excessively long contexts. Especially in scenarios handling high-frequency tasks, dynamically adjusting the cleanup cycle effectively frees up space.
[0045] Furthermore, the RPA tool scheduling module manages the pre-defined RPA tool function library and executes specific task operations. The module caches the same task parameters, and when the cache is hit, it directly returns the stored execution result without re-calling the large model LLM or repeatedly executing RPA operations. The cache expiration time mechanism ensures that data with high timeliness requirements (such as order status and account balance) can be updated in a timely manner, avoiding business risks caused by long-term reuse of old data. For tool libraries that include cross-border e-commerce-specific functions (such as order synchronization and customs declaration verification) and financial-specific functions (such as credit review and regulatory report generation), the scheduling module supports users to add or modify functions through a registration mechanism, achieving high scalability of functions.
[0046] Furthermore, the output module receives the structured execution results from the RPA tool functions and converts them into natural language feedback through the large LLM model of the result aggregation node. This ensures that the final deliverables to the user contain both machine-readable structured data and human-readable natural language descriptions, enhancing the interactive experience. The platform compatibility module provides standardized AIAgent platform interfaces, supporting seamless switching between the OpenClaw framework and other similar AIAgent platforms (such as WorkBuddy, CoPaw, KimiClaw, LobsterAI, or ManusAI). During the switching process, only interface configuration parameters need to be modified, including the interface address, calling key, and request format, without modifying the core execution logic. Users can flexibly choose or migrate to different AIAgent platforms based on factors such as computing power cost, response speed, or service stability, avoiding the high reconstruction costs associated with changing the underlying technology stack.
[0047] In one specific implementation, the preset structured instruction template configured by the instruction parsing module can be customized according to vertical business scenarios, including cross-border e-commerce scenarios and financial scenarios. The customized instruction template includes at least one exclusive parameter among platform type, order information, business type, and regulatory requirements.
[0048] In specific applications, the embodiments of this invention, in cross-border e-commerce scenarios, mandate that the instruction template include exclusive parameter fields for platform type, order information, logistics method, and customs declaration information; in financial scenarios, the instruction template focuses on business type, data standards, regulatory requirements, and account information elements. The customized template structure transforms unstructured natural language instructions into standardized data objects with constraints, so that the instructions input into the system are directly mapped to a specific combination of business parameters.
[0049] Furthermore, when a user inputs natural language containing phrases like "process Amazon store orders," the instruction parsing module automatically identifies it as a cross-border e-commerce scenario and activates a structured template containing information such as the platform type (Amazon), order information fields (e.g., SKU, quantity, shipping address), logistics method (e.g., air freight, sea freight), and customs information (e.g., HS code, declared value). The system fills the corresponding parameter slots with the natural language fragments from the user's description. If any necessary fields are missing, it immediately sends a request to complete them, rather than attempting to guess the missing content using a large model. Similarly, when the instruction involves a financial scenario, such as "generate quarterly credit compliance report," the system automatically matches a template containing information such as the business type (credit review), data standard (ISO20022), regulatory requirements (Basel III), and account information (specific entity ID). Through this parameterized constraint, the system ensures that the input data for subsequent RPA tool function calls conforms to the specific industry's business logic and compliance standards, eliminating execution errors caused by instruction ambiguity at the source.
[0050] Furthermore, the customized template mechanism and the LLM layered invocation strategy work in deep synergy. Since the complex business logic has been broken down into a clear set of parameters during the instruction parsing phase, the LLM generates a concise execution sequence based on standardized parameters at the task initiation node, eliminating the need for repeated confirmation of business details or explanation of industry terminology within the context. For example, in cross-border e-commerce scenarios, once order information and customs declaration parameters are locked by the template, subsequent order placement, shipping, and customs declaration operations are entirely executed by dedicated functions in the RPA tool library according to predetermined rules, without requiring LLM intervention to confirm logistics status or verify customs declaration formats. In financial scenarios, the clear definition of business types and regulatory requirements allows credit review functions to directly call pre-built risk control models, eliminating the need for LLM to analyze the compliance of each transaction in real time.
[0051] Furthermore, customized instruction templates address the issue of data heterogeneity across platforms and scenarios. Different e-commerce platforms have vastly different data interfaces, and different financial institutions have varying regulatory report formats. General templates cannot cover all situations. By customizing exclusive parameter sets for each vertical scenario, the system decouples business logic from underlying execution. When a new e-commerce platform is added or a new financial regulatory policy is released, only the corresponding instruction template parameter definitions need to be updated. This allows the system to quickly adapt to business changes while maintaining low-token operation. The exclusive parameters in the template not only serve as data carriers but also as carriers of business rules, ensuring that RPA tool functions always adhere to industry standards during execution.
[0052] In one specific implementation, the RPA tool scheduling module integrates a cache unit, which stores task parameters and corresponding execution results, and supports setting a cache expiration time. When the expiration time is reached, the cached data is automatically cleared.
[0053] In practical applications, the caching unit of this invention uses the hash value of the task parameters as the index key to bind and store the standardized parameter combination of the user-input business instructions after parsing with the structured results returned by the RPA tool function. When the system receives a new task request, the instruction parsing module first extracts the task parameters and performs a fast search and matching in the caching unit. If a completely identical historical task parameter record is found and the current time has not exceeded the preset cache expiration time threshold, the system directly reads and returns the stored execution result, skipping the subsequent large model LLM call, RPA function execution sequence generation, and actual external data interaction process.
[0054] Furthermore, to address the timeliness requirements of business data, the caching unit introduces a dynamic expiration time control strategy. The system allows for setting differentiated cache expiration times for different task types based on the characteristics of specific business scenarios (such as the real-time change frequency of cross-border e-commerce order status or the update cycle of financial account balances). When the system detects that the current running time exceeds the set expiration time threshold, it automatically triggers cache clearing logic, forcibly deleting the corresponding historical data entries. This ensures that when processing tasks sensitive to data freshness, the system will not cause business logic errors due to long-term reuse of old data. For example, in cross-border e-commerce scenarios, order status changes multiple times in a short period. If the cache expiration time is set too long, the system will return an expired shipping status, leading to a mismatch in logistics information. By setting a shorter expiration time, the system can refresh the data in a timely manner to ensure the latest status is obtained. In low-frequency, high-determinism tasks such as generating financial regulatory reports, a longer expiration time can be set to maximize the use of caching advantages.
[0055] Furthermore, when the cache is hit, the system not only saves tokens but also shortens task response time and improves overall throughput. When the cache is missed or expired, the system automatically starts the complete execution process: LLM only intervenes at the task startup node to generate the execution sequence, which is then executed sequentially by the RPA tool library. Finally, the newly generated results are stored in the cache unit for subsequent queries. The "query-store separation" architecture enables the system to adaptively handle mixed loads of high-frequency repetitive requests and low-frequency complex requests. For complex tasks that include cross-border e-commerce-specific functions (such as order synchronization and customs declaration verification) or financial-specific functions (such as credit review and regulatory report generation), the cache unit can identify the repeatedly called sub-steps and re-execute only the parts where key variables change, further refining the granularity of token saving.
[0056] Furthermore, the cache unit's invalidation and clearing logic is seamlessly integrated with the exception handling process. When an exception occurs during task execution, leading to data inconsistency, the system can proactively mark the relevant cached items as invalid to prevent erroneous data from being retrieved again. Dynamic maintenance capabilities ensure the reliability of cached data, enabling the system to maintain high performance and low resource consumption even during long-term operation. By introducing an expiration time threshold and automatic clearing function, the system solves the problem of difficulty in detecting data expiration in traditional caching solutions. At the same time, it avoids the waste of storage space caused by indefinitely retaining caches. This allows the system to effectively reduce its dependence on the underlying large-scale model computing power when dealing with large-scale concurrent tasks, and concentrate limited token resources on handling the actual logical reasoning and exception decision-making stages. Thus, while ensuring business continuity and data accuracy, it achieves the goal of low-cost and high-efficiency automated execution.
[0057] 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 apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0058] The present invention and its embodiments have been described above. This description is not restrictive, and the accompanying drawings are only one embodiment of the present invention; the actual structure is not limited thereto. In conclusion, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the invention, such designs should fall within the protection scope of the present invention.
Claims
1. A low-token automated execution method based on OpenClaw and RPA, characterized in that, Includes the following steps: Step 1: Receive natural language instructions and parse the natural language instructions into standardized task parameters using a preset structured instruction template. The structured instruction template includes task type, scenario parameters, input data, output format, throttling rules, and execution constraints. Step 2: Call the large model LLM only at the task start node, the exception occurrence node, and the result summary node. Specifically, the RPA execution sequence is generated at the task start node, the error correction plan is generated at the exception occurrence node, and the natural language feedback is generated at the result summary node. The intermediate execution steps do not trigger the large model LLM call. Step 3: Activate the dynamic token throttling mechanism, set the maximum token threshold for the context, perform automatic cleanup of non-critical contexts, retain important memory entries marked, and limit the number of historical interaction rounds; Step 4: Schedule the preset RPA tool function library to execute the operations corresponding to the standardized task parameters, cache the same task parameters, and when the cache is hit, directly return the stored execution result without re-calling the large model LLM; Step 5: Generate structured execution results, and convert the structured execution results into natural language feedback through the large model LLM of the result aggregation node; Step 6: Provide a standardized AIAgent platform interface to support seamless switching between the OpenClaw framework and other similar AIAgent platforms. During the switching process, only the interface configuration parameters need to be modified without changing the core execution logic.
2. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, The scenario parameters are adapted to vertical business scenarios, which include cross-border e-commerce scenarios or financial scenarios. The scenario parameters for cross-border e-commerce scenarios include at least one of platform type, order information, logistics method and customs declaration information. The scenario parameters for financial scenarios include at least one of business type, data standard, regulatory requirements and account information.
3. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, In the dynamic token throttling mechanism, important memory entries are identified either by manual user marking or by automatic identification by the system based on core task parameters and execution results. The automatic cleanup cycle is dynamically adjusted according to the frequency of task types, with the cleanup cycle for high-frequency tasks being shorter than that for low-frequency tasks.
4. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, The pre-defined RPA tool function library includes functions specifically for cross-border e-commerce and functions specifically for finance. The functions specifically for cross-border e-commerce include order synchronization functions and customs declaration data verification functions. The functions specifically for finance include credit review functions and regulatory report generation functions. The RPA tool function library allows users to add and modify functions and access the system through a registration mechanism.
5. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, Other similar AIAgent platforms include at least one of WorkBuddy, CoPaw, KimiClaw, LobsterAI, or ManusAI. The standardized AIAgent platform interface supports switching between different platforms by configuring the interface address, calling key, and request format.
6. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, The RPA tool function library's caching mechanism sets a cache expiration time. When the task parameters exceed the set cache expiration time, the corresponding cached data is cleared and the RPA tool function is re-triggered to execute.
7. The low-token automated execution method based on OpenClaw and RPA according to claim 1, characterized in that, At the node where the exception occurs, the large model LLM call process includes parsing the error logs generated by the RPA execution failure, determining the error type, generating a targeted correction plan, and having the RPA tool function library re-execute the task according to the correction plan.
8. A system for a low-token automated execution method based on OpenClaw and RPA according to any one of claims 1-7, characterized in that, include: The instruction parsing module is used to receive natural language instructions and parse the natural language instructions into standardized task parameters using a preset structured instruction template; The LLM layered invocation module is used to control the large model LLM to be invoked only at the task start node, the exception occurrence node, and the result summary node, generating the RPA execution sequence, error correction scheme and natural language feedback, and blocking the LLM invocation in the intermediate execution steps; The Token Throttling module is used to set the maximum token threshold for a context, perform automatic cleanup of non-critical contexts, retain important memory entries that have been marked, and limit the number of historical interaction rounds. The RPA tool scheduling module is used to manage the preset RPA tool function library, execute task scheduling and cache the same task parameters, and directly return the execution result when the cache is hit; The output module is used to receive the structured execution results after the RPA tool function has been executed, and convert them into natural language feedback through LLM; The platform compatibility module provides a standardized AIAgent platform interface, supporting seamless switching between the OpenClaw framework and other similar AIAgent platforms, requiring only modification of interface configuration parameters during switching.
9. The low-token automated execution method and system based on OpenClaw and RPA according to claim 8, characterized in that, The preset structured instruction template configured by the instruction parsing module can be customized according to vertical business scenarios, including cross-border e-commerce and financial scenarios. The customized instruction template includes at least one exclusive parameter among platform type, order information, business type, and regulatory requirements.
10. A low-token automated execution method and system based on OpenClaw and RPA according to claim 8, characterized in that, The RPA tool scheduling module integrates a cache unit, which stores task parameters and corresponding execution results, and supports setting a cache expiration time. When the expiration time is reached, the cached data is automatically cleared.