Agent training-oriented long-range trajectory data generation method and device

By parsing GUI descriptions and task templates in a programmable interactive simulation environment and using a state transition engine to calculate GUI states, the controllability and consistency issues of long-range GUI agent training data generation are solved, achieving stable and reliable data generation.

CN123157779APending Publication Date: 2026-11-24CHINA ACADEMY OF INFORMATION & COMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611479539.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-22
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies struggle to generate stable and controllable long-term GUI agent training data without relying on the results of real application execution, especially in cross-page, multi-step tasks, where state continuity and consistency in fault sample construction are difficult to guarantee.

Method used

Through a programmable interactive simulation environment, long-range trajectory data is generated using declarative GUI descriptions, task templates, and fault application rules. This includes parsing the interface element structure, semantics, and state transition rules. Combined with the state transition engine, the next GUI state is actively calculated, and the trajectory context before and after each action is recorded to ensure state continuity and the controllability of fault injection.

Benefits of technology

It enables the generation of consistent long-range GUI agent training data in an isolated environment, improving the controllability, efficiency, and reproducibility of data generation, reducing dependence on the real environment, and ensuring the stability and consistency of fault samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157779A_ABST
    Figure CN123157779A_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for generating long-range trajectory data for agent training. The method includes: parsing and running GUI description data to generate an initial simulation rendering interface and a GUI state snapshot; performing multi-step continuous actions of the GUI agent based on the task objective, the initial simulation rendering interface, and the GUI state snapshot; updating the simulation rendering interface and the GUI state snapshot after each action, determining whether it is suitable to inject a fault, and detecting whether a preset termination condition is met; recording the trajectory context before and after each action and before and after fault injection in the task execution session; and forming long-range trajectory data based on the data recorded through the task execution session when the preset termination condition is met. This invention can improve the efficiency and reliability of generating long-range training data for GUI agents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent agent technology, and in particular to a method and apparatus for generating long-range trajectory data for intelligent agent training. Background Technology

[0002] With the development of multimodal large-scale models and edge-side intelligent agents, GUI agents capable of understanding and manipulating graphical user interfaces are gradually becoming an important technological form for human-computer interaction on smart terminals. These agents not only need to recognize controls and semantics in the current interface, but also need to continuously perform operations such as clicking, inputting, swiping, returning, and switching pages in long-term tasks across pages, multiple steps, and even applications, while maintaining navigation history, task progress, cross-page business data, and exception handling status. Existing GUI agent training data mainly comes from real-world terminal data collection or manually constructed interactive environments, providing screenshots, operational behaviors, or partial task logic. However, for long-term task training and evaluation, it is necessary to further ensure the continuity of interaction states, the interpretability of state changes, the reproducibility of execution paths, and the on-demand construction of abnormal branches.

[0003] One common approach involves directly collecting screen recordings, screenshots, DOM (Document Object Model) information, and operation logs from real apps, web pages, or desktop applications. For example, AITW records screen activity and user actions on the device; Mind2Web records clicks, inputs, and selections on real websites, along with corresponding webpage structure information; and OSWorld constructs cross-application operation tasks using real web pages and desktop applications, setting up the initial environment and verifying results. This approach can obtain interactive data with realistic visuals and business semantics. However, as the number of tasks and the length of the trajectory increase, application versions, account status, network services, background data, and environment resets can all affect the actual execution results of the same task. Furthermore, real interface data may involve user information, third-party interface resources, and business logic authorization issues.

[0004] Another approach reduces reliance on real-world business applications by using pre-built web pages, task scripts, static screenshots, or simulated environments. While this improves environmental controllability and repeatability, when tasks expand from single-page operations to long-running processes like searching, navigation, form filling, shopping carts, checkout, and returning, it requires maintaining continuous information such as page navigation, control states, cross-page data, task stages, and failure recovery. As the number of pages, tasks, and exception branches increases, these logics are implemented in different scripts or task code, making it difficult to maintain consistent state semantics and transition rules. System expansion may also require simultaneous modifications to multiple locations, resulting in low efficiency and poor controllability. Therefore, this approach cannot meet the needs of generating long-range trajectory data.

[0005] In addition, the construction of fault samples in existing technologies often requires repeated operations to modify the environment or additional changes to the conditions. This traditional manual sample creation method is not only cumbersome and time-consuming, but also prone to introducing irrelevant variables due to human error, resulting in feature drift and poor consistency of the generated fault samples, making it difficult to achieve stable training and accuracy iteration of the intelligent agent. Summary of the Invention

[0006] This invention provides a method for generating long-range trajectory data for agent training, which drives the generation of long-range trajectory data based on a programmable interactive simulation environment. This eliminates the need for repeated modifications to the physical environment and can stably construct fault features, improving the efficiency and reliability of long-range training data generation for GUI agents. The method includes: Receive GUI description data, task template, and fault application rule data; the GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements; the task template includes task objectives and success conditions; the fault application rule data includes fault injection conditions and fault recovery conditions; The GUI description data is parsed and processed to generate an initial simulation rendering interface and a snapshot of the GUI state. Based on the task objective, the initial simulation rendering interface, and the GUI state snapshot, a GUI agent performs multiple continuous actions. After each action is executed, the simulation rendering interface and the GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether a preset termination condition is met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes at least one of the following: GUI state snapshot, GUI state difference, interface screenshot, action identifier, time step identifier, and task progress. When the preset termination conditions are met, long-range trajectory data is generated based on the data recorded through the task execution session.

[0007] This invention also provides a long-range trajectory data generation device for agent training, which drives long-range trajectory data generation based on a programmable interactive simulation environment. It eliminates the need for repeated modifications to the physical environment and can stably construct fault features, improving the efficiency and reliability of long-range training data generation for GUI agents. The device includes: The environment generation module is defined to receive GUI description data, task templates, and fault application rule data. The GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements. The task template includes task objectives and success conditions. The fault application rule data includes fault injection conditions and fault recovery conditions. The GUI description data is parsed and executed to generate an initial simulation rendering interface and a GUI state snapshot. The sandbox simulation module is used to perform multi-step continuous actions of the GUI agent based on the task objective, the initial simulation rendering interface, and the GUI state snapshot. After each action is executed, the simulation rendering interface and GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether a preset termination condition is met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes at least one of the following: GUI state snapshot, GUI state difference, interface screenshot, action identifier, time step identifier, and task progress. The trajectory generation module is used to generate long-range trajectory data based on data recorded through the task execution session when preset termination conditions are met.

[0008] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0009] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0010] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0011] In this embodiment of the invention, GUI description data, task templates, and fault application rule data are defined. Interaction trajectories are directly generated in an isolated, programmable GUI state transition environment. After each action is executed, the simulation rendering interface and GUI state snapshot are updated, it is determined whether a fault injection is suitable, and whether preset termination conditions are met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. A consistent initial environment and multi-time-step state transition processes can be repeatedly generated. Pages, controls, paths, and boundary states can be expanded as needed for the task, enabling long-term task data to be continuously generated in an isolated environment with unified state semantics. This improves controllability, efficiency, reproducibility, and scalability, and reduces dependence on real accounts, real-time business states, and continuous external services. For abnormal data, after each action is executed, it is determined whether a fault injection is suitable. Combining the fault application rule data with fault injection and recovery, effective fault scenario sample data can be generated, stably reproducing fault characteristics, avoiding human bias, and ensuring sample consistency. The embodiments of the present invention improve the ability and reliability of GUI agent trajectory data generation, and can continuously generate structured multimodal data suitable for long-term planning, state memory, state prediction, error diagnosis, recovery control and safety boundary evaluation of GUI agents. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 This is a flowchart illustrating the long-range trajectory data generation method for agent training in an embodiment of the present invention. Figure 2 This is a schematic diagram of the deterministic GUI generation process in an embodiment of the present invention; Figure 3 This is a schematic diagram of GUI state changes in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the continuity of long-term session tasks in an embodiment of the present invention; Figure 5 This is a flowchart illustrating the single-step interaction of the GUI Agent sandbox in an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the process of generating homologous multimodal trajectories and datasets in an embodiment of the present invention; Figure 7 This is a schematic diagram illustrating trajectory playback and consistency verification in an embodiment of the present invention; Figure 8This is a first schematic diagram of the overall technical solution in an embodiment of the present invention; Figure 9 This is a second schematic diagram of the overall technical solution in an embodiment of the present invention; Figure 10 This is a schematic diagram of a long-range trajectory data generation device for intelligent agent training in an embodiment of the present invention. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0014] A common way to obtain existing GUI Agent interaction data is to directly rely on real APP, web page or operating system environment for operation and collection.

[0015] When relying on real-world application environments for trajectory collection, task execution results are easily affected by changes in application version, account login status, network responses, backend business data, and page resources. To ensure consistent initial conditions across different test processes, additional configuration of login information, service environment, business data, and environment reset mechanisms is typically required. As the number of applications, task length, and concurrency scale increase, the complexity of environment deployment, maintenance, and recovery also rises. Furthermore, while trajectory data can save screenshots, webpage structure, or state snapshots before and after action execution, the generation of intermediate states is still primarily controlled by the external system's own business logic. For cross-page, multi-step tasks, information such as navigation history, form content, selection status, shopping cart data, and task progress may reside on different pages or in backend services. Relying solely on screenshots, DOM information, or action logs for correlation makes it difficult to form a unified, calculable, and progressively verifiable long-term state representation.

[0016] In real-world applications, abnormal states are also influenced by actual operating conditions. For example, network anomalies, page not refreshing, pop-up obstruction, inventory changes, login failures, and security verification issues often present challenges in timing and location control according to training requirements. Obtaining specific failure paths or recovery samples often requires repeated manipulation of the real environment or additional changes to external conditions, making it difficult to consistently construct a reliable correlation between fault states, preceding actions, and subsequent recovery results. Furthermore, real-world apps or websites may involve the authorization and compliance processing of user data, third-party interface resources, and business information during large-scale, repeated data collection and dataset distribution. Therefore, while real-world environments can provide highly realistic interactive observations, the continuous generation of large-scale, repeatable long-term state evolution data and specified anomaly recovery data still requires complex environmental control and state management mechanisms.

