What is the GAME SDK plugin?
The@mandate.md/game-plugin package adds Mandate policy enforcement to GAME SDK agents by Virtuals Protocol. It exposes GameWorker functions that validate every on-chain action against your Mandate spending policies before execution. Available in both TypeScript and Python.
Installation
@virtuals-protocol/game is a peer dependency (>=0.1.0).
Usage
MandateWallet from the SDK for local signing. The Python version calls the Mandate API directly via HTTP for validation, and returns the result to the GAME agent for further action.
Functions
| Function | Description |
|---|---|
mandate_transfer | Transfer ERC20 tokens with policy enforcement. Args: to (or to_address), amount, token_address. |
mandate_x402_pay | Pay for an x402-gated resource. Args: url. TypeScript only. |
Configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
runtimeKey / runtime_key | string | Yes | Mandate runtime key (mndt_live_... or mndt_test_...) |
privateKey / private_key | string | Yes (TS only) | Agent wallet private key (hex, 0x prefix) |
chainId / chain_id | number / int | No | EVM chain ID. Defaults to 84532. |
rpcUrl / rpc_url | string | No | RPC endpoint URL |
workerDescription | string | No | Custom description for the GameWorker (TS only) |
Error handling
The GAME SDK uses a status-based return model. Functions return aFunctionResult with one of three statuses.
| Status | Mandate meaning |
|---|---|
done | Transaction validated and sent. Result contains txHash and intentId. |
failed | Blocked by policy. Feedback contains the block reason (e.g., "Blocked by policy: daily_limit_exceeded"). |
pending | Approval required. Feedback contains the intentId for polling. |
getEnvironment() method on the worker returns { chainId, policyEnforcement: 'active' }, giving the GAME agent context about its operating constraints.
Next Steps
Integrations Overview
Compare all supported agent frameworks side by side.
SDK Overview
Use the TypeScript SDK directly for maximum control.
ACP Plugin
Add Mandate to ACP (Agent Commerce Protocol) for inter-agent payments.