Skip to main content
AgentKit is Coinbase’s developer toolkit for building AI agents that interact with onchain services. You write the agent logic, define its tools, and deploy on your own infrastructure — full control over every aspect of the agent’s behavior. When to use AgentKit: You need full control over your agent’s logic, tool definitions, and deployment pipeline in TypeScript or Python. For a skills-based harness with less boilerplate, see OpenClaw. What you’ll need:
  • Node 18+ (TypeScript) or Python 3.10+ (Python)
  • A CDP API key (free to create)
  • An LLM API key (OpenAI or compatible)

Install AgentKit

Terminal
npm create onchain-agent@latest
cd my-agent
cp .env-local .env
Install dependencies:
Terminal
npm install

Configure your API keys

Open .env and fill in your credentials:
.env
CDP_API_KEY_NAME=your_cdp_key_name
CDP_API_KEY_PRIVATE_KEY=your_cdp_private_key
OPENAI_API_KEY=your_openai_key
NETWORK_ID=base-sepolia
Get your CDP API key from the CDP Portal. The key grants access to Coinbase’s wallet infrastructure — your agent never touches private keys directly.

Create a wallet

AgentKit creates and manages a wallet through the CDP API. On first run, the scaffolded project automatically creates a wallet and saves it locally:
index.ts
import { AgentKit } from "@coinbase/agentkit";

const agentkit = await AgentKit.from({
  cdpApiKeyName: process.env.CDP_API_KEY_NAME!,
  cdpApiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY!,
  networkId: "base-sepolia",
});

const wallet = agentkit.wallet;
console.log("Wallet address:", wallet.getDefaultAddress());

Check your balance

const balances = await wallet.listBalances();
console.log("Balances:", balances);
Fund your wallet on Base Sepolia using the Base faucet, then re-run the balance check to confirm receipt.

Send a transaction

const transfer = await wallet.createTransfer({
  amount: 0.001,
  assetId: "eth",
  destination: "0xRecipientAddress",
});

await transfer.wait();
console.log("Transaction hash:", transfer.getTransactionHash());

Run the agent

Terminal
npm run start

Available actions

AgentKit’s action set covers common onchain operations. Key actions include:
ActionDescription
get_balanceCheck wallet balance for any token
transferSend tokens to another address
tradeSwap tokens via the CDP API
deploy_tokenDeploy an ERC-20 token
deploy_nftDeploy an ERC-721 collection
get_wallet_detailsRetrieve wallet address and network
request_faucet_fundsGet testnet tokens
For the full action list, see the AgentKit documentation.

Framework integrations

LangChain

Combine AgentKit with LangChain for complex agent workflows and tool chaining.

Vercel AI SDK

Build streaming AI agents with AgentKit tools and the Vercel AI SDK.