[0017] To reduce reliance on the continuous operation of real-world commercial applications, existing solutions also construct GUI Agent training and evaluation data through pre-made web pages, manually designed task environments, and static screenshots.

[0018] While pre-built web pages improve the controllability of the task environment, their page logic and interaction rules are often scattered across specific page scripts, task code, or specific simulation components. When tasks expand from single-page operations to cross-page, multi-step processes, it is necessary to simultaneously maintain control properties, navigation history, input content, selection states, cross-page business data, and task success conditions. As the number of pages, tasks, and exception branches increases, these logics are implemented in different scripts or task code, making it difficult to maintain consistent state semantics and transition rules. System expansion may also require simultaneous modifications to multiple locations. For data primarily consisting of static screenshots or GUI target localization, the supervisory information is mainly built around the current interface and target controls, suitable for single-step perception and localization, but cannot directly reflect the complete state changes before and after action execution, as well as navigation history, task progress, and cross-page business context in long-term tasks.

[0019] The core technical problem to be solved by this invention is to construct a programmable interactive simulation mechanism for GUI Agent training and evaluation, enabling the GUI environment itself to have a unified and computable state representation and explicit state transition rules. Without continuously relying on the results of real application execution, it can generate long-term interactive processes that are cross-page, cross-step, and state-continuous according to task constraints. This not only ensures that actions correspond to their decision states in time, but also allows the state transition engine to actively calculate the next GUI state after an action is executed. Simultaneously, it constructs semantically compatible fault states for the current GUI state, target action, and task context, distinguishing whether preceding actions have taken effect, whether faults are blocking, and whether manual intervention is required, and verifies the recovery process and the state results after recovery. Furthermore, it ensures that screenshots, actions, normalized events, previous and subsequent states, state differences, task progress, fault diagnosis, and recovery results are all generated from the same simulation time step and remain consistent.

[0020] To achieve the above objectives, embodiments of the present invention use declarative GUI descriptions, task templates, and random seeds to generate an executable GUI object graph and initial state. Verified normalized events are used as inputs for state evolution. The state transition engine actively calculates the next GUI state and state differences, and a session mechanism is used to maintain the consistency of navigation history, cross-page business data, task progress, and visual output. Based on this, the embodiments of the present invention form five mutually cooperating technical mechanisms: First, the next GUI state is actively calculated by the current GUI state and verified events, and each state version has a clear previous state and event source; Second, actions, events, and state transitions are expressed in layers, preserving both the operational intent of the GUI Agent and recording the standardized inputs and state results actually received by the environment; Third, pages, controls, navigation relationships, task contexts, and cross-page business data together form a dedicated discrete state space for the GUI, and interface rendering is directly derived from the state; Fourth, fault branches must be compatible with the source state, source action, and expected transition, forming a closed loop of diagnosis, limited recovery, and post-verification; Fifth, the previous state, action, event, subsequent state, state difference, screenshot, and task result at the same time step are synchronously generated by the same state transition process and can be recalculated and verified step by step through ordered events. This forms a closed loop of GUI interaction data that is generative, branchable, replayable, verifiable, and auditable.

[0021] First, the technical terms proposed or involved in the embodiments of this invention will be explained.

[0022] GUI (Graphical User Interface): A graphical human-computer interaction interface consisting of pages, controls, their visual attributes, layout relationships, and interaction relationships.

[0023] GUI Agent (Graphical User Interface Agent): An intelligent agent that has the ability to understand the state of the GUI interface, make task decisions, and perform interactive operations such as clicking, inputting, swiping, and returning.

[0024] DSL (Domain-Specific Language): A declarative description language for GUI simulation and task description, used to represent page, control, navigation relationships, task constraints, and state transition rules.

[0025] GUI State: A complete snapshot of the GUI environment at a specific moment, including page state, control state, navigation state, task state, and cross-page environment information.

[0026] Action: The intent of operation proposed by the GUI Agent or user simulator, including action type, target control, and action parameters.

[0027] Events: Standardized state transition inputs formed after action resolution and execution condition verification, or explicit state change inputs generated by navigation, system, and task mechanisms.

[0028] Session: An execution unit that organizes continuous states, actions, events, screenshots, and task progress for long-term tasks.

[0029] State differences: Incremental changes between adjacent GUI states, including page, control, navigation, and metadata changes.

[0030] Task template: includes a structured definition of task objectives, task prerequisites, task success conditions, task failure conditions, and task execution constraints.

[0031] Trajectory: A collection of time-series interactive data consisting of continuous GUI states, actions, events, state differences, screenshots, task results, and related annotations.

[0032] State transition engine: A state evolution component that calculates the next GUI state and state differences based on the current GUI state and events.

[0033] Task executor: A component that updates the task progress and makes task judgments based on the task objective, task prerequisites, task success conditions, and task failure conditions.

[0034] Simulation execution engine: An execution scheduling component that coordinates event submission, state transition, UI rendering, and task determination on a time-step basis.

[0035] Action adaptation module: A component that converts actions into standardized events.

[0036] Interface renderer: A component that generates screenshots based on the GUI state.

[0037] Rule dispatch module: A component that selects state transition rules based on normalized event type, target control semantics, current page, and task context.

[0038] Immutable state constructor: A component that generates the next GUI state version based on the current GUI state and state transition rules while retaining the previous state.

[0039] Fault renderer: Synchronously constructs observable fault components in the GUI state and rendering interface according to the fault type.

[0040] Playback Controller: A component that resubmits events and reconstructs the GUI state sequence according to the recorded time steps and event sequence.

[0041] Step-by-step comparator: A component that compares the reconstructed GUI state with the recorded GUI state step by step over time.

[0042] Track recorder: A component that records the trajectory context, such as GUI state, actions, events, screenshots, and task progress, step by step.

[0043] Labeling engine: A component that generates interface semantics, tasks, faults, and safety monitoring information based on data from the same time step.

[0044] Figure 1 This is a flowchart illustrating a long-range trajectory data generation method for agent training in an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes: Step 101: Receive GUI description data, task template, and fault application rule data; the GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements; the task template includes task objectives and success conditions; the fault application rule data includes fault injection conditions and fault recovery conditions. Step 102: Parse and run the GUI description data to generate the initial simulation rendering interface and GUI state snapshot; Step 103: Perform multi-step continuous actions of the GUI agent based on the task objective, the initial simulation rendering interface, and the GUI state snapshot; wherein, after each action is executed, the simulation rendering interface and the GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether the preset termination condition is met. The trajectory context before and after each action is executed and before and after fault injection is recorded in the task execution session; the trajectory context includes at least one of the following: interface screenshot, GUI state snapshot, GUI state difference, action identifier, time step identifier, and task progress. Step 104: When the preset termination conditions are met, long-range trajectory data is generated based on the data recorded through the task execution session.

[0045] Figure 1 This paper demonstrates the necessary process of a long-range trajectory data generation method for agent training in an embodiment of the present invention. In this embodiment, the received data includes, but is not limited to, GUI description data, task templates, and fault application rule data. Subsequently, long-range trajectory data is generated based on the GUI description data, task templates, and fault application rule data. The following section provides a detailed introduction to this method from several aspects, including GUI formal description and deterministic initial state generation, state transition, long-range conversation, simulation environment deduction, fault handling, and multimodal trajectory generation.

[0046] I. Formal Description of GUI and Generation of Deterministic Initial States

[0047] In this embodiment, a declarative GUI description is used to construct an executable GUI object graph and a deterministic initial state.

[0048] GUI description data includes, but is not limited to, data reflecting the structure, semantics, position, and state transition rules of interface elements. Specifically, GUI description data includes at least one of the following: scene description, page, control, attribute, navigation relationship, and state transition rules. For example, a scene description is used to describe the pages, controls, and their organizational relationships in a GUI scene; attributes are used to describe control identifiers, types, text, values, visibility, operability, and boundaries, etc.

[0049] GUI description data can be structured configuration files, script objects, or other declarative configuration files, as long as they can generate a GUI object graph and an initial state. The GUI description data serves as static declarative input, which is parsed to form a GUI object graph and an executable GUI instance. The specific values ​​taken during runtime are carried out by GUI state snapshots.

[0050] In one preferred embodiment, the GUI description data includes a GUI domain-specific language description used to characterize pages, controls, navigation relationships, task constraints, and state transition rules. The GUI domain-specific language description is used to declare application, page, control, attribute, navigation relationship, and state transition related fields.

[0051] Step 102 parses and runs the GUI description data to generate an initial simulation rendering interface and a snapshot of the GUI state. For example, it parses and semantically validates the scene description to generate a GUI object graph containing pages, controls, navigation relationships, task context, and state transition rules, as well as the initial GUI state.

[0052] In one embodiment, before parsing and running the GUI description data in step 102 to generate the initial simulation rendering interface and GUI state snapshot, the method may further include: receiving interface simulation configuration parameters and a random seed; the interface simulation configuration parameters are used to define operating rules such as device resolution, maximum time step, logical time advancement, resource limit and rendering parameters; Step 102 parses and runs the GUI description data to generate an initial simulation rendering interface and a GUI state snapshot, which may include: Lexical and syntactic analysis are performed on the GUI description data to form an abstract syntax tree; Semantic validation based on abstract syntax trees; After verification, based on the GUI description data, interface simulation configuration parameters, and random seed, instantiation is performed to generate a GUI object graph; the GUI object graph includes a control graph, a navigation graph, and an event set. An initial simulation rendering interface and a GUI state snapshot are generated based on the GUI object graph; the GUI state snapshot includes at least one of the following: GUI state identifier, current page, navigation state, control tree, focus state, selection state, task execution state, metadata, and task context.

