Coinbase AgentKit Base RPC provider: BlockVectra setup
Use BlockVectra as the Base RPC provider for Coinbase AgentKit: point ViemWalletProvider's viem client at the keyless public endpoint, then add a key.
To use BlockVectra as the Base RPC provider for Coinbase AgentKit, note that AgentKit sends its onchain actions through a wallet provider, and ViemWalletProvider accepts any viem WalletClient. Give that client https://api.blockvectra.com/v1/base_mainnet/public as its transport and AgentKit's RPC traffic uses BlockVectra without an API key. A key adds the rest; the Free Plan gives 30,000,000 CU per 30-day window. Checked .
import { AgentKit, ViemWalletProvider } from "@coinbase/agentkit";
import { getLangChainTools } from "@coinbase/agentkit-langchain";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
const client = createWalletClient({
account: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`),
chain: base,
transport: http("https://api.blockvectra.com/v1/base_mainnet/public"),
});
const agentKit = await AgentKit.from({ walletProvider: new ViemWalletProvider(client) });
const tools = await getLangChainTools(agentKit);Install with npm install @coinbase/agentkit @coinbase/agentkit-langchain viem. tools is the list AgentKit's LangChain integration passes to createAgent({ model, tools }); the wallet key stays in your environment.
Use an API key
The public endpoint serves only the methods in each chain's public.methods. For the others, send the key in the x-api-key header and keep it in the environment, so it never appears in the URL:
const transport = http("https://api.blockvectra.com/v1/base_mainnet", {
fetchOptions: { headers: { "x-api-key": process.env.BLOCKVECTRA_API_KEY! } },
});If a client cannot set headers, the key can go in the URL path (/v1/{chain}/{api_key}) instead; URLs can end up in access logs, so prefer the header.
Create the key without a browser with the four steps in the programmatic sign-up guide: challenge, signature, login, then POST /keys. Developers can also create a key in the console. One key works on every chain, so switching the agent to another network only changes the chain slug and the viem chain object.
Combine AgentKit actions with the docs MCP server
AgentKit's TypeScript package exposes its actions as LangChain tools, so MCP tools from LangChain's adapter go into the same tools array. Follow the LangChain guide to load https://docs.blockvectra.com/mcp, then merge:
const agent = createAgent({ model: "claude-sonnet-5", tools: [...tools, ...(await adapter.listTools())] });The agent gets AgentKit's wallet actions plus BlockVectra's list_chains, get_status, rpc_call and read_doc, listed on the MCP server page. Connecting needs no key.
Errors you may see
| Response | Meaning | What to do |
|---|---|---|
HTTP 401, -32024, missing_api_key | A keyed request was sent without a key | Send the key in the x-api-key header (or the URL path) |
HTTP 401, -32024, invalid_api_key | Key unknown, disabled or revoked | Check the key in the console; a new key takes a few seconds to activate |
-32601, method_not_public | Method is not in the chain's public.methods | Switch that transport from /public to the keyed URL |
Each BlockVectra error includes data.reason and a docs_url; the full list is on the errors page.
Official documentation
Common questions
Does BlockVectra see the wallet private key? No. The viem account signs locally; the endpoint receives reads and signed raw transactions.
Can the agent read logs through the public endpoint? No. eth_getLogs and the Data API need an API key.
Does the key go in the MCP tool arguments? No. Keep it in the environment or the MCP client headers.
Next steps
- Agent framework overview for LangChain, ElizaOS, viem and wagmi.
- Connect an AI agent to discover endpoints with MCP, llms.txt and OpenAPI.
- Billing rules for CU metering, rate limits and non-billed errors.
Last updated:
ElizaOS
Use BlockVectra as the RPC provider for the ElizaOS EVM plugin (plugin-evm) with two environment variables, keyless on the public endpoint, plus docs MCP.
Programmatic sign-up
Sign a message locally with your wallet and get an API key plus 30,000,000 free CU, no payment first. 3 BlockVectra HTTP requests and a local wallet signature in 4 steps, no browser, for developers and AI agents.