An agent access system and method based on state mirroring and dual action endpoints
By generating machine-readable state images through an authoritative state machine and a visibility projector, the problem of inconsistent state acquisition by intelligent agents in stateful web applications is solved. This enables consistency verification of actions between intelligent agents and human users, as well as state isolation, thereby improving application stability and efficiency.
Patent Information
- Application Number
- CN202611364728.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, when intelligent agents access stateful web applications, it is difficult to reliably obtain the application state directly related to business processing. Furthermore, inconsistencies can easily arise between the state and action verification of human users and intelligent agents. This is especially true in applications involving multiple participants and role-based collaboration, where state information isolation and access control become complex.
It employs an authoritative state machine, a perspective visibility projector, a state mirror renderer, and dual action endpoints. It manages application state and action verification in a unified manner through the server, generates machine-readable state images, and ensures consistency verification between agent actions and human user actions, thereby reducing reliance on the graphical user interface.
It improves the consistency of state and the reliability of information isolation during the intelligent agent access process, reduces the dependence on the front-end page structure, reduces the risk of invalid model calls and repeated action execution, and improves the stability of state acquisition and action execution.
Smart Images

Figure CN123179381A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent agent and web application interaction technology, and in particular to an intelligent agent access system and method based on state mirroring and dual action endpoints. Background Technology
[0002] With the development of large language models and intelligent agent technology, intelligent agents are gradually evolving from simple information generation tools into autonomous interactive entities capable of participating in application business processes, acquiring application states, and executing corresponding business actions. In web applications with continuous state changes, such as online games, e-commerce, and enterprise collaboration, intelligent agents may act as virtual participants, business assistance entities, or automated execution entities, participating in the application's operation alongside human users. Such applications typically have clearly defined business states, participant identities, phase transition relationships, and action execution conditions; the intelligent agent needs to determine subsequent executable operations based on the current application state.
[0003] Existing web applications are primarily built around graphical user interfaces (GUIs) for human users, with application state typically presented as page elements, controls, text content, and front-end interaction logic. When an intelligent agent accesses such an application, one approach is to parse the webpage structure, accessibility tree, or page content and simulate human user actions such as clicking and inputting. This approach is susceptible to changes in page layout, front-end frameworks, asynchronous rendering, and interface versions. Furthermore, the pages often contain a significant amount of information unrelated to business decisions, making it difficult for the intelligent agent to reliably obtain application states directly relevant to business processing.
[0004] Another approach is to set up separate business interfaces for the agent, providing state data and business operation capabilities through multiple interfaces. However, as the business stages and action types increase, the number of interfaces and adaptation relationships that need to be maintained also increases. When the human user operation pipeline and the agent operation pipeline have separate state processing, permission judgment, or action verification logic, inconsistencies may arise in the business states, action permission conditions, or verification results used by the two.
[0005] Furthermore, in applications involving multiple participants, role-based collaboration, or tiered access permissions, the state information and actions that different participants can obtain may differ. If the visibility of state information, the executable actions exposed to the agent, and the actual action verification are determined based on different data or rules, even if unauthorized state fields are not directly provided to the agent, the agent may still indirectly infer the relevant state based on changes in the set of executable actions, thereby increasing the complexity of application state isolation and permission consistency control.
[0006] Therefore, how to enable human users and intelligent agents to participate in business operations based on a unified application state without relying on intelligent agents to parse human graphical user interfaces, and how to ensure consistency between the state that intelligent agents can acquire, the scope of observable actions, and the verification of actual actions, are technical problems that need to be solved when intelligent agents access stateful applications. Summary of the Invention
[0007] The purpose of this invention is to provide an intelligent agent access system and method that enables human users and intelligent agents to share the authoritative application state, and to uniformly limit the states and executable actions that intelligent agents can obtain through server-side visibility projection, so that the actions of intelligent agents and human users adopt the same runtime verification path, thereby improving the consistency of state and the reliability of information isolation during the intelligent agent access process.
[0008] To achieve the above-mentioned technical objectives, the present invention adopts the following technical solution: An agent access system based on state mirroring and dual action endpoints is applied to stateful applications where human users and agents participate in the access process. The system includes: The authoritative state machine, located on the application server, is used to maintain the application's truth state, stage transition rules, set of executable actions, attributes of participating entities, and event flow. It also serves as a shared state source and action validity verification source for the graphical user interface pipeline and the intelligent agent interaction pipeline. A visual visibility projector is used to respond to the state acquisition request of an agent. Based on the agent's identity and application stage, it performs server-side visibility projection on the state fields and event fields in the state snapshot read from the authoritative state machine to obtain a set of visible states. The state mirror renderer is used to generate a machine-readable state mirror from a set of visible states, and after visibility projection is completed, it generates a list of currently executable actions using only the set of visible states as input for action determination. The action list includes action type and payload fields. The dual action endpoint is used to receive the action type and action payload submitted by the agent based on the machine-readable state image, and forward it to the runtime action legality verification code path shared with the graphical user interface pipeline in the authoritative state machine, so that the agent's action and the human user's action call the same set of precondition assertions for verification. Specifically, the generation of the current executable action list and the visibility projection of state and event fields use the same visibility rule source. Actions that depend on fields not determined by visibility projection are not included in the current executable action list. Furthermore, when the state image renderer generates the current executable action list, it does not read fields that have not passed visibility projection, so that changes in the values of these fields do not alter the current executable action list. Verified human user actions and agent actions are updated on the authoritative state machine and event streams are added. The updated state snapshot is then projected through visibility to generate a subsequent machine-readable state image.
[0009] Optionally, it also includes a state mirror endpoint and a response header marker, wherein the state mirror endpoint is used to return state information to the agent using the machine-readable state mirror as the response body; The response header flagger is used to generate a response header based on the same state snapshot that generates the machine-readable state image. The response header includes at least a state flag indicating whether the current requesting subject needs to perform an action, the type of currently executable action, and a state version number or round token. The response body and response header use the same visibility rule source for visibility projection. State fields that do not pass the visibility projection and information determined by the state fields are not written into the response body and response header.
[0010] Optionally, it also includes an agent client, which is used to periodically access the state mirror endpoint and skip the large language model inference for the response body when the state flag indicates that the agent does not need to perform an action; when the state flag indicates that the agent needs to perform an action, the response body is provided to the large language model to obtain the action type and action payload, and the action type and action payload are submitted through the dual action endpoint. The action submission carries the status version number or round token, and the application server processes repeated action submissions carrying the same round token according to a preset idempotency rule.
[0011] Optionally, the visibility rule source divides the status field and event field into at least public fields, hidden fields, fields that are public according to the identity or role of the participating subject, and private fields that are only visible to the subject corresponding to the field, and adjusts the visibility status of the corresponding fields according to changes in the application stage and / or changes in the status of the participating subject; Among them, fields that are converted from hidden state to visible state only enter the visible state set after the corresponding stage condition or subject state condition is met.
[0012] Optionally, the machine-readable state image adopts Markdown format and is set in a preset order as follows: metadata segment, request subject perspective segment, current action state segment, list of executable actions segment, application situation segment, and recent events segment; Each semantic segment is folded or omitted according to preset rules based on the application stage, and the names and relative order of the semantic segments that are not omitted remain unchanged; the actions in the current list of executable actions are configured with action type, action payload field and corresponding field type, and a candidate target whitelist can be configured.
[0013] Optionally, it also includes a self-describing access document publisher, used to publish a machine-readable access guidance document at a preset access address on the application server. The access guidance document includes at least the agent's working cycle, semantic description of the state image, available action types, correspondence of action payload fields, and prompt templates for use by large language models. The agent accesses the state mirror endpoint according to the access guidance document and submits action payloads corresponding to different action types through a single dual action endpoint.
[0014] Optionally, it also includes a restricted capability action channel. When the application server determines that the agent cannot meet the requirements of the request method, request body and authentication header field corresponding to the dual action endpoint based on the agent's pre-registered capability information, access handshake result or detection result of action submission request, it enables the restricted capability action channel based on HTTP GET request. The application server generates a one-time action address, which is bound to the requesting subject's identity, current authoritative state version, action type, action parameters, one-time identifier, and monotonically increasing sequence number. This one-time action address is then sent to the intelligent agent via the machine-readable state image or the list of currently executable actions.
[0015] Optionally, after receiving an access request for the one-time action address, the application server first queries the deduplication record based on the one-time identifier and / or monotonically increasing sequence number; When the deduplication record is matched, the processing result of the first execution of the corresponding action is returned without changing the authoritative state machine again; when the deduplication record is not matched, it is determined whether the authoritative state version bound to the one-time action address is consistent with the current authoritative state version. Access requests with inconsistent state versions are rejected, and access requests with consistent state versions and valid sequence numbers are executed with the corresponding action and the authoritative state machine is updated.
[0016] To achieve the above-mentioned technical objectives, the present invention also adopts the following technical solution: A method for agent access based on state mirroring and dual action endpoints, applied to stateful applications where human users and agents participate in access, includes: An authoritative state machine is maintained on the application server side. The authoritative state machine records the application truth state, stage transition rules, set of executable actions, attributes of participating entities, and event flow, and is shared by the graphical user interface pipeline and the intelligent agent interaction pipeline. In response to the agent's state acquisition request, server-side visibility projection is performed on the state fields and event fields in the state snapshot read from the authoritative state machine, based on the agent's identity and application stage, to obtain a set of visible states; A machine-readable state image is generated using the set of visible states, and after the visibility projection is completed, a list of currently executable actions is generated using only the set of visible states as the action determination input. The list of actions includes action type and payload fields. Return the machine-readable state image to the agent, and receive the action type and action payload submitted by the agent based on the machine-readable state image. Forward it to the runtime action legality verification code path shared with the graphical user interface pipeline in the authoritative state machine, so that the agent's action and the human user's action call the same set of precondition assertions for verification. Specifically, the generation of the current executable action list uses the same visibility rule source as the visibility projection of the state field and event field. Actions that depend on fields that have not passed visibility projection are not included in the current executable action list. When generating the current executable action list, fields that have not passed visibility projection are not read, so that changes in the values of the fields do not change the current executable action list. Verified human user actions and intelligent agent actions update the authoritative state machine and add event streams. The updated state snapshot is then projected through visibility to generate a subsequent machine-readable state image.
[0017] Optionally, when returning the machine-readable state image to the agent, an HTTP response header is generated based on the same state snapshot that generated the machine-readable state image. The HTTP response header includes at least a state flag indicating whether the agent needs to perform an action, the type of currently executable action, and a state version number or round token. When the state flag indicates that no action needs to be performed, the agent skips the large language model inference. When the state flag indicates that an action needs to be performed, the agent inputs the machine-readable state image into the large language model to obtain the action type and action payload, and submits the action with the state version number or round token. The application server processes repeated action submissions with the same round token according to a preset idempotent rule.
[0018] The main advantages of this invention compared to existing technologies are as follows: This invention uses the authoritative state machine of the application server as a shared state source and action validity verification source for both the graphical user interface pipeline and the agent interaction pipeline. Before generating state information accessible to the agent, server-side visibility projection is performed based on the agent's identity and application stage. A machine-readable state image and a list of currently executable actions are generated solely based on the projected visible state. Fields that do not pass visibility projection are neither included in the agent's state image nor participate in the generation of the current list of executable actions. Simultaneously, agent actions and human user actions enter a shared runtime action validity verification path. This reduces inconsistencies arising from the separate processing of state, permissions, and actions by the human interaction pipeline and the agent interaction pipeline, and prevents unauthorized states from being indirectly reflected through changes in the agent's observable action range.
[0019] This invention enables the application server to proactively generate a machine-readable state image for intelligent agents based on the authoritative state. This allows intelligent agents to directly obtain semantic information and executable actions related to the current business state without parsing the page structure, style nodes, and front-end interactive elements of the graphical user interface. This reduces the dependence of the intelligent agent access process on the front-end page structure and improves the stability of state acquisition and action execution under different application stages and interface versions.
[0020] In the implementation of the present invention using the fast path of the response head, the state image response head and the response body are generated based on the same state snapshot. The response head can provide whether the agent needs to perform an action, the type of action that can be performed, and the state version or round token. When the agent does not need to perform an action, it can skip the large language model inference. When the agent needs to perform an action, it can call the large language model to generate the action content, thereby reducing invalid model calls and corresponding data processing overhead, and improving the consistency of repetitive action processing through the state version or round token.
[0021] In embodiments where the execution environment of an intelligent agent cannot meet the conditions for calling conventional action endpoints, this invention can provide the corresponding intelligent agent with a one-time GET action address bound to the identity of the requesting subject, the authoritative state version, and action parameters. Following the processing order of first determining duplicate requests and then determining the state version, the invention provides idempotent responses to duplicate accesses and rejects requests with invalid states. This allows intelligent agents with limited capabilities to still drive the authoritative state machine, while reducing the risk of the same business action being executed repeatedly due to prefetching, repeated rendering, or network retries. Attached Figure Description
[0022] Figure 1 This is a system architecture diagram of the intelligent agent access system of the present invention; Figure 2 This is a flowchart of the steps of the intelligent agent access method of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. The present invention provides an intelligent agent access system and method based on state mirroring and dual action endpoints, used to enable human users and intelligent agents as different types of participants to access the same stateful application. The stateful application can be a multi-user interactive application, an order fulfillment application, an enterprise collaboration application, a standalone state machine application, or other applications with continuously changing states, differences in participant permissions, and action execution conditions.
[0024] The intelligent agent, as referred to in this invention, is a computer program entity capable of generating subsequent action decisions based on application state information and submitting actions to the application through a machine interaction interface. The intelligent agent can independently invoke a large language model to complete action decisions, or it can be implemented by a program with rule-based reasoning, task planning, or other decision-making capabilities. The intelligent agent does not directly read human users' mouse operations, keyboard input, or graphical interface pixel content; instead, it obtains state information matching its own identity and permissions based on the business state already confirmed by the application server.
[0025] The authoritative state, as referred to in this invention, is a data state stored by the application server as the truth value of application operation and used to determine the current application stage, the state of participating entities, the conditions for allowing the current action, and the results of subsequent state transitions. Actions submitted by human users through the graphical user interface and actions submitted by intelligent agents through the machine interaction interface both affect this authoritative state, without maintaining separate independent copies of the business state.
[0026] See Figure 1 The intelligent agent access system of the present invention includes an authoritative state machine 100, a visual visibility projector 200, a state mirror renderer 300, and a dual action endpoint 400.
[0027] In a further embodiment, it also includes a state mirror endpoint 500, a response header marker 600, a self-describing access document publisher 700, a restricted capability action channel 800, and an agent client 900.
[0028] Among them, the authoritative state machine 100 serves as the business truth center of the entire application. The visual visibility projector 200 is located between the authoritative state machine 100 and the state image renderer 300. The state image renderer 300 generates a machine-readable state image for the agent and a list of currently executable actions based on the state filtered by the visual visibility projector 200. The dual action endpoint 400 is used to receive agent actions and send them to the runtime action validity verification path shared with the graphical user interface in the authoritative state machine 100.
[0029] Through the above structure, human users and intelligent agents each use an interaction channel suitable for themselves, but jointly read or change the same application business state, thus forming a two-pipeline interaction structure centered on the authoritative state machine 100.
[0030] The following details each element that constitutes the intelligent agent access system of the present invention.
[0031] (a) Authority State Machine 100 The authoritative state machine 100 is located on the application server and is used to maintain the application's truth state, stage transition rules, set of executable actions, attributes of participating entities, and event flow.
[0032] The application truth states maintained by the authoritative state machine 100 can be stored separately for each application instance. Each application instance corresponds to at least an instance identifier, current state version, current application stage, set of participating entities, attributes of each participating entity, application object state, current action state, and event flow.
[0033] The instance identifier is used to uniquely identify a continuously running application instance. For example, in a multiplayer online game, it can correspond to a game room; in an order fulfillment application, it can correspond to an order; in an enterprise collaboration application, it can correspond to a workflow instance; and in a standalone state machine application, it can correspond to the current game save or the currently running instance.
[0034] The current state version represents the version of the state currently stored by the authoritative state machine 100. When any valid action causes a significant change in the application state, the authoritative state machine 100 generates the next state version. The state version can be an incrementing version number, a round token, or another version identifier that can uniquely identify the current state stage by the server.
[0035] The current application phase is used to determine the business actions that can occur in the current state and the visibility conditions of different state fields. Application phases can be predefined according to the specific application's business process. For example, a multi-player game application may include a preparation phase, a night phase, a speaking phase, and a voting phase; an order fulfillment application may include phases such as pending payment, pending shipment, in transit, delivered, and after-sales processing; an enterprise workflow application may include phases such as task creation, task assignment, task execution, review, and archiving.
[0036] The participant set is used to record human users, intelligent agents, and other controlled participants in the current application instance. Each participant must have at least an identity identifier, and may also have a role identifier, group affiliation, permission category, participation status, and attributes related to the current application phase.
[0037] The event stream records application events confirmed by the authoritative state machine 100 in the order of their occurrence. Each event record may include the event type, event subject, target object, state version of the event, application stage to which the event belongs, and event visibility attributes. For applications with private events, the stream also records the subjects, roles, or sets of participating subjects that are allowed to access the event.
[0038] The authoritative state machine 100 also maintains action legality rules. These action legality rules correspond to the business verification code paths used in the graphical user interface pipeline. For the same business action, regardless of whether the action originates from the graphical user interface or the intelligent agent, the same runtime legality verification logic is used to determine whether the action is allowed to be executed.
[0039] Action validity verification can include at least whether the requesting subject's identity is valid, whether the subject is currently in an allowed operation state, whether the action is allowed in the current application stage, whether the action type exists in the current allowed action set, whether the action payload field is complete, whether the field type meets the corresponding action requirements, whether the target object is within the current allowed target range, and whether the corresponding business prerequisites are met.
[0040] For example, when a human user clicks on a business control through a graphical user interface, the graphical user interface converts the operation into an internal application action object and sends it to the runtime legality verification code path; when an agent submits an action through the dual action endpoint 400, the dual action endpoint 400 also converts the action into the corresponding internal application action object and sends it to the same runtime legality verification code path.
[0041] Therefore, human user actions and intelligent agent actions will not be subject to two separate sets of business judgment rules.
[0042] In one specific implementation, a business action can consist of the subject's identity, the action type, and the action payload. For applications with state version control requirements, the business action can also be associated with the state version or round token corresponding to the time the action was generated.
[0043] After the legitimacy check is passed, the authoritative state machine 100 executes the corresponding state transition and completes three processes at the same time: updating the application truth state, forming a new state version, and appending the event record corresponding to this valid action to the event stream.
[0044] The above three processes are preferably completed in the same business submission process, so that the status fields, event fields and status versions subsequently read by the status image renderer 300 correspond to the same confirmed application status.
[0045] (ii) Visualization of visibility projector 200 The visibility projector 200 is used to respond to the agent's state acquisition request and perform server-side visibility projection on the state fields and event fields in the state snapshot read from the authoritative state machine 100 according to the agent's identity and application stage.
[0046] When an agent sends a status retrieval request, it must include at least information that can identify the requesting entity. The application server first resolves the identity of the requesting entity, and then determines the requesting entity's role, participation status, and permission category in the current application instance.
[0047] The visibility projector 200 reads the current state snapshot, but instead of sending the entire original state snapshot to the agent, it determines whether the agent is allowed to enter the visible state set of the corresponding requesting agent by field according to the pre-set visibility rules.
[0048] Visibility rules can be configured based on field identifiers. Each rule item can include a field identifier, visibility category, allowed subjects or roles, application phase conditions, field owner, and public conditions after state transition.
[0049] Status fields and event fields can be categorized into at least public fields, hidden fields, fields that are public based on the identity or role of the participating entity, and private fields that are only visible to the entity corresponding to the field.
[0050] Public fields are accessible to all entities with access permissions to the current application instance, such as public phase information, public business status, or already public events.
[0051] Hidden fields are not provided to the corresponding request body under the current conditions. The field values of the hidden fields themselves will not be included in the machine-readable state image generated for this body.
[0052] Fields that are publicly available based on the participant's identity or role are only output to participants who meet the corresponding identity criteria. For example, information that can be shared among members of the same group can be made available to participants belonging to the same group, while being hidden from other participants.
[0053] Private fields are only accessible to the specified subject that has a corresponding relationship with the field. For example, private states, private tasks, or private action results belonging to a single subject are only accessible to the visible state set corresponding to that subject.
[0054] Some fields can also have phased public disclosure conditions. For example, a field may remain hidden in the first phase and become public after entering the second phase; or when a participating entity exits the current application process, some previously hidden fields related to that entity may be made public.
[0055] When the visibility projector 200 processes the data, it first selects the corresponding visibility rule version based on the identity, role, and current application stage of the requesting subject, and then judges each field of the current state snapshot according to the rule.
[0056] For fields that are allowed to be read, the field identifier and field value are written to the visible state set; for fields that are not allowed to be read, the corresponding field value is not written to the visible state set, nor is the field value passed to the action list generation process of the state mirror renderer 300.
[0057] Event fields are processed in the same way. Public events, events visible to the subject itself, and events that meet the role sharing conditions can be written to the visible state set; private events that do not meet the access conditions of the current requesting subject will not be included in the event set corresponding to that subject.
[0058] Through this structure, the state mirror renderer 300 does not actually receive the complete authoritative state, but rather the set of visible states after the server has completed the permission processing.
[0059] (III) State Mirror Renderer 300 The state image renderer 300 is used to generate a machine-readable state image based on the set of visible states, and to generate a list of currently executable actions based on the set of visible states.
[0060] exist Figure 1 In the embodiment shown, the state image renderer 300 may include a state image generation unit 310 and an action list generation unit 320.
[0061] 1. State Mirror Generation Unit 310 The state mirror generation unit 310 receives the set of visible states output by the visual visibility projector 200, and organizes the state fields and event fields therein into a state mirror according to a predetermined machine-readable structure.
[0062] Machine-readable state images do not originate directly from the HTML pages, page screenshots, or front-end component trees corresponding to the graphical user interface, but are actively generated by the application server based on the authoritative business state.
[0063] In one implementation, the machine-readable state image is in Markdown format.
[0064] Markdown state mirrors can be set in a preset order, including metadata segments, request subject perspective segments, current action state segments, list of actionable segments, application status segments, and recent events segments.
[0065] The metadata segment is used to record application-level information such as application instance identifier, current application stage, running status, and status version.
[0066] The request subject perspective segment is used to record the identity, role, participation status, and private attributes that are allowed to be disclosed to the agent by the visibility rules in the application.
[0067] The current action state segment is used to record whether the agent needs to perform an action or whether the agent has tasks to be processed.
[0068] The executable action list segment is used to record the currently executable actions determined by the action list generation unit 320.
[0069] The application status segment is used to record the status of other participating entities, application objects, or business statuses that the subject is allowed to read after projection.
[0070] The recent events segment is used to record the most recent events that the requesting subject is allowed to read after visibility projection.
[0071] At different application stages, semantic segments that do not exist temporarily can be omitted according to preset rules, but the semantic segments that are not omitted maintain stable names and relative arrangement relationships, so that the agent does not need to re-determine the position of various state information based on different page layouts.
[0072] The semantic segments mentioned above are not limited to the names listed, as long as they can express the current application state according to a fixed semantic structure.
[0073] 2. Action List Generation Unit 320 The action list generation unit 320 operates after the view-based visibility projection is completed.
[0074] The action list generation unit 320 does not directly read the hidden state fields in the complete authoritative state snapshot, but only receives the set of visible states output by the visual visibility projector 200, and generates the current executable action list by combining the pre-configured action template and action preconditions.
[0075] Action templates belong to the application business rule configuration and do not contain hidden state values in the current application instance. Each action template may include an action type identifier, an action payload field, field type requirements, candidate target determination rules, and submission method.
[0076] The action list generation unit 320 determines whether the corresponding action template meets the conditions for being opened to the current agent based on the current application stage, requesting subject role, public state, requesting subject's own state, and other fields that can be read in the visible state set.
[0077] Actions that meet the conditions are added to the list of currently executable actions; actions that do not meet the conditions are not added to the list of currently executable actions.
[0078] In actions involving target objects, a whitelist of candidate targets can be determined based on the set of visible states. Information about objects not projected through visibility should not alter the current agent's observable candidate target set due to their hidden attributes.
[0079] In particular, for two state snapshots that differ only in the values of hidden state fields that the current agent has no right to read, but have the same set of visible states, the input received by the action list generation unit 320 remains consistent, so the set of action types, the arrangement of actions, and the action content displayed to the agent are consistent.
[0080] Therefore, the unauthorized state field will neither directly enter the machine-readable state image, nor can it be indirectly inferred by the agent through the observable difference of "whether a certain action has occurred".
[0081] In a further implementation, the state mirror renderer 300 can also inline the current target and next step suggestion in the state mirror. The current target and next step suggestion are also generated based on the fields after visibility projection has been completed, without calling fields that have not entered the set of visible states.
[0082] (iv) Dual action endpoint 400 The dual action endpoint 400 is used to receive the action type and action payload submitted by the agent based on the machine-readable state mirror.
[0083] In one implementation, the dual action endpoint 400 uses a single HTTP POST action endpoint. Different business actions are submitted through the same action endpoint, and the specific business action is distinguished by the action type field.
[0084] The action payload carries the corresponding business parameters according to the action type.
[0085] For example, an action that does not require a target object may have an empty payload or only contain additional action information; an action that requires a target object may have a payload that includes the target object identifier; and an action that requires content to be filled in may have a payload that includes the content to be submitted.
[0086] After receiving an action request, the dual action endpoint 400 first identifies the identity of the intelligent agent, and then converts the action type and action payload into an internal business action that the authoritative state machine 100 can handle.
[0087] The dual action endpoint 400 itself does not re-establish a set of business validation rules independent of the graphical user interface, but instead calls the runtime action legality validation code path used by the existing graphical user interface pipeline in the authoritative state machine 100.
[0088] For actions with different origins but the same business semantics, the human graphical user interface and the intelligent agent invoke the same precondition assertion.
[0089] For example, if an action requires the requesting subject to be in a valid participation state, the current application stage to allow the action, and the action target to be in the whitelist, then the above condition judgment will be executed regardless of whether the action is triggered by a human user through the graphical user interface or by an intelligent agent through the dual action endpoint 400.
[0090] If the verification fails, the application truth state corresponding to the authoritative state machine 100 is not modified, and a rejection result and the error type that can be made public are returned to the requester.
[0091] When the verification passes, the authoritative state machine 100 executes the state transition corresponding to the action, generates a new state version, and appends an event stream.
[0092] (v) Status mirror endpoint 500 The state mirror endpoint 500 is used to receive state acquisition requests from the agent and return a machine-readable state mirror generated by the state mirror renderer 300.
[0093] In one specific implementation, the state mirror endpoint 500 uses the HTTP GET method.
[0094] The request must include at least the application instance identifier and the agent's identity information. The server locates the corresponding authoritative state machine 100 based on the application instance identifier, determines the current request subject based on the agent's identity information, and then calls the visual visibility projector 200 and the state image renderer 300 to generate the corresponding state image.
[0095] To avoid reading different versions of state information during a single state request, the state mirror endpoint 500 preferably reads a state snapshot corresponding to the same state version for a single request, and derives the response body and the response header information described later from the state snapshot.
[0096] (vi) Response header marker 600 The response header marker 600 is used to generate machine-friendly status markers for the response of the status mirror endpoint 500.
[0097] The response header marker 600 uses a state snapshot corresponding to the same state version as the state mirror response body, without reading subsequent states that may have changed.
[0098] The response header can include at least a status flag indicating whether the current requesting body needs to perform an action, the type of action that can be performed, and a status version number or round token.
[0099] The action type information in the response header must also not bypass the visibility projection.
[0100] In other words, if whether an action is allowed to be observed by the requesting subject depends on an unauthorized status field, then the response header is not allowed to provide the requesting subject with action information that could expose the value of that field unless that field is projected.
[0101] After receiving the response, the agent client 900 can read the response header first without immediately sending the entire state image to the large language model.
[0102] If the response header indicates that the agent does not need to perform any action at present, the agent client 900 will directly wait for the next state synchronization and will not trigger large language model inference.
[0103] If the response header indicates that the agent needs to perform an action, the agent client 900 further reads the machine-readable state image and submits the state image as a decision input to the large language model or other intelligent decision-making modules.
[0104] In a further implementation, the agent submits an action carrying the state version number or round token from the response header.
[0105] The server can implement idempotent processing for repeated action submissions of tokens in the same round. For example, it can only accept the first valid action and return the existing processing result or refuse to execute it again for subsequent repeated submissions, thereby avoiding repeated advancement of the authoritative state machine 100 in the same round or in the same pending state.
[0106] (vii) Self-describing access document publisher 700 The self-describing access document publisher 700 is used to publish machine-readable access guidance documents at a preset access address on the application server.
[0107] This access guide document is used to explain the machine interaction protocol used by the application to agents accessing the application for the first time.
[0108] The access guide document can be in Markdown format and should include at least the agent's work cycle, a description of the state image semantic segment, available action types, the correspondence between action payload fields, and a prompt template for use by large language models.
[0109] When the intelligent agent client 900 first connects to an application, it can first obtain the access guide document, from which it can determine the access method of the state mirror endpoint 500, the submission method of the dual action endpoint 400, the state query cycle, and the payload fields corresponding to different actions.
[0110] Therefore, different subsequent actions do not need to be configured with separate business interfaces, but can be completed through a unified state mirror endpoint and a unified dual action endpoint.
[0111] The self-describing access document primarily serves as a protocol description; its content itself does not constitute the application's authoritative state, nor is it used to replace the real-time action verification of the authoritative state machine 100.
[0112] (viii) Restricted ability movement channel 800 In some agent execution environments, agents may only be able to access ordinary web page links or initiate HTTP GET requests, but cannot construct POST request bodies or authentication headers as required by regular action endpoints.
[0113] In response to this situation, the present invention further provides a restricted capability action channel 800.
[0114] The restricted capability action channel 800 may include a one-time action address generation unit 810, a deduplication processing unit 820, and a status version verification unit 830.
[0115] The application server can determine whether an agent meets the calling capabilities of the dual action endpoint 400 based on the agent's pre-registered capability information, the initial access handshake result, or the detection result of submitting a request for a regular action.
[0116] When the agent is able to initiate a POST action request normally, continue to use the dual action endpoint 400.
[0117] When it is determined that the agent cannot meet the required request method, request body, or authentication header combination, the restricted capability action channel 800 is activated.
[0118] The one-time action address generation unit 810 generates a corresponding one-time GET action address based on the current action.
[0119] The one-time action address must be bound to at least the request subject's identity, the current authoritative state version, the action type, the action parameters, the one-time identifier, and the monotonically increasing sequence number.
[0120] One-time action identifiers are used to distinguish different action addresses, while sequence numbers are used to reflect the order in which the server generates action addresses for the current subject or the current action channel.
[0121] The one-time action address can be sent to the agent as part of the list of currently executable actions, or it can be set in the submission information of the corresponding action in the state image.
[0122] After the agent accesses the address of the one-time action, the server first uses the deduplication processing unit 820 to query whether the corresponding one-time identifier and / or sequence number already exist as a processing record.
[0123] If a processing record already exists, the current request is determined to be a duplicate request. Instead of executing the corresponding business action again, the processing result corresponding to the first request is returned.
[0124] If no processing record exists, proceed to status version verification unit 830.
[0125] The state version verification unit 830 compares the authoritative state version bound to the one-time action address with the current state version of the authoritative state machine 100.
[0126] If the two are inconsistent, it indicates that the application state has changed after the one-time action address was generated, the current action address has expired, and the server refuses to execute the corresponding action.
[0127] If the two match, then continue to check the validity of the sequence number and whether the action itself meets the runtime business prerequisites.
[0128] For actions that pass the verification, the action validity verification path is still shared with the graphical user interface pipeline and the normal POST action endpoint, instead of the business state being changed separately by the GET action channel.
[0129] In the case of concurrent access or network retries, the deduplication process and corresponding state changes are better processed atomically, so that even if the same one-time action address is prefetched by the client, rendered multiple times, or accessed repeatedly by network retries, only one valid authoritative state change will be generated.
[0130] (ix) Intelligent Agent Client 900 The intelligent agent client 900 is used to access the state image endpoint 500, read the response header and machine-readable state image, and call the intelligent decision module to obtain the action result when an action needs to be performed.
[0131] The intelligent agent client 900 can run on a standalone server, in a browser environment, in an application plugin environment, or in other execution environments capable of initiating network requests.
[0132] For polling applications, the agent client 900 periodically accesses the state mirror endpoint 500 according to the polling cycle given in the access guide document.
[0133] For applications that support server-initiated push, state updates can also be triggered synchronously through event push or server-sent events.
[0134] Different synchronization methods only change the time when the agent client 900 learns of the state change, without changing the processing logic between the authoritative state machine 100, the visual visibility projector 200, the state mirror renderer 300, and the dual action endpoint 400.
[0135] See Figure 2 The present invention also provides a method for intelligent agent access based on state mirroring and dual action endpoints.
[0136] S1. Maintain the authoritative state machine on the application server. Step S1 is used to form an application truth source that is commonly dependent on subsequent state readings, visibility projections, action generation, and action execution.
[0137] S11. Establish application instance and participant record. When creating a stateful application instance, the application server generates an instance identifier for the application instance and establishes a corresponding state data structure.
[0138] The state data structure should at least store the current application stage, state version, set of participating entities, attributes of participating entities, basic configuration of currently executable actions, and event stream.
[0139] For each participating entity, the server records a unique identifier for that entity and, based on the specific business requirements, records its role, group, participation status, and privacy attribute affiliation.
[0140] Both human users and intelligent agents are registered as entities capable of participating in changes to the current application state, but they use different interaction entry points.
[0141] S12. Establish phase transition rules and action legality rules. The server establishes phase transition relationships based on the application's business process.
[0142] Each application phase is associated with the business actions that are allowed to occur in that phase, as well as the prerequisites for those actions.
[0143] Action preconditions are stored in the server-side business validation logic and are shared by the graphical user interface pipeline and the agent interaction pipeline.
[0144] For example, the prerequisites for an action include the current subject's identity being valid, the subject having the corresponding role, the current application stage allowing the action, the target object belonging to the current set of allowed targets, and the action payload field meeting the requirements.
[0145] The server does not copy the above rules for the graphical user interface and the agent respectively.
[0146] S13, Forming State Versions and Event Logs An initial state version is generated when the application starts.
[0147] Subsequently, whenever any action that has been validated for legitimacy causes a change in the state of the authoritative application, the state data is updated and a new state version is generated.
[0148] The corresponding action is simultaneously converted into an event record and appended to the event stream.
[0149] Event logs can include the action subject, event type, event target, event state version, and visibility attribute.
[0150] Therefore, when reading the state in the subsequent step S2, the state field and event field under the same state version can be obtained from the authoritative state machine.
[0151] S14. Provide a unified internal call entry point for the two types of interaction pipelines. The authoritative state machine provides internal interfaces for state reading and action submission to the graphical user interface pipeline, and also provides corresponding internal interfaces to the state mirror renderer and the dual action endpoint.
[0152] Although human users and intelligent agents use different external interaction methods, they ultimately rely on the authoritative state machine as the business basis for state reading and action execution.
[0153] After S1 is completed, a state snapshot corresponding to the current state version is generated, and the state snapshot is used as the input for S2 to perform visibility projection.
[0154] S2, Respond to the agent's state acquisition request and perform server-side visibility projection. S2 takes the authoritative state snapshot formed by S1 and its output is a set of visible states that only contain the content that the current requesting agent has the right to read.
[0155] S21. Receive status acquisition request and parse the request body. The agent sends a state acquisition request through the state mirror endpoint.
[0156] The request must include at least information for identifying the application instance and information for identifying the agent.
[0157] The application server locates the authoritative state machine established in S1 based on the application instance information, and then queries the role, participation status and permission information of the current subject based on the agent's identity information.
[0158] When the identity information is invalid, the application instance does not exist, or the requesting entity does not have permission to access the application instance, the server terminates the current status acquisition process and does not output the application business status.
[0159] S22. Read the state snapshot corresponding to the current state version. After identity verification is successful, the state snapshot corresponding to the current state version is read from the authoritative state machine.
[0160] The content read includes status fields, event fields, the current application stage, and request body attributes required for subsequent execution of visibility rules.
[0161] For a single state retrieval request, it is preferable to obtain the above information in the same consistent read process, so that the current stage, state field, event field, and state version correspond to the same authoritative state.
[0162] S23. Select the visibility rule corresponding to the request subject. The source of the currently applicable visibility rules is determined based on the agent's identity, role, and current application stage.
[0163] For each status field and event field, query the corresponding visibility rule based on its field identifier.
[0164] If a field is a public field, it will be added to the visible state set.
[0165] If a field is a completely hidden field, it will not be included in the visible state set.
[0166] If the field is a publicly accessible field by role or identity, then determine whether the current agent belongs to a set of roles or subjects that are allowed to access it.
[0167] If the field is a private field of the main body, then compare whether the field owner is consistent with the current requesting body.
[0168] For fields with phased public disclosure conditions, it is also determined whether the current application phase or the status of the corresponding participating entity meets the public disclosure trigger conditions.
[0169] S24. Generate a set of visible states. Write the state fields and event fields that S23 determines to be allowed to be accessed into a new visible state set.
[0170] The state set is a data object oriented towards the current request subject, separate from the original state snapshot.
[0171] The state mirror renderer subsequently reads this set of visible states instead of directly receiving a full state snapshot containing unauthorized field values.
[0172] For fields that do not pass visibility projection, their field values, corresponding private events, or auxiliary content that uniquely reflects their field values are not written into the visibility state set.
[0173] The set of visible states output by S24 is directly used as input for S3 to generate a machine-readable state image and a list of currently executable actions.
[0174] S3. Generate a machine-readable state image and a list of currently executable actions based on the set of visible states. S3 does not reread the complete authority state from S1, but processes it based on the set of visible states output by S2.
[0175] S31, Organization Machine-Readable State Mirror According to the pre-defined semantic structure, the fields in the visible state set are organized into a machine-readable state image.
[0176] When using Markdown, the following segments can be formed in sequence: metadata segment, request subject perspective segment, current action status segment, list of executable actions segment, application status segment, and recent events segment.
[0177] The metadata segment contains the instance identifier, current stage, and state version.
[0178] The request subject's perspective segment writes the current agent's own identity, role, and private states that are allowed to be made public.
[0179] The application state segment writes the business state and other participating entity states that the agent is allowed to access.
[0180] The most recently written event segment contains the events retained after S2 projection.
[0181] Semantic segments lacking corresponding information can be omitted, but the names and relative order of the remaining semantic segments remain stable.
[0182] S32. Determine the action templates that the current agent can observe. Pre-set a set of action templates based on the current application type.
[0183] The action template includes action type, action payload field, field type, and optional candidate target determination rules.
[0184] In S32, action templates that meet the current conditions are selected based on the application stage, agent role, subject state, and other visible business states in the set of visible states.
[0185] The filtering process uses only the dynamic state fields from the visible state set output by S2, and does not reread the hidden state fields from the authoritative state snapshot as action determination conditions.
[0186] S33. Generate a list of currently executable actions. Convert the action templates that have passed the S32 filter into a list of currently executable actions.
[0187] For actions with target objects, a whitelist of candidate targets is further formed based on the object states in the set of visible states.
[0188] Actions that rely on fields not projected through S2 visibility to determine their presence will not be included in the current list of executable actions.
[0189] When two authoritative state snapshots differ only in the values of hidden fields that the current agent has no access to, and are processed by S2 to form the same set of visible states, the generated list of currently executable actions remains consistent because the state inputs received by S32 and S33 are the same.
[0190] Therefore, the agent cannot infer the hidden state field based on whether the current action list has changed.
[0191] S34. Write the action list to a machine-readable state image. Write the list of currently executable actions generated by S33 into the machine-readable state image generated by S31.
[0192] Each action must include at least the action type and action payload fields; it may also include field types, natural language descriptions, a whitelist of candidate targets, and submission methods.
[0193] In implementations that support zero-document cold start, the current goal and next step suggestions generated based on the set of visible states can also be written into the state image.
[0194] The above fields also do not read field values that have not been projected through S2.
[0195] S35. Generate an HTTP response header that originates from the same source as the response body. In implementations that employ a fast path for response headers, HTTP response headers are generated based on a state snapshot that is identical to the current machine-readable state image.
[0196] The response header should include at least a state flag indicating whether the agent needs to perform an action, the type of action that can be performed, and a state version number or round token.
[0197] The current executable action type in the response header is derived from the action list formed by S33, without generating another set of action information using the complete authority state.
[0198] Therefore, the response body and response header maintain consistency in state version and visibility control.
[0199] After S3 is completed, the machine-readable state image, response header, and corresponding state version enter S4.
[0200] S4. Return the state to the agent and receive, verify, and execute the agent's actions. S4 takes over the machine-readable state image and response header generated by S3 and completes the closed loop from "the agent reads the state" to "the agent's actions change the authority state again".
[0201] S41. Return the state image to the agent. The state image endpoint returns the machine-readable state image generated by S3 as a response body to the agent client.
[0202] When using the fast path with response headers, the response headers generated by S35 are also returned.
[0203] The agent client first reads the action status flag in the response header.
[0204] When the action state flag indicates that the agent does not need to perform an action at present, the agent client does not call the large language model, but instead re-initiates the state acquisition request after a preset time, or waits for the server to push the next state change.
[0205] When the action state flag indicates that the agent needs to perform an action, the agent client reads the machine-readable state image in the response body.
[0206] S42. The agent generates actions to be submitted. The intelligent agent client inputs a machine-readable state image into a large language model or other intelligent decision-making module.
[0207] The intelligent decision-making module determines the action to be executed based on the application status, recent events, and the list of currently executable actions in the machine-readable state image.
[0208] The actions output by the intelligent decision-making module should include at least the action type and the action payload.
[0209] In implementations that use state versions or round tokens, the agent client also associates the state version or round token returned by S3 with the current action submission.
[0210] S43. Submit and transform agent actions via dual action endpoints. A smart agent client with regular POST call capabilities submits the action type and action payload to the dual action endpoint.
[0211] The dual action endpoint parses the action request and converts it into the same internal business action form as the graphical user interface action.
[0212] The transformed business action should include at least the request subject, action type, and action payload, and when state versioning is used, it should be associated with a state version or round token.
[0213] S44. Call the runtime action validity verification path shared by the graphical user interface. The dual action endpoint submits internal business actions to the authoritative state machine established by S1.
[0214] The authoritative state machine performs the same precondition assertions as the graphical user interface pipeline.
[0215] The verification content includes whether the request subject is valid, whether the corresponding action is allowed in the current application stage, whether the action type belongs to the allowed action set, whether the action payload meets the field requirements, whether the target object is within the allowed target range, and other business prerequisites.
[0216] For actions that carry a state version or turn token, it is also determined whether the state on which the action is based is still valid.
[0217] If any of the preconditions are not met, the authority state is not updated, and a rejection result is returned to the agent.
[0218] If all checks pass, the corresponding state transition is executed.
[0219] S45. Action submission by a processing-limited agent. When the server determines that the agent cannot meet the conditions for calling the conventional dual action endpoint based on the pre-registered capability information, handshake results, or action submission probe results, it forms a one-time GET action address through the restricted capability action channel.
[0220] A one-time GET action address is bound to the identity of the request subject, the authoritative state version when the address was generated, the action type, action parameters, a one-time identifier, and a monotonically increasing sequence number.
[0221] The agent submits the corresponding action by accessing the one-time GET action address.
[0222] S46. Process one-time action addresses in the order of deduplication first, then state version. After receiving a one-time GET request to access the URL, the server first queries the deduplication record corresponding to the one-time identifier and / or sequence number.
[0223] If a duplicate record is found, the action will not be re-executed, and the result of the first processing will be returned directly.
[0224] If no duplicate record is found, compare the authoritative state version bound to the one-time GET action address with the current authoritative state version.
[0225] If the status versions are inconsistent, the action is determined to be invalid and execution is refused.
[0226] If the status version is consistent and the serial number is valid, then the shared runtime action legality verification path described in S44 is invoked again.
[0227] After the verification is successful, the corresponding state transition will be performed only once and the result of this processing will be recorded.
[0228] S47. Update the authority status and begin the next cycle. For actions that pass the validity check in S44 or S46, the authoritative state machine updates the application truth state, forms a new state version, and appends the corresponding event to the event stream.
[0229] After the update is complete, the new authoritative state will once again serve as the data source for the next S2 state retrieval request.
[0230] Therefore, this method follows: The formation of an authority; Visible projection; Generate a state image and a list of executable actions; Agent decision-making and action submission; Shared validity verification; Authoritative status update; Subsequent state images are regenerated The sequence continues to run, thus forming a complete closed loop of interaction between stateful intelligent agents.
[0231] III. The following are several corresponding implementation examples.
[0232] Example 1: Multiplayer Online Gaming Application This embodiment uses a 12-player werewolf game application as an example to illustrate the specific implementation process of the present invention.
[0233] The application features both human players and players controlled by intelligent agents, with each participant assigned a seat and a unique identifier.
[0234] The application server maintains the authoritative state machine 100.
[0235] The authoritative state machine 100 records at least the room identifier, current game stage, participant seats, role mapping, faction relationship, survival status, sheriff status, whether each participant is currently eligible to take action, public events that have occurred, private events, and the current state version.
[0236] The current game phases can include sheriff election, nighttime operations, daytime speeches, exile voting, special character actions, and the endgame.
[0237] The application server publishes the state mirror endpoint 500 and the dual action endpoint 400.
[0238] The state mirror endpoint 500 is used by the agent to query the current game state, and the dual action endpoint 400 is used by the agent to submit business actions such as speaking, voting, night actions, and character skills.
[0239] The application server also provides access guidance documentation through the self-describing access document publisher 700.
[0240] When the agent first connects, it reads the document to obtain the status query cycle, action type, action payload field, and action submission method.
[0241] In this embodiment, the agent accesses the state mirror endpoint 500 at a cycle of 3 to 5 seconds.
[0242] Each state acquisition request carries the agent's identity token and identity identifier.
[0243] The server determines the agent's seat and role based on the agent's identity, and then the view-based visibility projector 200 processes the current state snapshot.
[0244] If the requesting entity is a werewolf, then its own role and the identities of its werewolf teammates who meet the faction-shared rules are allowed to enter the visible state set.
[0245] If the requesting entity is a prophet, then that entity is allowed to enter the visible state set, but the actual entities of other participants are not allowed to enter the visible state set before they are verified or made public.
[0246] For participants who have been eliminated and whose roles should be made public according to the game rules, their role information is converted into public fields.
[0247] After certain special characters trigger the card-flipping conditions, their character information is also converted into public fields.
[0248] Results of investigations, nighttime kills, rescues, or other confidential actions will only be provided to entities with the appropriate permissions.
[0249] Nighttime communications within the werewolf faction are only accessible to werewolf faction participants.
[0250] After completing the above projection, the state mirror renderer 300 generates a Markdown state mirror based on the visible state set of the current agent.
[0251] The state image includes room information, current stage, the requesting agent's own role and state, information on currently visible participants, the most recent events after projection, and a list of currently executable actions.
[0252] The action list generation unit 320 determines the current action based solely on the projected information.
[0253] For example, during a normal daytime speaking session, if the current agent is the current speaker, a speaking action can be generated; if the current agent is not the current speaker, no business action that needs to be executed immediately will be generated.
[0254] During the voting phase, when the current agent is eligible to vote, a voting action is generated, and a whitelist of candidate targets is formed based on the information of surviving participants that are allowed to be made public.
[0255] For a certain hidden role field, its actual value will not be used as input for whether to generate a voting action or whether a candidate target appears, unless the field has already entered the visible state set of the current agent due to rule triggering.
[0256] The response header marker 600 forms, based on the same state snapshot, whether it is the current action round for the agent, the current action type, and the state version.
[0257] If the response header indicates that it is not the agent's action round, the agent client 900 will not call the large language model and will access the state mirror endpoint 500 again after the polling cycle ends.
[0258] If the response header indicates that the agent needs to perform an action, the agent client 900 sends a machine-readable state image to the large language model.
[0259] The large language model generates action types and action payloads based on the current action list.
[0260] For example, during the voting phase, voting actions and corresponding target seats can be generated; during the character skill phase, corresponding character skill actions and target objects can be generated.
[0261] The agent client 900 submits the action to the dual action endpoint 400.
[0262] After the dual action endpoint 400 converts the action into an in-game business action, it calls the same legality verification code path as the human player's graphical user interface.
[0263] The verification process must at least determine: whether the seat initiating the action is a currently valid participant; whether the current phase allows this type of action; whether the initiating entity is currently qualified for this action; whether the target seat exists in the current candidate target whitelist; and whether the action has already been executed in the current round.
[0264] After the verification is successful, the authoritative state machine 100 updates the game state and adds the corresponding events.
[0265] The next time the state is queried, the new state snapshot is again projected through the viewpoint visibility of the requesting agent.
[0266] In a set of practical applications in this embodiment, the original interfaces set up separately for different business actions included 13 fine-grained interfaces such as sheriff actions, voting, night actions, special role actions, speaking, game sessions, and event streams. After adopting the above-described intelligent agent access method, the intelligent agent mainly relies on a state mirror endpoint and an action endpoint to complete business interactions.
[0267] Meanwhile, during polling-based operation, the agent no longer invokes the large language model after each state poll. Instead, it triggers inference when the response header indicates that its own action is required, thereby reducing the invocation of the large language model during non-action phases. The aforementioned number of endpoints and inference triggering method are derived from the implementation records of actual multiplayer online game applications.
[0268] Example 2: Non-game-theoretic stateful applications This embodiment illustrates the state mirroring, identity projection, and action access methods of the present invention in non-game-playing applications.
[0269] This embodiment further includes e-commerce order fulfillment scenarios and enterprise collaborative workflow scenarios. Both scenarios use the authoritative state machine maintained by the application server as the source of business truth and adopt the same server-side visibility projection, state mirror generation, and action legality verification mechanisms as described above.
[0270] (a) E-commerce order fulfillment scenarios In e-commerce order fulfillment scenarios, each order is treated as a stateful application instance.
[0271] The authoritative state machine 100 records order identifier, current order stage, buyer identity, seller identity, customer service identity, order entry, payment status, delivery status, after-sales status, and recent event flow.
[0272] An order can go through the following stages in sequence: pending payment, pending shipment, in transit, pending confirmation, completed, and after-sales processing.
[0273] The intelligent agent can be integrated as a business assistant on the buyer's side, an automated customer service on the seller's side, or a mediation assistant on the platform side.
[0274] Different intelligent agents use different identity identifiers, so the visual visibility projector 200 can generate different sets of visible states for the same order state.
[0275] For example, for a buyer-side agent, the order items, order stage, public logistics status, and after-sales information that the buyer can read are included in the visible state set.
[0276] For the seller-side agent, further information related to order fulfillment and shipment can be read.
[0277] For the platform-side mediation agent, it can read and process the order information and negotiation information required for after-sales service within the scope authorized by the platform.
[0278] Information marked as internal communication between the seller and customer service is not output to the buyer's agent.
[0279] Buyers' privacy information is only disclosed to authorized entities according to preset business permissions, and is not shared with unrelated entities.
[0280] Negotiation records related only to the parties involved in the current order during the after-sales process are not made available to the parties involved in other orders.
[0281] The State Mirror Renderer 300 can organize order status into metadata, subject view, current to-dos, order status, and recent events.
[0282] The current list of actionable actions is determined based on the projected order status.
[0283] For example, when the visible status indicates that the order is in the pending payment state and the requesting entity is the buyer, corresponding payment or order processing actions can be provided; when the order enters the pending shipment state and the requesting entity is the seller, shipment processing actions can be provided; when the order enters the after-sales stage and the requesting entity is a customer service entity with after-sales processing authority, corresponding after-sales processing actions can be provided.
[0284] Internal records hidden from the current requesting party's perspective, not used to change the list of actions that the current requesting party can observe.
[0285] After the intelligent agent submits a business action through the dual action endpoint 400, it still calls the runtime business verification logic corresponding to the graphical user interface of the order system.
[0286] For example, the shipping action needs to verify whether the current order is in the stage where shipping is allowed and whether the current entity has seller operation permissions; the after-sales action needs to verify whether the order has entered the corresponding after-sales status and whether the current entity has the corresponding processing permissions.
[0287] (ii) Enterprise collaborative workflow scenario In enterprise collaborative workflow scenarios, each workflow instance corresponds to a stateful application instance in the authoritative state machine 100.
[0288] The authoritative state machine 100 records workflow identifiers, current stage, participating team members, task items, task dependencies, task status, and recent event flow.
[0289] Intelligent agents can be integrated as automatic members of a team, alongside human team members.
[0290] When an agent acquires workflow status, the visual visibility projector 200 determines its visible fields based on the agent's team, member type, and current workflow stage.
[0291] Regular team members can read team tasks within their authorized scope; read-only members only obtain public or read-only task information; external collaborators only obtain tasks and events explicitly shared with them.
[0292] The state image renderer 300 further generates the current workflow image based on the above set of visible states.
[0293] A machine-readable state image may include the current workflow stage, the tasks assigned to the current agent, the tasks that have been satisfied, the currently executable task actions, and the most recently published events.
[0294] Once an upstream task is completed by a human member and confirmed by the authoritative state machine, its corresponding state change enters the event stream.
[0295] If the event satisfies the prerequisite condition for the current agent to be assigned a task, then the condition will be added to the agent's visible state set during the next state acquisition, and the corresponding task processing action will be generated accordingly.
[0296] After completing the task, the agent submits the task result or the stage advancement action through the dual action endpoint 400.
[0297] This action is then processed through the business verification path shared by the workflow system's graphical user interface to determine whether the current task belongs to the agent, whether the dependencies are satisfied, and whether submission is allowed at the current stage.
[0298] Therefore, regardless of whether the application object is an order or an enterprise workflow, the intelligent agent does not directly parse the human graphical interface, but participates in subsequent business processing based on the current business status already confirmed by the application server.
[0299] The e-commerce order fulfillment and enterprise collaboration scenarios in this embodiment are extended applications of the protocol of this invention. Their status fields, roles, and permission relationships are derived from the design of the corresponding application scenarios. It is not recommended that the above scenarios have been deployed in production.
[0300] Example 3: Application of Capability-Limited Intelligent Agents to Standalone State Machines This embodiment uses a state machine game application deployed on a single machine as an example to illustrate the specific implementation of the restricted ability action channel 800.
[0301] The game engine process runs locally and maintains the game's authoritative state machine 100.
[0302] An authoritative status includes at least the current game phase, inventory status, temperature link status, lootable resources, current objective, events that have occurred, and status version.
[0303] The game engine provides the agent with a state mirror endpoint 500 and an action submission entry.
[0304] The machine-readable state image returned by the state image endpoint 500 may include, in addition to the projected current game state, a list of currently executable actions, the current objective, and a suggested next step.
[0305] The list of currently executable actions records the action type and corresponding parameter requirements.
[0306] When the State Mirror Renderer 300 generates the above content, it first performs visibility projection corresponding to identity and stage, and then uses the projected state fields to determine the executable actions, current goal, and next step suggestions.
[0307] If a field is not projected through visibility, it will neither enter the state mirror nor serve as a state input for determining whether an action enters the action list.
[0308] When an agent first accesses the state image, it can understand the interaction methods allowed by the current application based on the current state, executable actions, current goals, and next steps suggested therein.
[0309] For agents capable of making POST requests, actions can be submitted directly through the dual action endpoint 400.
[0310] For limited agents that can only access regular HTTP GET links and cannot form a POST request body or authentication header that meets the requirements, the server enables the limited capability action channel 800.
[0311] Let's take the current state as an example where there is a "resource pickup" action.
[0312] The server first determines whether the action is allowed to be made public to the current agent based on the current visibility state.
[0313] If public access is permitted, the one-time action address generation unit 810 generates a one-time GET action address corresponding to the picking action.
[0314] This address is internally bound to the current agent's identity, the authoritative state version when the address was generated, the type of pick-up action, the target resource parameters, the one-time identifier, and the current sequence number.
[0315] The agent does not need to construct a POST request itself; it can submit the action that has already been generated by the server simply by accessing the address.
[0316] After the server receives a one-time GET action address request, the deduplication unit 820 first checks whether the one-time identifier or sequence number has been processed.
[0317] If it has already been processed, then regardless of whether the current repeated access is caused by the agent actively making repeated requests, browser prefetching, page repeated rendering, or network retry, the picking action will not be executed again, but the result corresponding to the first processing will be returned.
[0318] Only when no duplicate records are found will the status version verification unit 830 further check the status version bound to the action address.
[0319] For example, when a one-time action address is generated, the target resource is still in a pickable state; if a human user or another entity subsequently acquires the resource, the authoritative state version changes, and the state version of the old one-time action address is no longer consistent with the current state version.
[0320] At this point, the server recognizes the address as a failed action generated based on the old state and will no longer perform the pickup operation.
[0321] When the one-time action address is not used, the state version is still consistent, and the sequence number is valid, the action is then submitted to the action validity verification path shared by the authoritative state machine 100.
[0322] After the action verification is passed, the authoritative state machine 100 performs resource status updates, inventory updates, and corresponding event additions, forming a new state version.
[0323] The processing results related to this action are synchronously written to the deduplication record, so that subsequent accesses to the same action address can only read the first processing result and cannot drive state changes again.
[0324] In a series of real-world end-to-end tests, the agent accessed the GET action channel via command-line requests to a client, a script environment, and a browser execution environment, respectively. The browser environment actually generated two access requests for the same one-time GET action address, while the server only generated one authoritative state change based on the one-time identifier and sequence number.
[0325] In another set of cold start tests, the agent did not load an independent command document beforehand. It was able to complete subsequent interactions by reading the currently executable commands, the current goal, and the next step suggestion information through a single state mirror access.
[0326] The above implementation demonstrates that the limited-capability agent can continue to participate in state machine applications even when the regular POST action channel cannot be used. Furthermore, by first performing deduplication checks and then state version checks, the system avoids repeated access that could lead to the same business action being executed multiple times. This embodiment and corresponding test results have been clearly documented in the original technical documentation.
[0327] The above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, 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 access system based on state mirroring and dual action endpoints, applied to stateful applications where human users and agents are the participating entities, characterized in that, include: The authoritative state machine, located on the application server, is used to maintain the application's truth state, stage transition rules, set of executable actions, attributes of participating entities, and event flow. It also serves as a shared state source and action validity verification source for the graphical user interface pipeline and the intelligent agent interaction pipeline. A visual visibility projector is used to respond to the state acquisition request of an agent. Based on the agent's identity and application stage, it performs server-side visibility projection on the state fields and event fields in the state snapshot read from the authoritative state machine to obtain a set of visible states. The state mirror renderer is used to generate a machine-readable state mirror from a set of visible states, and after visibility projection is completed, it generates a list of currently executable actions using only the set of visible states as input for action determination. The action list includes action type and payload fields. The dual action endpoint is used to receive the action type and action payload submitted by the agent based on the machine-readable state image, and forward it to the runtime action legality verification code path shared with the graphical user interface pipeline in the authoritative state machine, so that the agent's action and the human user's action call the same set of precondition assertions for verification. The generation of the current executable action list uses the same visibility rule source as the visibility projection of the state field and the event field. Actions that depend on fields that have not passed the visibility projection are not included in the current executable action list. Furthermore, when the state mirror renderer generates the current executable action list, it does not read fields that have not passed the visibility projection, so that changes in the values of the fields do not change the current executable action list. Verified human user actions and agent actions update the authoritative state machine and add event streams. The updated state snapshot is then projected through visibility to generate a subsequent machine-readable state image.
2. The intelligent agent access system according to claim 1, characterized in that, It also includes a state mirror endpoint and a response header marker, wherein the state mirror endpoint is used to return state information to the agent using the machine-readable state mirror as the response body; The response header flagger is used to generate a response header based on the same state snapshot that generates the machine-readable state image. The response header includes at least a state flag indicating whether the current requesting subject needs to perform an action, the type of currently executable action, and a state version number or round token. The response body and response header use the same visibility rule source for visibility projection. State fields that do not pass the visibility projection and information determined by the state fields are not written into the response body and response header.
3. The intelligent agent access system according to claim 2, characterized in that, It also includes an agent client, which is used to periodically access the state mirror endpoint and skip the large language model inference for the responder when the state flag indicates that the agent does not need to perform an action at present; When the state flag indicates that the agent needs to perform an action, the response body is provided to the large language model to obtain the action type and action payload, and the action type and action payload are submitted through the dual action endpoint; The action submission carries the status version number or round token, and the application server processes repeated action submissions carrying the same round token according to a preset idempotency rule.
4. The intelligent agent access system according to claim 1, characterized in that, The visibility rule source divides the status field and event field into at least public fields, hidden fields, fields that are public according to the identity or role of the participating subject, and private fields that are only visible to the subject corresponding to the field, and adjusts the visibility status of the corresponding fields according to changes in the application stage and / or changes in the status of the participating subject. Among them, fields that are converted from hidden state to visible state only enter the visible state set after the corresponding stage condition or subject state condition is met.
5. The intelligent agent access system according to claim 1, characterized in that, The machine-readable state image is in Markdown format and is set in a preset order as follows: metadata segment, request subject perspective segment, current action status segment, list of executable actions segment, application situation segment, and recent events segment; Each semantic segment is folded or omitted according to preset rules based on the application stage, and the names and relative order of the semantic segments that are not omitted remain unchanged; the actions in the current list of executable actions are configured with action type, action payload field and corresponding field type, and a candidate target whitelist can be configured.
6. The intelligent agent access system according to claim 1, characterized in that, It also includes a self-describing access document publisher, which is used to publish machine-readable access guidance documents at a preset access address on the application server. The access guidance document includes at least the agent's working cycle, semantic description of the state image, available action types, correspondence of action payload fields, and prompt templates for use by large language models. The agent accesses the state mirror endpoint according to the access guidance document and submits action payloads corresponding to different action types through a single dual action endpoint.
7. The intelligent agent access system according to claim 1, characterized in that, It also includes a restricted capability action channel. When the application server determines that the agent cannot meet the requirements of the request method, request body and authentication header field corresponding to the dual action endpoint based on the agent's pre-registered capability information, access handshake result or detection result of action submission request, it enables the restricted capability action channel based on HTTP GET request. The application server generates a one-time action address, which is bound to the requesting subject's identity, current authoritative state version, action type, action parameters, one-time identifier, and monotonically increasing sequence number. This one-time action address is then sent to the intelligent agent via the machine-readable state image or the list of currently executable actions.
8. The intelligent agent access system according to claim 7, characterized in that, After receiving an access request for the one-time action address, the application server first queries the deduplication record based on the one-time identifier and / or monotonically increasing sequence number; When the deduplication record is matched, the processing result of the first execution of the corresponding action is returned without changing the authoritative state machine again; when the deduplication record is not matched, it is determined whether the authoritative state version bound to the one-time action address is consistent with the current authoritative state version. Access requests with inconsistent state versions are rejected, and access requests with consistent state versions and valid sequence numbers are executed with the corresponding action and the authoritative state machine is updated.
9. A method for agent access based on state mirroring and dual action endpoints, applied to stateful applications where human users and agents are the participating entities, characterized in that... include: An authoritative state machine is maintained on the application server side. The authoritative state machine records the application truth state, stage transition rules, set of executable actions, attributes of participating entities, and event flow, and is shared by the graphical user interface pipeline and the intelligent agent interaction pipeline. In response to the agent's state acquisition request, server-side visibility projection is performed on the state fields and event fields in the state snapshot read from the authoritative state machine, based on the agent's identity and application stage, to obtain a set of visible states; A machine-readable state image is generated using the set of visible states, and after the visibility projection is completed, a list of currently executable actions is generated using only the set of visible states as the action determination input. The list of actions includes action type and payload fields. Return the machine-readable state image to the agent, and receive the action type and action payload submitted by the agent based on the machine-readable state image. Forward it to the runtime action legality verification code path shared with the graphical user interface pipeline in the authoritative state machine, so that the agent's action and the human user's action call the same set of precondition assertions for verification. The generation of the current executable action list uses the same visibility rule source as the visibility projection of the status field and the event field. Actions that depend on fields that have not passed the visibility projection are not included in the current executable action list. When generating the current executable action list, fields that have not passed the visibility projection are not read, so that changes in the values of the fields do not change the current executable action list. Verified human user actions and intelligent agent actions update the authoritative state machine and add event streams. The updated state snapshot is then projected through visibility to generate a subsequent machine-readable state image.
10. The intelligent agent access method according to claim 9, characterized in that, When returning the machine-readable state image to the agent, an HTTP response header is generated based on the same state snapshot that generated the machine-readable state image. The HTTP response header includes at least a state flag indicating whether the agent needs to perform an action, the type of action that can be performed, and a state version number or round token. When the state flag indicates that no action needs to be performed, the agent skips the large language model inference. When the state flag indicates that an action needs to be performed, the agent inputs the machine-readable state image into the large language model to obtain the action type and action payload, and submits the action with the state version number or round token. The application server processes repeated action submissions with the same round token according to a preset idempotent rule.