[0053] Semantic validation focuses on checking structural integrity, control and page references, attribute value ranges, navigation relationships, and task constraints. After semantic validation passes, a pre-defined graphical interface generator constructs a GUI object graph containing a control graph, a navigation graph, and an event set, and further generates the initial GUI state.

[0054] Figure 2 This is a schematic diagram of the deterministic GUI generation process in an embodiment of the present invention, such as... Figure 2 As shown, the domain description source file is the page, control, attribute, navigation relationship, task constraint, and transition rule declared in a domain-specific language. The lexical analyzer breaks down the source file into a stream of lexical units, the syntax analyzer organizes the lexical units into an abstract syntax tree, and the semantic validator checks the validity of the structure, references, attribute values, and navigation relationships. After semantic validation passes, a GUI object graph consisting of a control graph, a navigation graph, and a set of allowed events is constructed using a preset graphical interface generator. An initial GUI state snapshot with version 0 is generated, and metadata is saved.

[0055] GUI states can include a GUI state identifier, a GUI state version, the current page, navigation state, control tree, focus state, selection state, task execution state, and metadata. Metadata is used to store cross-page environment information such as logical time, battery level, shopping cart, search terms, and user data. The navigation state uses an immutable structure to record information such as the current page, the history page stack, and whether back navigation is allowed. Each valid state transition generates a new GUI state version while preserving the old version from being overwritten, thus forming a traceable, continuous sequence of states.

[0056] Figure 2 The pattern and type rules shown on the right (including reference rules, navigation consistency rules, constraints and completion conditions in the task description file), verification and diagnostic information (error codes, location error reasons), interface simulation configuration parameters, random seeds, and task description data) serve as auxiliary inputs for generation and verification. For example, when verification fails, the verification gate (a functional module) outputs diagnostic information such as error codes, locations, and reasons, providing a pass or rejection conclusion. Same domain descriptions, same configurations, and same random seeds can reproduce consistent random sampling paths and initial business states, thus providing a foundation for subsequent deterministic playback; object identifiers can be generated by independent identifier generation rules.

[0057] II. Event-Driven Immutable State Transitions

[0058] Figure 1 The trajectory context described also includes normalized events. In this embodiment of the invention, state evolution in the GUI environment employs an event-driven mechanism.

[0059] In one embodiment, performing multi-step continuous actions of a GUI agent based on the task objective, the initial simulation rendering interface, and a GUI state snapshot may include: The GUI agent generates an action to be executed based on the task objective, task progress, current simulation rendering interface, and GUI state snapshot; the action to be executed includes at least an action type, a target control, and action parameters. A pre-execution check is performed on the action to be executed, and the action to be executed that passes the pre-execution check is converted into a normalized event; the normalized event is the input of the GUI state change and is used to trigger at least one of page navigation, control update, data change, and task state change; the pre-execution check includes at least one of the following: target control existence check, target control visibility check, target control clickability check, target control editability check, current page meets expectations check, page stack check, and task prerequisite check; Event validation is performed on normalized events based on the current GUI state snapshot; the event validation is used to check whether the target control exists, whether the event type is valid, whether the target control is visible and operable, and whether the navigation state, task prerequisites, task execution constraints, risk authorization, and runtime resource status are satisfied; After the event verification passes, a new simulation rendering interface and GUI state snapshot are generated based on the normalized event, the current simulation rendering interface, and the GUI state snapshot.

[0060] The process of generating new simulation rendering interfaces and GUI state snapshots based on normalized events, the current simulation rendering interface, and GUI state snapshots includes: performing simulated operations on the target controls based on normalized event types, control semantics, the current page, and the task context; copying and modifying the interface changes caused by the simulated operations based on the current simulation rendering interface and GUI state snapshots to obtain new simulation rendering interfaces and GUI state snapshots.

[0061] During implementation, the GUI Agent or user simulator generates actions to be executed based on the current interface state and task objectives. These actions undergo target parsing and execution condition validation. Actions that meet the conditions are converted into normalized events and submitted to the state transition engine. Target parsing is only used to resolve target references in actions to target controls in the current GUI state and to perform parameter checks.

[0062] Normalized events serve as direct inputs to GUI state changes, triggering page navigation, control updates, data changes, or task state changes. For example, clicking the search entry point generates a click event after validation, while entering keywords generates an input event. After the corresponding events are executed, navigation, control, or task-related events can be further generated based on the state transition results.

[0063] As can be seen, actions primarily describe the intended operation of the GUI Agent or user simulator, while events represent the standardized input for entering the simulation state transition process. Events may include event type, target control identifier, load, time information, and session information. The event normalization process includes action type mapping, target parsing, parameter format standardization, and context supplementation.

[0064] Normalized events can include user events, navigation events, control events, system or task events, etc.

[0065] User events can include clicks, input, scrolling, dragging, swiping, and zooming; navigation events can include pushing onto the stack (entering the page), popping from the stack (exiting the page), and returning; control events can include control creation, deletion, updating, and focus changes; system and task events can include timing, clock progression, theme changes, task start, task completion, and task failure. System and task events can also be generated by a simulated clock or a task executor, where the task executor is used to check task prerequisites and execution constraints, update task progress, and determine whether the task is completed. From different perspectives, events can also include input events, click events, and return events.

[0066] Figure 3 This is a schematic diagram of GUI state changes in an embodiment of the present invention, such as... Figure 3 As shown, the state transition main chain sequentially includes GUI states at different time steps and standardized events. The unified associated identifiers include session identifiers, time step identifiers, GUI state identifiers, and event identifiers. GUI state differences record page, control, navigation state, task state, and metadata changes, while also recording interface screenshots and trajectories, current state, actions, events, and subsequent states. Task execution information includes task progress, reward value, and termination flag. Sessions uniformly store initial state, ordered events, state history, screenshots, and metadata.

[0067] The task execution session records the current interface state (current version), event validation (verifying the existence of the target control and the validity of the event type), rule dispatch (clicks, inputs, returns, and system events; system events include logical time progression, timeouts, window state changes, and internal environment scheduling events), immutable state construction (copying and updating necessary fields), and the incremental version of the new interface state. The current GUI state and normalized events enter the event validation phase together. First, it checks whether the target control exists, whether the event type is valid, whether the control is visible and operable, and whether the navigation state, task prerequisites, task execution constraints, risk authorization, and resource state are satisfied. After successful validation, the rule dispatch module selects a matching state transition rule based on the event type, control semantics, current page, and task context, and executes page navigation, control state updates, business data updates, or task state updates. The immutable state constructor copies and updates affected fields while preserving the original state, forming a new GUI state with an incremental version, thus enabling continuous tracking and playback of state changes between adjacent time steps.

[0068] For different types of interactions, input events can update the text content in the target control; click events can trigger transitions such as selection, adding to cart, and page switching based on the target control and the current task status; and return events determine whether backtracking is allowed based on the page history in the navigation status. After a state transition is completed, the system synchronously generates the state transition result, GUI state differences, screenshots of the interface before and after the action execution, and a trajectory record. The state transition result includes whether the event was executed successfully and the reason for the error if it failed. The GUI state differences include what changes have occurred to the page, fields, or controls. The interface renderer generates the interface rendering result, and the trajectory record covers the GUI state, event identifier, time step identifier, etc., before and after the action event execution. Therefore, the same state transition process can further distinguish different execution situations such as the action not taking effect, the business status having changed but the interface not yet refreshed, and the preceding action having taken effect.

[0069] In this embodiment, after generating a new simulation rendering interface and GUI state snapshot based on the normalized event, the current simulation rendering interface, and the GUI state snapshot, the method may further include: updating the task progress, reward value, termination flag, and GUI agent memory based on the GUI state difference changes and the task objective; the reward value is used to quantify the degree to which the GUI state change after the action is executed advances the task objective; the termination flag is used to determine whether a preset termination condition is met, thereby detecting whether the preset termination condition is met after each action is executed based on the termination flag.

[0070] III. Long-Term Session Continuity and Path Constraints

[0071] In this embodiment of the invention, after each action is executed, the simulation rendering interface and GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether the preset termination conditions are met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes: screenshots of the interface before and after the action, GUI state snapshots and GUI state differences, action identifiers, time step identifiers, normalized event identifiers, task progress, reward value, termination flag, and metadata, etc. Finally, long-range trajectory data is formed based on the data recorded in the task execution session.

[0072] In this embodiment of the invention, the session is used to organize continuous states, actions, events, screenshots, and task execution information in long-term tasks. For example, in a continuous state evolution chain, states [0] to [N] represent continuously saved GUI state versions; state [0] is transformed into state [1] through event [1], and state [1] is transformed into state [2] through event [2], until the task is completed. Candidate actions are only a feasible set of strategies to choose from in the current state, and do not have a fixed global order; only events that are selected, pass the verification, and are actually submitted form a strict time sequence according to the incremental time steps, and satisfy state [i] = T(state [i-1], event [i]). In this embodiment, "identifiers" include session identifiers, time step identifiers, GUI state identifiers, and event identifiers, used to associate data objects at the same time step, including state differences, screenshots, task progress, and trajectory context, etc., at the same time step. "State differences" record incremental changes in pages, controls, and metadata. The "interface renderer" generates screenshots at the same time step based on the corresponding state. "Task progress" is calculated by the task executor based on prerequisites, postconditions, and success or failure conditions, and associated with reward values ​​and termination flags (wherein, for example, the task prerequisite for an input action can be the existence, visibility, and editability of the target input box; the corresponding state postcondition can be the text in the input box being updated to the target content). "Track entries" summarize and save the previous state, action, event, and subsequent state; state differences, screenshots, task progress, reward values, and termination flags are associated with the trajectory entry through the same time step identifier. Session storage uniformly saves the initial state, ordered events, state history, screenshots, task state, and metadata, thereby ensuring continuity of logical time, navigation history, cross-page business data, visual output, and task progress in adjacent time steps.

[0073] A long-running task, from initialization to termination, corresponds to a task execution session, and a session identifier is established; multiple different sessions can be created using the same task template.

