Skip to main content

What is the AgentKit provider?

The @mandate.md/agentkit-provider package gives you two classes for Coinbase AgentKit: MandateWalletProvider (handles wallet operations with policy checks) and MandateActionProvider (exposes Mandate tools as AgentKit actions). Every transaction validates against your Mandate policies before signing.

Installation

bun add @mandate.md/agentkit-provider @coinbase/agentkit
@coinbase/agentkit is a peer dependency (>=0.1.0).

Usage

import { MandateWalletProvider, mandateActionProvider } from '@mandate.md/agentkit-provider';

const walletProvider = new MandateWalletProvider({
  runtimeKey: process.env.MANDATE_RUNTIME_KEY!,
  privateKey: process.env.PRIVATE_KEY! as `0x${string}`,
  chainId: 84532,
});

const actions = mandateActionProvider();
Pass walletProvider and actions to your AgentKit agent configuration. The wallet provider wraps MandateWallet from the SDK, so every sendTransaction() call goes through Mandate validation first.

Actions

ActionDescription
mandate_transferTransfer ERC20 tokens. Accepts to, amount, tokenAddress, waitForConfirmation.
mandate_x402_payPay for an x402-gated resource. Accepts url and optional headers.
mandate_get_policyGet info about the current spending policy.
mandate_get_quotaGet remaining daily/monthly spend quota.
The action provider uses Zod schemas for input validation. Invalid parameters fail fast before reaching the Mandate API.

WalletProvider methods

MethodDescription
getAddress()Returns the wallet’s EVM address.
getNetwork()Returns { networkId, chainId, protocolFamily: 'evm' }.
sendTransaction(tx)Validates with Mandate, signs locally, broadcasts. Returns txHash.
getMandateWallet()Returns the underlying MandateWallet instance for direct access.

Error handling

Action methods return descriptive strings instead of throwing. This lets the LLM read the error and decide what to do next.
// Policy block:
// "Transfer blocked by Mandate policy: daily_limit_exceeded"

// Approval required:
// "Transfer queued for approval. IntentId: int_abc123. ApprovalId: apr_xyz789"
The approval response includes intentId and approvalId. Your agent can poll for approval status using these identifiers, or direct the user to the dashboard to approve.
The signMessage() method is not implemented. Use sendTransaction() or the action tools for policy-enforced operations.

Configuration

ParameterTypeRequiredDescription
runtimeKeystringYesMandate runtime key (mndt_live_... or mndt_test_...)
privateKey`0x${string}`YesAgent wallet private key (hex, with 0x prefix)
chainIdnumberYesEVM chain ID (e.g., 84532 for Base Sepolia)
rpcUrlstringNoRPC endpoint URL

Next Steps

Integrations Overview

Compare all supported agent frameworks side by side.

Handle Approvals

Build approval workflows when transactions exceed thresholds.

Handle Errors

Catch and respond to every Mandate error type in your agent.