Skip to main content
The mandate demo connects a Privy embedded wallet to an OpenAI agent built with Coinbase AgentKit. The owner approves recipients, transfer limits, a total budget, expiry, and gas reimbursement limits in their wallet. The agent can then request USDC transfers from that same account. GOL checks each request against the owner’s on-chain mandate.

Open the demo

Explore the deployed Base Sepolia application.

Browse the source

Read the Next.js application, its GOL integration, and its tests.
This example uses the Base Sepolia testnet, the GOL version 3 core, hosted API 0.5.0, and @gol/sdk@0.5.0. The application is a demonstration, not an audited or mainnet product. The availability page defines the exact supported account configurations and limits.

How it works

The account remains the owner’s EOA. GOL’s reviewed EIP-7702 setup delegates it to Biconomy Nexus 1.3.3 and installs the GOL core. Privy holds the owner key and presents the owner’s signing requests. The demo server holds a separate, unfunded agent signer and a scoped GOL test API key. GOL’s relayer submits agent actions and receives network gas reimbursement in the same transaction, within the owner’s signed caps. The agent signer never pays gas or receives the owner’s funds.

Code highlights

These excerpts point to the complete source. They show integration boundaries; the repository contains the surrounding authentication, error handling, polling, and UI code.

Bind the owner’s wallet before signing

Privy can have more than one linked wallet. The demo binds its EIP-7702 signer to the EOA being set up, and the SDK verifies that the authorization and initialization signatures recover to that account. A signature from another linked wallet is refused before submission.
See the Privy signer adapter and owner flow. The second call above is abbreviated; the application builds those signer adapters from the active Privy wallet.

Turn the owner’s choices into a mandate

The owner enters 1 to 16 payees, a maximum per transfer, a lifetime total, and gas limits. Only payee addresses become authority. Names remain local labels for the agent interface. The server prepares a policy, and the browser asks the owner to sign only after the SDK checks the prepared payload against the form values.
The owner sends the approval transaction and pays its network gas. The agent cannot create or widen that approval with the GOL API key. See policy preparation, owner signing, and the hosted gas guide.

Give AgentKit one payment path

The demo registers one custom GOL action provider. The model chooses a payee name and an amount; code resolves the name to an address, parses the amount in USDC base units, and asks GOL to prepare the action. The agent signs the prepared action and its maximum network charge before submission.
actionId is the idempotency key. If a submission times out, the demo looks up that ID before reporting its outcome, because the transaction may already have been sent. An unknown payee name is stopped by name resolution. A valid address outside the owner’s allowlist can reach the core, which refuses it on-chain. See the action provider and AgentKit registration.

Show API state beside chain evidence

The proof panel fetches GOL’s execution details and independently reads the transaction receipt from public Base Sepolia RPC. It decodes the core’s execution or refusal event, USDC Transfer, and inline GasSettled event. It displays the two views together and flags a disagreement. A receipt can appear before GOL confirms the action at Base’s safe head; safe is not Ethereum finality. The example’s live test verified one owner approval and one 0.1 USDC agent transfer with on-chain MandateActionExecuted, USDC Transfer, and GasSettled events. The demo’s owner-specific on-chain refusal and delegation-reset paths have not been verified live. The receipt decoder tests cover a recorded transfer and a refusal fixture. The Vercel site and its unauthenticated API guards have been checked. An authenticated run at the hosted origin is pending confirmation of that domain in the Privy app settings.

Use the pattern with another stack

GOL’s authority is the owner-signed policy and the compatible account’s on-chain enforcement. Privy, Next.js, AgentKit, and OpenAI are application choices in this example. A different stack can use the same public API and SDK if it supplies the required signing and account behavior. Account support is specific to reviewed implementations and configurations; a wallet provider alone does not make an account compatible. Integrate hosted gas covers the complete supported flow beyond this application example.

Run the example

Clone the repository, use Node.js 22 or later and pnpm 11, and follow its setup guide. You need a Privy app with an embedded EOA, a GOL test project with a scoped key, an OpenAI API key, and an agent signing key. The owner needs Base Sepolia ETH for the approval and inline gas reimbursement, plus testnet USDC for transfers. Keep the GOL and OpenAI keys and the agent key server-side; the owner key stays in their wallet.
The demo asks the owner to configure payees and limits, approve the mandate, and then visit /agent. Owner pause, resume, and revocation are separate wallet actions and require no cooperation from the agent.