[0074] Task progress represents the degree to which the current GUI state advances the task objective and whether the conditions for task success or failure are met. The reward value quantifies the degree to which the GUI state change after the current action advances the task objective, and can be determined based on task progress, valid state changes, erroneous operations, and task success or failure. The termination flag indicates whether the current task has ended, triggered when the conditions for task success, task failure, maximum time step limit, resource limit, or manual takeover are met. All of the above information is calculated by the task executor based on the task template, state transition results, and the current GUI state. Session storage is used to save the initial state, ordered events, state history, screenshots, task state, and cross-page metadata.

[0075] Figure 4 This is a schematic diagram illustrating the continuity of long-term session tasks in an embodiment of the present invention, such as... Figure 4 As shown, the system receives the task objective, task description data, and the current GUI state. Based on this, the GUI Agent proposes candidate actions and performs action-target control verification, navigation-task prerequisite verification, and other checks. The right side indicates the execution of pre-verification content and event verification. The state transition engine executes normalized events and generates the next GUI state. The state transition rules on the right include page semantics, business semantics, and control semantics. Then, the system evaluates the task success and failure conditions to determine whether to continue execution, complete the task, or fail. Combining the resource constraints on the right, such as whether the preset maximum number of time steps or the end time has been reached, the system outputs the state transition result, GUI state difference, reward value, and termination flag.

[0076] The task execution process proceeds sequentially as follows: "Task objective and template and current interface state — GUI Agent candidate actions — Action and control validation — Navigation and task prerequisite checks — State transition engine execution — Success condition evaluation — Continue execution, complete, or fail." Pre-execution validation is performed on actions to be executed, and event validation is performed on normalized events. If a pre-execution validation fails, the reason for the failure is recorded. If an event validation fails, the reason for the failure is also recorded. The task progress, reward value, termination flag, and GUI agent memory are updated, and a decision is made on whether to terminate the task.

[0077] IV. GUI Agent Sandbox Simulation and Task Execution

[0078] During implementation, the GUI agent performs multi-step continuous actions based on the task objective, the initial simulation rendering interface, and the GUI state snapshot. This includes performing multi-step continuous actions of the GUI agent in a programmable environment, where the programmable environment is isolated from the real terminal. The structured state summary and the interface screenshot in the trajectory context are both generated based on the same GUI state snapshot, and the interface screenshot is generated directly by the interface renderer based on the GUI state snapshot.

[0079] In this embodiment of the invention, the simulation environment runs in isolation from the real terminal, and a dedicated discrete state space and event transfer mechanism are established for GUI interaction. Pages, controls, page stacks, focus and selection states, task context, and cross-page business data together constitute the executable GUI state; standardized events such as clicks, inputs, scrolling, and returning drive state changes according to explicit transfer rules. The interface renderer is responsible for converting the current GUI state into a visible interface and screenshots. The simulation results simultaneously include the previous and subsequent GUI states, state differences, task progress, state transfer results, and verification information.

[0080] First, observation information and screenshots are obtained from the current GUI state, and the GUI Agent strategy generates candidate actions based on this. The action adaptation module converts the selected actions into normalized events, the simulation execution engine submits the events in a single-step manner, and the state transition engine calculates the new GUI state and state differences. The task executor calculates the reward value and termination flag based on the task success and failure conditions, and the GUI Agent updates the task memory based on the state transition results. If the task has not terminated, the new GUI state directly serves as the observation state source for the next time step, thus forming a closed loop. This mechanism endows the GUI state itself with the technical attributes of being executable, transferable, verifiable, and replayable.

[0081] The single-step interaction follows a closed loop of "observation-decision-execution-update". The interface renderer converts the current GUI state into a screenshot and structured observation. The agent's strategy generates candidate actions based on the task objective and selects the target control and action parameters. The action adaptation module converts the actions into normalized events. The simulation execution engine submits the normalized event at one time step. The state transition engine calculates the new state and state differences. The task executor then calculates the reward value and whether to terminate. The session and timeline save time step records and history. The GUI agent updates its task memory based on the state transition results. If it does not terminate, the new state loop becomes the state source for the next observation. The "sandbox" indicates that the above process runs in a programmable environment isolated from the real terminal and will not have operational side effects on the real business system.

[0082] In this embodiment of the invention, the specific operations of sandbox simulation and task execution include six categories: initialization, observation, decision-making, action execution, state update, and termination. During initialization, a session identifier is created, and the initial GUI state version, page stack, control tree, focus and selection states, task state, and cross-page metadata are set. During observation, a structured state summary is generated from the current GUI state, and the interface renderer generates corresponding screenshots. During decision-making, the GUI Agent outputs the action type, target control, and parameters, such as click, input, scroll, slide, drag, or return. The action adaptation module completes the target and parameter checks and forms a standardized event. The simulation execution engine calls the state transition engine to calculate the next GUI state and state differences, and returns the successful or failed state transition result, reward value, and termination flag. During state update, the current task objective and task progress, state transition result, and the new state summary generated based on the next GUI state are written into the GUI Agent's memory. During termination, the session index, ordered events, state history, screenshots, and verification results are solidified (the recovery verification result describes whether the GUI state after fault recovery meets the recovery verification conditions). In the fault branch, observations also include visible evidence such as error messages, occlusion layers, and non-interactive states. Recovery actions are limited to re-observing, waiting, refreshing, closing the overlay, limited retries, or requesting manual takeover. After each recovery action, the GUI state is recalculated and verification is performed.

[0083] Figure 5 This is a schematic diagram of the single-step interaction process of the GUI Agent sandbox in an embodiment of the present invention. Figure 5 This demonstrates the flow of the GUIAgent's single-step interaction in a programmable environment isolated from the real terminal, following the sequence of "observation-decision-execution-update". The current GUI state snapshot serves as input to both the interface renderer and the structured observation generator. The former generates an interface screenshot, while the latter generates a structured state summary; the two are combined to form the current observation. The screenshot is not generated from the state summary but originates from the same GUI state snapshot. The GUI Agent generates candidate actions based on the task objective, task progress, and current observation. The action adaptation module forms normalized events after completing objective parsing and pre-execution verification. The simulation execution engine coordinates event submissions step-by-step, and the state transition engine verifies the events. Upon successful verification, it calculates the next GUI state and the GUI state difference based on the current GUI state and the normalized events. The task executor updates the task progress, reward value, and termination flag based on the task success conditions, task failure conditions, and actual state changes in the task template. The GUI Agent updates the task memory based on the state transition results. If the task is not terminated, the next GUI state snapshot becomes the observation state source for the next time step along the loop in the diagram. If verification fails, the reason for failure is recorded, and unexecuted actions are not recorded as valid business state changes.

[0084] V. Constrained Fault Injection, Diagnosis, Recovery, and Verification Closed Loop

[0085] In this embodiment of the invention, during the preparation phase, fault applicable rule data is acquired. This fault applicable rule data includes at least fault injection conditions and fault recovery conditions. After each action is executed, the system automatically determines whether it is suitable to inject a fault, as well as the appropriate fault type, based on the action or event, the current GUI state, and the calculated subsequent GUI state changes. The fault is then removed and the interface returns to normal based on the fault recovery conditions.

[0086] In one embodiment, a multi-step continuous action of a GUI agent is performed based on the task objective, an initial simulation rendering interface, and a GUI state snapshot, including: Based on the matching of fault injection conditions with the current page, action primitives, target controls, and expected GUI state changes, suitable fault types are filtered out. Add temporary view objects to the simulation rendering interface and GUI state snapshot according to the adapted fault type; the temporary view objects include at least one of the following: error message, login overlay, activity overlay, page error or security verification; Generate GUI agent candidate actions based on the simulation rendering interface and GUI state snapshot with added temporary view objects; Determine the match between the candidate action and the fault recovery condition. If they do not match, retry the GUI agent action a limited number of times. If they match, remove the fault, update the simulation rendering interface and the GUI state snapshot.

[0087] In one implementation, a fault catalog is maintained. Each fault entry includes at least a fault identifier, fault category, visible evidence, visual variant, applicable rules (i.e., fault injection conditions, fault recovery conditions), whether it is blocking, whether manual intervention is required, whether the preceding actions have taken effect, whether retry is allowed, recovery action template, and verification conditions. Faults are not randomly selected from the catalog without conditions, but rather their applicability is filtered based on the current page type, target control role, action primitives, and expected state changes. For example, page redirection failure only applies to click or input steps where the expected page change is expected; page state not refreshed only applies to state update steps where the business action has taken effect but the display may be outdated; historical shopping cart interference only applies to shopping cart selection steps where there is already a real add-to-cart preceding action.

[0088] For a selected source time step, the pre-fault state S0, attempted action A0, and expected post-fault state of the normal branch are copied. The construction basis of the fault state is determined based on whether the preceding action has taken effect: S0 is maintained when the action has not taken effect; when the action has taken effect but the interface is outdated, the changed business state is retained, while the visible interface still presents the old state; for repeated click-type faults, the state after the first action has taken effect is used as the recovery basis. The fault renderer synchronously adds visible evidence such as error messages, login overlays, activity overlays, page errors, or security verifications to the screenshots and structured perception states, and synchronously updates the occlusion relationships, interactivity, and hierarchical order to avoid modifying only the images without modifying the state labels. Among them, visible evidence represents the error messages, occlusion layers, and other information actually presented to the GUI Agent; visual variants represent different manifestations of the same fault evidence in terms of text, style, and position, without changing the meaning of the fault.

