Coinbase AgentKit

agent402-agentkit · npm · MIT

An AgentKit action provider. An agent with a CDP, Privy, ZeroDev or viem-backed wallet gets three actions and pays for wallet-only tools over x402 in USDC on Base, signed by its own wallet provider. The signer is derived the same way AgentKit's own x402 provider derives it (toSigner() plus readContract).

Install

npm install agent402-agentkit @coinbase/agentkit @x402/fetch @x402/evm zod

Example

import { AgentKit, CdpEvmWalletProvider } from "@coinbase/agentkit";
import { agent402ActionProvider } from "agent402-agentkit";

const walletProvider = await CdpEvmWalletProvider.configureWithWallet({
  apiKeyId: process.env.CDP_API_KEY_ID,
  apiKeySecret: process.env.CDP_API_KEY_SECRET,
  walletSecret: process.env.CDP_WALLET_SECRET,
  networkId: "base-mainnet",
});

const agentKit = await AgentKit.from({
  walletProvider,
  actionProviders: [await agent402ActionProvider()],
});
// hand agentKit.getActions() to your framework

What it exposes

  • agent402_find (free): a task in, the best-matching tools out, with price and whether a wallet is needed.
  • agent402_call: calls a tool by slug; free-tier tools pay with proof-of-work, wallet-only tools pay over x402 from the wallet provider.
  • agent402_about (free): what the service is, how it is paid, live tool counts.
  • agent402Actions() returns the raw action list for hosts that wrap actions themselves.

How payment works

  • x402 in USDC on Base, signed by the AgentKit wallet provider. The key never leaves the provider.
  • maxPerCallUsd (default 1), dailyLimitUsd and maxPerHostUsd are measured against one client per wallet provider, so the daily ceiling holds across calls.
  • creditsKey (a prepaid a402_... key) pays wallet-only tools without a wallet.
// spend bounds, checked before any signature
await agent402ActionProvider({
  maxPerCallUsd: 1,          // refuse a paid call above this
  dailyLimitUsd: 5,          // rolling 24-hour ceiling
  payees: ["0x..."],         // refuse a 402 that names any other payTo
});

A call that fails is not charged: settlement runs after the tool and only on a successful response. Background: What x402 is · MPP (Machine Payments Protocol).

Tools to try first

Crypto price$0.001
crypto-price
Web search$0.02
search
Web answer$0.08
answer
Hash$0.001
hash
Route and execute$0.01
route-execute

Every tool, price and input schema: the catalog.

Links

agent402-agentkit on npm · source on GitHub
Guides: Pay Agent402 from Coinbase's own agent tooling: Agentic Wallet CLI, Agentic Wallet MCP, purl, and the CDP SDK · Give your agent a wallet - non-custodial, from zero to first x402 payment
All integrations