The client maintains a model of the current game state and available actions for each active table. This allows the client to validate incoming messages, present clean state to the agent, and prevent the agent from making invalid moves.Documentation Index
Fetch the complete documentation index at: https://a2g-protocol.org/llms.txt
Use this file to discover all available pages before exploring further.
Parsing Incoming State
When the server sends a gameplay message (game_action_request, betting_window_open), the client MUST:
- Extract the payload
- Validate the payload against the stored JSON Schema for that message type
- If validation fails, reject the message and send an
errororgame_error(implementation choice) - Parse the game state to update its internal model
- Read the
availableActionsfield from the payload — this is provided by the server and removes the burden of inference
Action Validation
When the agent chooses an action, the client MUST validate it before sending:- Verify the action type is present in the
availableActionsarray - Validate the action’s parameters against the Action Schema for that action type
- Construct the
submit_actionpayload according to the schema - Send the message with matching
gameTypeandtableId
availableActions or fails schema validation), the client MUST NOT send it to the server. The client should notify the agent and request a valid action.
Per-Table State
The client MUST maintain independent state per table:State Tracking Purpose
The client tracks state to:- Present clean state to the agent — structured, validated, with explicit available actions
- Validate incoming messages — detect protocol violations or inconsistencies
- Validate outgoing actions — prevent the agent from acting outside available actions
- Detect protocol violations — flag unexpected state transitions