[0089] The diagnostic results are generated after the observable fault state is constructed, describing the current fault state and guiding subsequent recovery actions. Diagnostic result D1 includes at least the error type, base page type, occlusion type, whether it is blocked, whether it is recoverable, whether manual intervention is required, whether the preceding action has taken effect, the current sub-goal, the sub-goal to be executed after recovery, whether the goal is visible, whether the goal is interactive, whether retry is allowed, the current number of retries, and the recovery status. For example, actions with no effect, actions that have taken effect but are displayed outdated, and loading failures are injected faults. Based on the injected faults, the agent is guided to perform appropriate actions to remove the fault. The process follows a computer execution flow of "fault applicability judgment—fault state construction—diagnosis—recovery action selection—state transition—recovery verification." The recovery strategy selects the least risky action based on these diagnostic fields: if the action has no effect, re-observe and perform limited retries; if the action has taken effect but is displayed outdated, perform wait, refresh, or state alignment without resubmitting; if the overlay is occluded, close the overlay and reposition the original goal; if loading fails, wait, re-observe, refresh, and check the main page; if historical state interference occurs, only adjust the selection set consistent with the current task. Each step records the expected state, the actual state, the alternative safety stop action, the maximum number of retries, and the termination condition.

[0090] During the diagnosis phase, a diagnosis result is generated based on the fault type, blockage attributes, and manual takeover flag. If manual takeover is required, the recovery strategy only outputs a manual takeover request and stops automatic operation. If automatic recovery is possible, the recovery strategy selects a recovery action, which is then executed through action adaptation and state transition.

[0091] For security verifications requiring manual intervention or login credential blocking, the system sets the current GUI status to "Waiting for Manual Intervention," and the only automatic recovery action is "Request Manual Intervention." The number of retries is set to zero, and the termination condition is that a manual intervention request has been issued. The system must not generate verification code answers, sliding distances, puzzle coordinates, unknown account passwords, fictitious verification completion events, or automatic business actions following verification. For automatically recoverable faults, after recovery, verification condition V checks whether the blocking element has disappeared, whether the page main body and target controls have reappeared, whether the business status is consistent with the previous action result, or whether the expected page has been entered. A secure stop is executed if verification fails or the retry limit is exceeded.

[0092] Normal samples and faulty samples are associated through a parent sample identifier, and the recovery trajectory is saved according to S0, A0, S1, D1, recovery sequence, S2, V, and the optional next action. Fault injection parameters, internal real business states, and internal rewards only enter the privileged metadata channel; the input to the model (e.g., a downstream GUI agent model or policy model using the generated training or evaluation data) only includes screenshots, task instructions, and publicly available history, while diagnostic results, recovery actions, state transitions, and security supervision tags (used to mark whether sensitive or irreversible operations are involved, whether authorization or manual takeover is required, and whether automatic recovery is allowed, etc.) serve as supervision targets. Thus, the system can generate reproducible, verifiable GUI error recovery training and evaluation data without leaking internal answers to the model input, without relying on actual failures in the real application. The parent sample identifier points to the normal source sample or source time step on which the current faulty sample was generated, thereby establishing a traceable association between normal samples and derived fault recovery samples.

[0093] VI. Generation of Homologous Multimodal Trajectories and Datasets

[0094] In one embodiment, forming long-range trajectory data based on data recorded through task execution sessions may include: A single training sample is formed by sorting the session identifier, interface screenshot, action sequence, normalized event sequence, GUI state snapshot sequence, GUI state difference sequence, task information, and metadata by time step. A single training sample is divided into three categories: model input, supervision target, and privileged metadata used only for quality inspection, and the output is structural trajectory data; the trajectory context before and after fault injection is incorporated into the privileged metadata.

[0095] Figure 6 This is a schematic diagram illustrating the process of generating homologous multimodal trajectories and datasets in an embodiment of the present invention, such as... Figure 6 As shown, Figure 6This demonstrates the process of generating multimodal trajectories from state transition facts at the same time step and exporting data hierarchically. The GUI state before the state transition, actions and normalized events, the GUI state after the state transition, and the task context and task judgment results together constitute the synchronous fact source, corresponding to each other through a unified association key composed of session identifier, time step identifier, GUI state identifier, and event identifier. This association key is used for data alignment and does not assume responsibility for event distribution or GUI state generation. The interface renderer generates before-and-after screenshots of actions based on the corresponding before-and-after GUI states. The action serializer records the action type, target control, and parameters. The state serializer and state difference processing stage record the before-and-after state and changed fields. The interface semantics and task annotation stage records the control roles, task instructions, and task success or failure results. All data corresponds to the same event and time step. The multimodal sample assembly stage merges the above data according to the unified association key and organizes it into a structured trajectory according to time steps. When exporting, the data is divided into three categories: model input only includes screenshots, task instructions, publicly available history, and publicly available observations; supervision targets include target actions, state differences, diagnostic results, and recovery and security supervision labels; privileged metadata stores the internal real business status, fault parameters, internal rewards, and generated quality inspection information, which is only used to generate quality inspections and is not used as visible input to the model to avoid leakage of internal answers.

[0096] Model input consists of GUI screenshots, task instructions, and public history that are actually visible to the downstream model; supervision targets are target actions, diagnostic actions, recovery actions, or task results used for training or evaluation; privileged metadata is only used for data generation, quality control, and auditing, and is not used as model input.

[0097] Content enrichment is an optional extension. The system can provide visual content for the page using image placeholders or an external image generation backend, and can also generate product descriptions, selling points, reviews, or task copy using an external language model; product, image, description, review, and application templates can be stored in a relational database or other data storage components. The aforementioned external generation and storage components are not necessary conditions for the core state transition mechanism of this invention to function, and can be replaced or disabled depending on the deployment environment.

[0098] VII. Trajectory Replay, State Differentiation, and Consistency Verification

[0099] In one embodiment, after forming long-range trajectory data based on data recorded through task execution sessions, the method may further include: during trajectory playback, loading the initial GUI state snapshot and event sequence of the session, and reconstructing the complete state sequence by time step; during the reconstruction process, only the previous reconstructed state and the current event are used as state transition inputs, and the recorded state is used as a comparison benchmark, the reconstructed state is compared with the recorded state, and the output is passed or failed, the first inconsistent time step, the inconsistent field, and the reason for failure.

[0100] To ensure the auditability of normal and fault recovery trajectories, key states and events are saved and replayed. During replay, the initial GUI state, metadata, and deterministic inputs of the session are loaded first, including domain description, interface simulation configuration parameters, random seed, and GUI state version information. Then, the original ordered event sequence is loaded. The replay controller submits events to the state transition engine step-by-step to reconstruct the complete state sequence. During reconstruction, only the previous reconstructed state and the current event are used as state transition inputs; recorded subsequent states do not participate in the next state calculation and are only used as a comparison benchmark. Subsequently, a step-by-step comparator compares the reconstructed state with the recorded state sequence, compares the recalculated state differences with the recorded state differences, and checks whether the expected page, focus, and business data are consistent, combined with the task success conditions. The final output is either pass or fail, the first inconsistent time step, the inconsistent field, and the reason for failure. For fault branches, the fault state S1, the recovered state S2, and the verification condition V are further compared to check whether actions already in effect are repeated, whether the retry limit is exceeded, and whether the manually taken-over branch terminates safely after the takeover request. This mechanism enables replay to be completed by re-executing the same state transition causal chain, and can be used for deterministic replay, regression testing, error localization, incremental annotation, and recovery strategy evaluation.

[0101] During playback, the initial session state and metadata are loaded first, followed by ordered events loaded according to the original time steps. The playback controller progressively submits events to the state transition engine, thereby recalculating the reconstructed state sequence. Recorded states and state differences are only used as comparison benchmarks and not as inputs for state reconstruction. The step-by-step comparator compares the reconstructed state with the recorded state, the recalculated state differences with the recorded differences, and the task success conditions item by item. The deterministic inputs on the right include the domain description, interface simulation configuration parameters, random seed, and GUI state version. The comparison benchmarks include the recorded state sequence, recorded state differences, and expected page, focus, and business data. The final consistency result not only provides pass or fail but also the first inconsistent time step, field differences, and reasons. The fault branch also compares the fault state, the recovered state, and the recovery verification conditions to identify problems such as repeated execution, exceeding the retry limit, or continued operation after manual takeover.

[0102] Figure 7 This is a schematic diagram illustrating trajectory playback and consistency verification in an embodiment of the present invention. Figure 7 This demonstrates the process of reconstructing the GUI state by re-executing ordered events and verifying trajectory consistency step by step. First, the initial GUI state snapshot, metadata, and recorded results of the session are loaded, and the GUI domain-specific language description, interface simulation configuration parameters, random seed, and corresponding runtime version conditions are restored. Then, the normalized event sequence under the original time-step order is loaded. Figure 7In the sequence, E1 to EN represent the normalized events recorded sequentially, and N represents the number of events in the sequence. The playback controller submits events sequentially by time step. The state transition engine calculates the next GUI state using only the previous reconstructed GUI state and the current event as state transition inputs, forming a reconstructed state sequence. v1 to vN represent the version markers corresponding to each reconstructed GUI state in the sequence. The time step, event order, and GUI state version are recorded separately, and the version number is not directly equated with the number of actions. The difference between the recorded state and the GUI state is only used as a comparison benchmark and does not participate in the calculation of the next state. The time-step comparator checks the reconstructed state, the difference between the recalculated state and the recorded results, and checks the GUI state version, GUI state identifier, current page, control and navigation state, task progress, and expected page, focus, and business data in conjunction with the task success conditions. It outputs whether it passes or fails, the first inconsistent time step, the inconsistent field, and the reason for failure. The fault branch also checks the fault state S1, the recovered state S2, the recovery verification condition V, and the recovery verification result obtained therefrom, checking for issues such as repeated execution of effective actions, exceeding the retry limit, or continuing automatic operation after requesting manual takeover.

[0103] VIII. Typical Implementation Examples

