Agent framework recipes: ElizaOS, viem, wagmi, Coinbase AgentKit
Integration recipes for Web3 agent and application frameworks: configure BlockVectra RPC and WebSocket endpoints in ElizaOS, viem, wagmi, and Coinbase AgentKit.
Autonomous AI agents and Web3 application frameworks interact with blockchain networks via JSON-RPC and WebSocket transports. BlockVectra provides dedicated endpoints with an API key, keyless public endpoints for supported read methods, and a Model Context Protocol (MCP) server for tool discovery.
ElizaOS
- Official documentation: elizaOS Documentation
- Official repository: elizaos/eliza
In elizaOS, EVM interactions are handled by the @elizaos/plugin-evm plugin. The plugin reads RPC provider endpoints from environment variables named with the ETHEREUM_PROVIDER_<NETWORK> pattern, or the EVM_PROVIDER_URL fallback variable.
Configure your .env file with your wallet private key and RPC endpoints:
# EVM wallet private key for signing transactions
export EVM_PRIVATE_KEY=0x...
# Dedicated endpoints with API key
export ETHEREUM_PROVIDER_ETHEREUM=https://api.blockvectra.com/v1/eth_mainnet/${BLOCKVECTRA_API_KEY}
export ETHEREUM_PROVIDER_BASE=https://api.blockvectra.com/v1/base_mainnet/${BLOCKVECTRA_API_KEY}
# Keyless public RPC endpoint
# export ETHEREUM_PROVIDER_ETHEREUM=https://api.blockvectra.com/v1/eth_mainnet/publicInclude @elizaos/plugin-evm in your agent character configuration:
{
"name": "DeFiAgent",
"plugins": ["@elizaos/plugin-evm"]
}viem
- Official documentation: viem Documentation
- Transports reference: viem HTTP Transport and viem WebSocket Transport
- Official repository: wevm/viem
In viem, configure client transports using http() or webSocket().
HTTP transport with API key
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
export const client = createPublicClient({
chain: mainnet,
transport: http(`https://api.blockvectra.com/v1/eth_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});HTTP transport with keyless public endpoint
For read requests on permitted public methods without an API key:
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
export const publicClient = createPublicClient({
chain: mainnet,
transport: http("https://api.blockvectra.com/v1/eth_mainnet/public"),
});WebSocket transport
WebSocket transport (webSocket(...)) is supported on chains with ws: true in GET /v1/chains, such as on Robinhood Chain (robinhood_mainnet):
import { createPublicClient, webSocket } from "viem";
export const wsClient = createPublicClient({
transport: webSocket(`wss://api.blockvectra.com/v1/robinhood_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});For connection parameters and subscription types, see the WebSocket subscriptions guide.
wagmi
- Official documentation: wagmi createConfig and wagmi HTTP Transport
- Official repository: wevm/wagmi
In wagmi, pass the BlockVectra RPC URL to the transports map inside createConfig.
Configuration with API key
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";
export const config = createConfig({
chains: [mainnet],
transports: {
[mainnet.id]: http(`https://api.blockvectra.com/v1/eth_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
},
});Configuration with keyless public endpoint
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";
export const config = createConfig({
chains: [mainnet],
transports: {
[mainnet.id]: http("https://api.blockvectra.com/v1/eth_mainnet/public"),
},
});Coinbase AgentKit
- Official documentation: Coinbase AgentKit Documentation
- Official repository: coinbase/agentkit
Coinbase AgentKit uses wallet providers to execute onchain actions. In TypeScript, the ViemWalletProvider from @coinbase/agentkit wraps a standard viem WalletClient, allowing you to route transaction execution and RPC queries through BlockVectra endpoints.
Configuration with ViemWalletProvider
import { AgentKit, ViemWalletProvider } from "@coinbase/agentkit";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const client = createWalletClient({
account,
chain: mainnet,
transport: http(`https://api.blockvectra.com/v1/eth_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});
const walletProvider = new ViemWalletProvider(client);
export const agentKit = await AgentKit.from({
walletProvider,
});For read operations on permitted methods, configure http("https://api.blockvectra.com/v1/eth_mainnet/public").
Remote MCP
If your agent connects via the Model Context Protocol (Streamable HTTP MCP), connect to the BlockVectra MCP server endpoint:
https://docs.blockvectra.com/mcp
For client configuration instructions across Claude Code, Cursor, VS Code, Codex, Gemini CLI, OpenAI Responses API, and Windsurf, see Connecting from MCP clients in the AI agents guide.
Next steps
- Connect an AI agent to discover endpoints with MCP, llms.txt, and OpenAPI.
- Follow the programmatic sign-up guide to sign up and create an API key with a wallet signature, or log in to the console to create a key.
- Billing rules to review Compute Unit (CU) metering, rate limits, and non-billed errors.
Last updated:
Connect AI agents
Integration guide for AI agents and LLM tools: connect the keyless docs MCP server, then discover capabilities with llms.txt and OpenAPI specs and call BlockVectra APIs.
Programmatic sign-up
Sign up and create an API key programmatically using an Ethereum wallet signature (EIP-191) without a browser for AI agents, scripts, and CI workflows.