[0104] Taking "Search for products - View details - Add to cart" as an example, firstly, GUI objects such as the homepage, search page, product list page, and product details page are generated by the domain-specific language description of the e-commerce scenario, and the state is generated [0]. The task template specifies the task objective, task prerequisites, task success conditions, and task execution constraints, but does not pre-define the complete action sequence; the GUIAgent can select actions such as entering the search entry, entering keywords, entering search results, selecting target products, and adding to cart in sequence according to the current GUI state and task progress. In one time step, the existence and clickability of the search entry are confirmed, and the action is validated to form a click event; after the state transition, the current page or focus state changes. In subsequent time steps, the input box is confirmed to be editable, the input action forms an input event, and the keywords are written into the control state or metadata. Subsequently, the search event switches the page to the results list; after clicking the product card, the navigation state records the original page and enters the product details; after clicking the add to cart button, only the shopping cart-related metadata is updated, and the page is not required to necessarily jump. At each time step, the task executor updates the task progress and makes task judgments based on actual state changes, while the trajectory recorder synchronously saves the previous state, actions, events, subsequent state, state differences, and screenshots. The resulting trajectory can fully reflect the continuity of navigation, text input, and cross-page business data.

[0105] The visual simulation control panel displays an auditable simulation session by function area. For example, on the left, you can select the application type as e-commerce shopping, the task template as searching for products, set the device resolution, and create a new session. The upper left of the center displays a screenshot rendered from the current interface state, while the lower left displays session metadata such as session identifier, total steps, logical time, battery level, shopping cart count, and current page. The upper right of the center displays the action control area, used to select the target control, action type (click, input, etc.), and input parameters, and submit a single-step event. The rightmost position features a state inspector displaying structured fields of the current immutable interface state; for example, English key names are internal field identifiers of the prototype program, and the terms "current interface state," "navigation state," and "control tree" in the text correspond to these fields. Below, a timeline is set up for selecting historical steps, and the event log lists the steps, actions, event types, timestamps, and messages. All areas are linked through the same session and time step identifier, allowing for cross-verification of interface screenshots, state fields, and event logs.

[0106] By continuously executing actions such as entering information in the search box, selecting results, viewing product details, and adding items to the cart using the same task template, a long-term interaction trajectory can be formed, including the initial state and the interface states of each step. For example, the trajectory includes screenshots of seven steps, with the screenshot order corresponding to the states, events, and task progress in the session according to the same time step identifier. Seven consecutive screenshots demonstrate the long-term trajectory of "searching for canvas shoes and adding them to the cart" in the same session. The initial state is the homepage; Step 1: Click the search box and give it focus; Step 2: Enter keywords and execute the search, entering the results list; Step 3: Select the target product and enter the product details page, while retaining the source page in the navigation state; Step 4: Click the "Add to Cart" button, the shopping cart metadata is added, while the product details page can remain unchanged; Step 5: Enter the shopping cart and display the added products; Step 6: Perform a back operation and return to the homepage according to the page stack. The screenshots are displayed in order, with arrows indicating the execution order in ascending order of time steps. Each screenshot corresponds to a different interface state version and is associated with the action, normalized event, state difference, and task progress of that step using the same time step identifier. They cannot be merged into the same state based solely on visual similarity.

[0107] In another embodiment, a recovery branch is generated from a fault directory compatible with the actual preceding actions of the current main trajectory. For example, when the shopping cart check-in action has been submitted but the interface still displays the old check-in state, a "page state not refreshed" fault is constructed; the diagnostic result marks that the preceding action has taken effect, and the recovery plan sequentially executes re-observation, wait, refresh, and re-observation. After refreshing, it verifies that the shopping cart state field reflects the result of the preceding action and prohibits repeated clicks that would cause duplicate submissions. For the "duplicate click" fault, when the second click occurs, the state after the first click has taken effect is retained, re-observation is performed and state alignment is done, and then the process continues from the current page without replaying the original action. For page loading failure, login overlay, or activity pop-up, limited recovery chains such as wait and refresh, close overlay and re-observation are generated respectively; for blocking states that require manual intervention, such as slider verification, puzzle verification, verification failure, and login failure, the recovery plan only requests manual processing and terminates automatic business operations, without generating verification code solving, credential filling, or fictitious verification passed states. Each branch saves S0 (pre-fault state), A0 (attempted action), S1 (observable fault state), D1 (diagnostic result), recovery action sequence, S2 (post-recovery or waiting for manual intervention state), and V (verification result), thus forming repeatable GUI error diagnosis, recovery, and safety evaluation samples.

[0108] IX. Overall Technical Solution for GUIWorld

[0109] In summary, this invention presents a programmable interactive simulation and long-range trajectory data generation method and system for GUI Agent training.

[0110] Figure 8 This is a first schematic diagram of the overall technical solution in an embodiment of the present invention, with reference to... Figure 8 The system first receives a GUI domain-specific language description, task template, simulation configuration parameters, and a random seed. It then parses and performs semantic verification on the GUI domain-specific language description, generating a GUI object graph containing pages, controls, navigation relationships, task context, and state transition rules, as well as the initial GUI state.

[0111] In each time step, the GUI Agent or user simulator generates a set of candidate actions based on the current GUI state and its rendered interface. It then selects an action to be executed by combining the task objective, task execution constraints, and task prerequisites. The action is then parsed into action primitives, target controls, and action parameters by the action adaptation module. After verification of target existence, control operability, navigation and task prerequisites, risk authorization, and resource status, the action is converted into a normalized event.

[0112] The state transition engine takes the current GUI state and normalized events as input, actively calculates the next GUI state and state differences, and the interface renderer generates the corresponding interface based on the next GUI state.

[0113] The session organizes the previous state, action, event, subsequent state, state difference, screenshot, task progress, reward value and termination flag into ordered time steps according to the time step identifier.

[0114] For fault recovery data, the system selects branches only from faults that are compatible with the current page, target control, action primitives and expected state changes, constructs observable fault states, generates diagnostic results and limited recovery actions, and performs postcondition verification on the recovered GUI state.

[0115] The trajectory recorder and annotation engine extract visual, action, state, fault, recovery and safety supervision information from the same time step, and the dataset exporter outputs training or evaluation data.

[0116] The candidate action set itself does not have a fixed global order; only the events that are selected and actually submitted at each time step form a unique ordered execution sequence according to the time step identifier. The task template provides the task objective, task prerequisites, task success conditions, task failure conditions, and task execution constraints.

[0117] Therefore, the trajectory in this embodiment of the invention is not a post-hoc stitching of external page changes, but is generated synchronously in the same causal chain by the GUI state model, event-driven transition, state rendering, and task verification.

[0118] Figure 8 The GUIWorld technical process is presented from top to bottom through four modules. The solution is divided into four parts: deterministic environment generation, single-time-step causal closed loop, fault recovery branch, and same-source data output. Declarative interface descriptions, task templates, configurations, and random seeds are parsed and verified to form a GUI object graph and an initial immutable interface state. At each time step, the current state is first rendered as structured observations and screenshots. The action selected by the agent is converted into a normalized event after verification of the target, controls, navigation, task, and resource conditions. The state transition engine calculates the next interface state and state difference based on this, and the next state then becomes the unique state input for the next time step. Orange dashed lines indicate that a fault branch is entered only when the source state, source action, and expected transition meet the applicable conditions, sequentially completing fault construction, diagnosis, limited recovery, and post-verification. The green data chain organizes the previous state, action, event, subsequent state, difference, and screenshot of the same time step into sessions and trajectories, and exports them hierarchically according to model input, supervision target, and generated quality inspection information. Blue solid lines represent the main execution or data flow, and green solid lines represent same-source trajectories and data output. Figure 8The “Simulation Configuration” is used to limit the operating parameters such as device resolution, maximum time step, logical time advance, and resource limits; “Risk Authorization” is used to constrain irreversible or sensitive operations; “Resource Status” is used to describe operating resources such as time step, logical time, and power consumption; “Model Input”, “Supervision Target”, and “Generate Quality Inspection Information” represent visible observations of the model, training or evaluation target labels, and internal information used only for generating verification, respectively.

[0119] The GUI description data is a static declaration input; after parsing and semantic verification, a GUI object graph and an executable GUI instance are formed; the GUI state is a snapshot of the runtime state of the GUI instance at a specific time step.

[0120] At a formal level, a GUI instance can be represented as a six-tuple G=(S, W, E, T, N, C), where S represents the state space, W represents the control graph or control tree structure, E represents the set of allowed events, T represents the state transition function, N represents the navigation relationship, and C represents the task context. The purpose of this definition is not to limit a particular UI rendering technique, but rather to provide a unified, computable description for different GUI scenarios, enabling questions such as "What is the current interface?", "Is the current action allowed?", "How does the state change after the action occurs?", and "Is the task completed?" to be explicitly determined by states and rules.

[0121] The state transition of normal interaction can be abstractly represented as s(t+1)=T(s(t),e(t)), where s(t) is the GUI state at time step t, and e(t) is the normalized event after verification. The state transition engine does not directly modify the input state, but instead constructs and returns a new GUI state, state differences, and state transition results based on the current state. For invalid actions, it returns the reason for failure and ensures that the business state does not undergo the claimed valid transition. This mechanism ensures that each subsequent state has a clear preceding state and event source, historical states are fully preserved, and it provides a foundation for trajectory playback, state difference comparison, parallel generation, and regression testing. Here, "deterministic transition" refers to obtaining repeatable state transition results under the same valid input, the same scenario configuration, and the same random seed; it does not imply that the algorithm itself is differentiable.

[0122] For the fault recovery branch, based on the six-tuple G=(S,W,E,T,N,C), fault application and injection rules F, recovery strategy R, and verification condition V are added, resulting in GR=(G,F,R,V). Given a normal state S0 and an attempted action A0, fault rule F selects the applicable fault based on the current page, target control, action primitive, and expected transition, and generates an observable fault state S1. The diagnostic result D1 at least determines the error type, whether the fault is blocking, whether manual intervention is required, and whether the preceding action has taken effect. The recovery strategy R outputs a finite recovery sequence based on this, which, after execution, yields state S2, and the verification condition V compares S2 with the task postconditions. This branch can be represented as S0—A0—S1—D1—Recovery Sequence—S2—V. When the preceding action has taken effect, the recovery strategy mainly focuses on re-observation, waiting, refreshing, or state alignment, without repeating the original action; when manual intervention is required, only manual processing is requested, and the automatic business operation is safely terminated.

[0123] In this embodiment, the relationships between controls can be represented using a tree structure, a graph structure, or a combination of both; the state sequence can be entirely stored in memory, or the initial state and events can be stored using an event sourcing method and reconstructed when needed; the interface renderer can use an image rendering library, browser rendering, a native GUI framework, or other graphics backends; the task success conditions and recovery verification conditions can use regular expressions, executable predicates, or constraint graphs; the fault catalog can be expanded according to application type, page type, action primitives, and risk level; the data export format can be expanded according to the training framework.

[0124] On the GUI Agent side, in addition to random policies, rule-based policies, and expert policies, reinforcement learning policies, visual language model policies, or other external GUI Agents can also be integrated. The recovery strategy can be selected by predefined rules or by the model within a range that satisfies action constraints, retry limits, manual intervention, and recovery verification conditions. All of the above alternative methods are based on explicit GUI states. After verification, actions are applied to the state through events and transition rules. Long-term sessions remain continuous, fault branches remain compatible with the source time step, and recovery results can be recorded, aligned, verified, and replayed. Therefore, all can be considered equivalent variations of the technical concept of this invention.

[0125] Figure 9 This is a second schematic diagram of the overall technical solution in an embodiment of the present invention. Figure 9 The overall technical solution demonstrates the interconnectedness of deterministic environment generation, single-timestep interaction, constrained fault recovery, and homogeneous data output. GUI domain-specific language descriptions, interface simulation configuration parameters, and random seeds are used together for parsing, semantic verification, and runtime instantiation to generate a GUI object graph containing pages, controls, navigation relationships, task context, and state transition rules, forming an initial GUI state snapshot and generating metadata. Figure 9 The "Task Description Data" corresponds to the task template described in the main text, providing task objectives, prerequisites, success conditions, failure conditions, and execution constraints, without pre-determining the complete action sequence. At each time step, the interface screenshot and structured state summary are generated from the same current GUI state snapshot. The GUI Agent proposes candidate actions based on the task objective and observations. After verification by the target control, navigation, task prerequisites, risk authorization, and resource conditions, the actions form a standardized event. The state transition engine calculates the next GUI state and the GUI state difference based on the current GUI state and the event. The task executor updates the task progress, reward value, and termination flag. If the task has not terminated, the next GUI state becomes the state source for the next time step. Only when the source GUI state, source action, and expected state transition meet the fault applicability rules is an observable fault state S1 constructed, a diagnostic result D1 formed, and a limited recovery sequence executed to obtain a recovered or waiting-for-human state S2. Then, a recovery verification result is generated based on the recovery verification condition V. Actions that have already taken effect cannot be resubmitted. When manual takeover is required, only manual processing is requested, and the automatic business operation is safely terminated. In the session and annotation phase, normal trajectories and fault recovery trajectories are organized according to session identifiers, time step identifiers, and corresponding status and event identifiers. Screenshots, actions, events, before and after states, state differences, task results, and related annotations are exported hierarchically as model inputs, supervision targets, and privileged metadata used only for generating quality inspection. The generated quality inspection information is included in the privileged metadata. Normal trajectories also enter the data output phase and do not necessarily require a fault to occur first. Figure 9 The solid blue line represents the main execution or data flow, the solid green line represents the status feedback or same-source trajectory data output when it has not terminated, the dashed orange line represents the fault condition branch, and the solid orange line represents the fault construction, diagnosis, limited recovery and verification process.

[0126] The key points of the embodiments of the present invention are as follows: (1) A unified formal modeling method for GUI based on “state space, control relationship, event set, state transition, navigation relationship and task context”, and the initial GUI state is deterministically generated by declarative scene description and random seed.

[0127] (2) The actions output by the GUI Agent or user simulator are parsed into action primitives, target controls and parameters. After the control operability, navigation and task prerequisites and risk authorization are verified, they are converted into normalized events. The state transition engine constructs the next GUI state and state differences based on the current GUI state and events.

[0128] (3) A continuous session mechanism for long-term GUI tasks, and a unified time step identifier to associate the previous and subsequent states, actual execution events, screenshots, cross-page business data, task progress, reward value and termination flag with the same time step.

[0129] (4) Based on the current page type, action primitives, target controls and expected state changes, filter applicable fault types, deterministically construct fault states with observable evidence, and record whether the preceding actions have taken effect, whether the fault is blocked and whether manual intervention is required, constrained fault injection methods.

[0130] (5) Organize the pre-fault state, attempted actions, fault state, diagnosis, limited recovery sequence, post-recovery state and verification results according to S0 / A0 / S1 / D1 / recovery sequence / S2 / V; avoid repeating effective actions based on whether the preceding actions have taken effect, and request manual handling and safe termination for faults that require manual takeover.

[0131] (6) Link GUI simulation, GUI Agent interaction, trajectory recording, fault recovery, rendering and annotation, so that interface screenshots, actions, events, GUI state, state differences, task semantics, control semantics, recovery actions and safety supervision labels are automatically generated at the same time step, and the model input, supervision target and privileged metadata are exported in layers.

[0132] (7) Save the initial GUI state, simulation configuration, random seed and ordered events. Re-execute the state transition rules to reconstruct the state sequence during playback. Compare the reconstructed state and the recalculated state differences with the recorded results step by step. Output the consistency verification mechanism of the first inconsistent time step, field differences and reasons.

[0133] This invention also provides a long-range trajectory data generation device for agent training, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the long-range trajectory data generation method for agent training, the implementation of this device can refer to the implementation of the long-range trajectory data generation method for agent training; repeated details will not be elaborated further.

[0134] Figure 10 This is a schematic diagram of a long-range trajectory data generation device for agent training in an embodiment of the present invention, as shown below. Figure 10 As shown, the device 1000 includes: The environment generation module 1001 is used to receive GUI description data, task templates, and fault application rule data. The GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements. The task template includes task objectives and success conditions. The fault application rule data includes fault injection conditions and fault recovery conditions. The GUI description data is parsed and executed to generate an initial simulation rendering interface and a GUI state snapshot. The sandbox simulation module 1002 is used to perform multi-step continuous actions of the GUI agent based on the task objective, the initial simulation rendering interface, and the GUI state snapshot. After each action is executed, the simulation rendering interface and the GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether a preset termination condition is met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes at least one of the following: GUI state snapshot, GUI state difference, interface screenshot, action identifier, time step identifier, and task progress. The trajectory generation module 1003 is used to generate long-range trajectory data based on the data recorded through the task execution session when the preset termination conditions are met.

[0135] In one embodiment, the GUI description data includes at least one of scene description, page, control, attribute, navigation relationship, and state transition rule; The environment generation module 1001 is specifically used for: Receive interface simulation configuration parameters and random seed; Lexical and syntactic analysis are performed on the GUI description data to form an abstract syntax tree; Semantic validation based on abstract syntax trees; After verification, based on the GUI description data, interface simulation configuration parameters, and random seed, instantiation is performed to generate a GUI object graph; the GUI object graph includes a control graph, a navigation graph, and an event set. An initial simulation rendering interface and a GUI state snapshot are generated based on the GUI object graph; the GUI state snapshot includes at least one of the following: GUI state identifier, current page, navigation state, control tree, focus state, selection state, task execution state, metadata, and task context.

[0136] In one embodiment, the trajectory context further includes normalized events; the task template further includes task prerequisites, task failure conditions, and task execution constraints. Sandbox simulation module 1002 is specifically used for: The GUI agent generates actions to be executed based on the task objective, task progress, the current simulation rendering interface, and a snapshot of the GUI state. A pre-execution check is performed on the action to be executed, and the action to be executed that passes the pre-execution check is converted into a normalized event; the normalized event is the input of the GUI state change and is used to trigger at least one of page navigation, control update, data change, and task state change; the pre-execution check includes at least one of the following: target control existence check, target control visibility check, target control clickability check, target control editability check, current page meets expectations check, page stack check, and task prerequisite check; Event validation is performed on normalized events based on the current GUI state snapshot; the event validation is used to check whether the target control exists, whether the event type is valid, whether the target control is visible and operable, and whether the navigation state, task prerequisites, task execution constraints, risk authorization, and runtime resource status are satisfied; After the event verification passes, a new simulation rendering interface and GUI state snapshot are generated based on the normalized event, the current simulation rendering interface, and the GUI state snapshot.

[0137] In one embodiment, the sandbox simulation module 1002 is specifically used for: After generating a new simulation rendering interface and GUI state snapshot based on the normalized event, the current simulation rendering interface, and the GUI state snapshot, the task progress, reward value, termination flag, and GUI agent memory are updated according to the changes in GUI state differences and the task objective. The reward value is used to quantify the degree to which the changes in GUI state after the action is executed advance the task objective. The termination flag is used to determine whether the preset termination conditions are met.

[0138] In one embodiment, the sandbox simulation module 1002 includes a fault handling module, used for: Based on the matching of fault injection conditions with the current page, action primitives, target controls, and expected GUI state changes, suitable fault types are filtered out. Add temporary view objects to the simulation rendering interface and GUI state snapshot according to the adapted fault type; the temporary view objects include at least one of the following: error message, login overlay, activity overlay, page error or security verification; Generate GUI agent candidate actions based on the simulation rendering interface and GUI state snapshot with added temporary view objects; Determine the match between the candidate action and the fault recovery condition. If they do not match, retry the GUI agent action a limited number of times. If they match, remove the fault, update the simulation rendering interface and the GUI state snapshot.

[0139] In one embodiment, the trajectory generation module 1003 is specifically used for: A single training sample is formed by sorting the session identifier, interface screenshot, action sequence, normalized event sequence, GUI state snapshot sequence, GUI state difference sequence, task information, and metadata by time step. A single training sample is divided into three categories: model input, supervision target, and privileged metadata used only for quality inspection, and the output is structural trajectory data; the trajectory context before and after fault injection is incorporated into the privileged metadata.

[0140] In one embodiment, the device 1000 further includes a trajectory playback module for: After the trajectory generation module 1003 forms long-range trajectory data based on the data recorded through the task execution session, during trajectory playback, it loads the initial GUI state snapshot and event sequence of the session and reconstructs the complete state sequence by time step. During the reconstruction process, only the previous reconstructed state and the current event are used as state transition inputs, and the recorded state is used as the comparison benchmark. The reconstructed state is compared with the recorded state, and the output is passed or failed, the first inconsistent time step, the inconsistent field, and the reason for failure.

[0141] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0142] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0143] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described method for generating long-range trajectory data for intelligent agent training.

[0144] The embodiments of the present invention have the following technical effects: (1) In this embodiment of the invention, interaction trajectories are directly generated in an isolated programmable GUI state transition environment, and GUI states, pages, controls, navigation, task contexts, and cross-page business data are managed uniformly. The next state is actively calculated by the current GUI state and normalized events. Therefore, the subsequent state has a computable previous state and event source. Under the same domain description, configuration, and random seed conditions, a consistent initial environment and state transition process can be repeatedly generated, and the page, control, path, and boundary states can be extended as needed by the task. The data generation capability is provided by the executable GUI state model and explicit transition rules, enabling long-term task data to be continuously generated in an isolated environment according to a unified state semantic, improving controllability, reproducibility, and scalability, and reducing dependence on real accounts, real-time business states, and continuous external services. It should be noted that reducing the above dependence is not equivalent to automatically obtaining a legally compliant conclusion. Actual deployment should still be subject to compliance review based on the data, model, and material sources.

[0145] (2) In this embodiment of the invention, standardized events are set as causal inputs that enter the state transition engine after verification. Actions are only converted into events after the operability of controls, navigation and task prerequisites, risk authorization, and resource conditions are met. These events directly drive the generation of the next GUI state and state differences. Therefore, "what the GUI Agent wants to execute," "what the environment actually accepts," and "what specific changes have occurred in the state" correspond to actions, events, and state differences, respectively, and a clear causal relationship can be established in the same execution chain. The session further associates the previous state, action, event, subsequent state, state difference, screenshot, task progress, reward value, and termination flag through a unified time step identifier, so that the consistency of the trajectory is guaranteed by the same state transition calculation and its state version relationship. For abnormal data, applicable faults are filtered based on the source page, action primitives, and expected state changes, and the states such as action not in effect, action in effect but outdated display, automatic recovery from blockage, and manual takeover are distinguished, thereby reducing duplicate submissions, error rollbacks, or unauthorized processing.

[0146] (3) In this embodiment of the invention, a dedicated state space for discrete GUI interaction is adopted. Pages, controls, navigation relationships, focus and selection states, task contexts, and cross-page business data are all used as state variables. GUI events such as clicks, inputs, scrolling, and returning constitute discrete state transition inputs, and interface rendering is directly derived from the corresponding GUI state. On this basis, the system forms a closed loop of "state transition - fault construction - diagnosis - recovery - post-verification": the fault acts on both the structured GUI state and the visible interface. The recovery strategy selects limited actions based on whether the preceding actions have taken effect, the fault blocking and manual takeover attributes, and verifies the GUI state post-conditions after recovery. Random seeds, initial states, and ordered events support the re-execution of the same state transition chain. Recorded states and state differences are only used as comparison benchmarks, thereby enabling the location of the first inconsistent time step and field differences. Homologous multimodal annotation and hierarchical storage of model inputs, supervision targets, and privileged metadata further improve the auditability of training data and reduce the risk of internal answer leakage. Thus, the system can continuously generate structured multimodal data suitable for long-term planning, state memory, state prediction, error diagnosis, recovery control, and security boundary evaluation of GUI agents.

[0147] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0148] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0149] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0150] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0151] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An agent training oriented long-range trajectory data generation method, characterized in that, include: Receive GUI description data, task templates, and fault application rule data; The GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements; the task template includes task objectives and success conditions. The fault application rule data includes fault injection conditions and fault recovery conditions; The GUI description data is parsed and processed to generate an initial simulation rendering interface and a snapshot of the GUI state. Based on the task objective, the initial simulation rendering interface, and the GUI state snapshot, a GUI agent performs multiple continuous actions. After each action is executed, the simulation rendering interface and the GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether a preset termination condition is met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes at least one of the following: GUI state snapshot, GUI state difference, interface screenshot, action identifier, time step identifier, and task progress. When the preset termination conditions are met, long-range trajectory data is generated based on the data recorded through the task execution session.

2. The method of claim 1, wherein, The GUI description data includes at least one of the following: scene description, page, control, attribute, navigation relationship, and state transition rule; Before parsing and running the GUI description data to generate the initial simulation rendering interface and GUI state snapshot, the following steps are also included: Receive interface simulation configuration parameters and random seed; The GUI description data is parsed and processed to generate an initial simulation rendering interface and a snapshot of the GUI state, including: Lexical and syntactic analysis are performed on the GUI description data to form an abstract syntax tree; Semantic validation based on abstract syntax trees; After verification, based on the GUI description data, interface simulation configuration parameters, and random seed, instantiation is performed to generate a GUI object graph; the GUI object graph includes a control graph, a navigation graph, and an event set. An initial simulation rendering interface and a GUI state snapshot are generated based on the GUI object graph; the GUI state snapshot includes at least one of the following: GUI state identifier, current page, navigation state, control tree, focus state, selection state, task execution state, metadata, and task context.

3. The method of claim 1, wherein, The trajectory context also includes normalized events; the task template also includes task prerequisites, failure conditions, and task execution constraints. Based on the task objective, the initial simulation rendering interface, and a snapshot of the GUI state, perform multi-step continuous actions of the GUI agent, including: The GUI agent generates actions to be executed based on the task objective, task progress, the current simulation rendering interface, and a snapshot of the GUI state. A pre-execution check is performed on the action to be executed, and the action to be executed that passes the pre-execution check is converted into a normalized event; the normalized event is the input of the GUI state change and is used to trigger at least one of page navigation, control update, data change, and task state change; the pre-execution check includes at least one of the following: target control existence check, target control visibility check, target control clickability check, target control editability check, current page meets expectations check, page stack check, and task prerequisite check; Event validation is performed on normalized events based on the current GUI state snapshot; the event validation is used to check whether the target control exists, whether the event type is valid, whether the target control is visible and operable, and whether the navigation state, task prerequisites, task execution constraints, risk authorization, and runtime resource status are satisfied; After the event verification passes, a new simulation rendering interface and GUI state snapshot are generated based on the normalized event, the current simulation rendering interface, and the GUI state snapshot.

4. The method of claim 3, wherein, After generating new simulation rendering interfaces and GUI state snapshots based on normalized events, the current simulation rendering interface, and GUI state snapshots, the process also includes: Based on the changes in GUI state and the task objective, update the task progress, reward value, termination flag, and GUI agent memory; the reward value is used to quantify the degree to which the changes in GUI state after the action is executed advance the task objective; the termination flag is used to determine whether the preset termination conditions are met.

5. The method of claim 3, wherein, Based on the task objective, the initial simulation rendering interface, and a snapshot of the GUI state, perform multi-step continuous actions of the GUI agent, including: Based on the matching of fault injection conditions with the current page, action primitives, target controls, and expected GUI state changes, suitable fault types are filtered out. Add temporary view objects to the simulation rendering interface and GUI state snapshot according to the adapted fault type; the temporary view objects include at least one of the following: error message, login overlay, activity overlay, page error or security verification; Generate GUI agent candidate actions based on the simulation rendering interface and GUI state snapshot with added temporary view objects; Determine the match between the candidate action and the fault recovery condition. If they do not match, retry the GUI agent action a limited number of times. If they match, remove the fault, update the simulation rendering interface and the GUI state snapshot.

6. The method of claim 1, wherein, Long-range trajectory data is generated based on data recorded through task execution sessions, including: A single training sample is formed by sorting the session identifier, interface screenshot, action sequence, normalized event sequence, GUI state snapshot sequence, GUI state difference sequence, task information, and metadata by time step. A single training sample is divided into three categories: model input, supervision target, and privileged metadata used only for quality inspection, and the output is structural trajectory data; the trajectory context before and after fault injection is incorporated into the privileged metadata.

7. The method of claim 3, wherein, After generating long-range trajectory data based on data recorded through task execution sessions, the process also includes: During trajectory playback, the initial GUI state snapshot and event sequence of the session are loaded, and the complete state sequence is reconstructed step by step. During the reconstruction process, only the previous reconstructed state and the current event are used as state transition inputs, and the recorded state is used as the comparison benchmark. The reconstructed state is compared with the recorded state, and the output is passed or failed, the first inconsistent time step, the inconsistent field, and the reason for failure.

8. A long-range trajectory data generation device for intelligent agent training, characterized in that, include: The environment generation module is defined to receive GUI description data, task templates, and fault application rule data. The GUI description data includes data reflecting the structure, semantics, position, and state transition rules of interface elements; the task template includes task objectives and success conditions; the fault application rule data includes fault injection conditions and fault recovery conditions. The GUI description data is parsed and processed to generate an initial simulation rendering interface and a snapshot of the GUI state. The sandbox simulation module is used to perform multi-step continuous actions of the GUI agent based on the task objective, the initial simulation rendering interface, and the GUI state snapshot. After each action is executed, the simulation rendering interface and GUI state snapshot are updated, it is determined whether it is suitable to inject a fault, and it is checked whether a preset termination condition is met. The trajectory context before and after each action and before and after fault injection is recorded in the task execution session. The trajectory context includes at least one of the following: GUI state snapshot, GUI state difference, interface screenshot, action identifier, time step identifier, and task progress. The trajectory generation module is used to generate long-range trajectory data based on data recorded through the task execution session when preset termination conditions are met.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of 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 method of any one of claims 1 to 7.

11. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 7.