Skip to main content

Coinbase AgentKit + Stablecoin Routing

Coinbase AgentKit gives agents identity and wallets. Pair it with Eco Routes for cross-chain stablecoin routing across Base, Optimism, and beyond.

Written by Eco
Updated today

Coinbase AgentKit + Stablecoin Routing

Coinbase AgentKit is the fastest way to give an AI agent its own wallet and the authority to transact onchain. It sits inside the broader Coinbase Developer Platform (CDP) alongside OnchainKit and the CDP Wallet APIs, and it handles the parts of agentic infrastructure that are genuinely hard: wallet provisioning, key management, gas sponsorship, and a clean action interface for LLMs to call. What AgentKit deliberately does not do is cross-chain routing. That's where Eco Routes fits: AgentKit gives the agent a wallet and an identity, and Eco Routes moves that agent's stablecoins between the 15 chains where real liquidity lives.

This article covers the full CDP agent stack, the pattern for combining AgentKit with intent-based stablecoin routing, and code-level examples of wallet creation through AgentKit followed by an Eco Routes intent submission. It's written for engineers building agents that need to operate on Base today but transact across Optimism, Arbitrum, Solana, and beyond tomorrow.

The Coinbase Developer Platform agent stack

Coinbase shipped the CDP agent stack as a layered toolkit, each piece solving a different problem so you can adopt them independently or together. Understanding where each layer stops is important because it tells you what you still need to build (or integrate) on top.

OnchainKit — UI and read-side primitives

OnchainKit is a React component library for adding onchain features to a frontend: connect-wallet buttons, transaction status components, identity resolution, and fund-tracking widgets. It's the display layer, not the execution layer. For agent workloads, OnchainKit matters mostly for human-facing dashboards where a user watches what their agent is doing.

CDP Wallet API — programmatic wallet provisioning

The CDP Wallet API provisions custodial or server-side wallets programmatically. You call an API, you get a wallet with a generated address, a managed private key, and a signing surface. This is what makes agent wallets feasible at scale — spinning up a wallet for every new agent instance is an API call, not a key-generation ceremony. Enterprise teams can manage key custody through MPC, and developers can optionally export keys if they need full self-custody later.

AgentKit — the LLM-facing action layer

AgentKit is the piece that makes an LLM agent able to act onchain. It wraps the CDP Wallet API in a set of LangChain-compatible tools (and a plain Python/TypeScript interface for other frameworks) so an agent can call actions like transfer, swap, deploy_token, or read_contract as structured tool calls. The AgentKit repo on GitHub documents the full action set, which grows as new contract integrations land.

AgentKit's focus is Base. That's deliberate — Coinbase's strongest operational footprint, cheapest gas, and best stablecoin liquidity all sit on Base. For many agents, never leaving Base is fine. But the moment an agent needs to interact with a counterparty, API, or pool on another chain, AgentKit by itself doesn't have an answer.

Why agents need cross-chain stablecoin routing

Agents inherit their home chain from whatever runtime provisions them. An AgentKit-spawned agent lives on Base. That's a reasonable default, but the onchain world is multichain and getting more so. Consider the mismatches an AgentKit agent will run into:

  • The agent needs to call an x402 endpoint that settles on Optimism.

  • A counterparty prefers USDT on Arbitrum because that's where their treasury is.

  • A DeFi opportunity exists on HyperEVM or Unichain with 200 bps better yield.

  • The agent is paying a user who holds USDC on Solana.

In every case, the agent needs USDC on Base converted to stablecoin-on-destination-chain, atomically, with predictable pricing. That is not a swap. It is not a bridge transfer (those are multi-step and reversible mid-flight). It is a cross-chain intent: "debit this amount here, credit that amount there, within N seconds." This is exactly the primitive intent-based routing protocols provide.

Eco Routes is the specific implementation optimized for stablecoins. It treats the agent's USDC balance on Base as a source and the destination-chain USDC (or USDT, or USDC.e) as the target, with solvers competing to fulfill the intent at the tightest price. Crucially, this lets AgentKit stay focused on what it's good at — giving the agent a wallet and action interface — while delegating cross-chain mechanics to a routing layer that's built for them.

The combined pattern: AgentKit + Eco Routes

The mental model is simple. AgentKit owns the agent's wallet and identity on Base. Eco Routes owns cross-chain movement. When the agent wants to act on another chain, it submits an intent through Eco Routes, which debits its Base wallet and credits the destination chain. The agent's subsequent action on the destination chain uses either a chain-agnostic endpoint (like x402) or a wallet the agent also controls on that chain (which CDP can also provision).

Here's the architecture in practice, laid out step by step.

Step 1: Provision the agent's wallet with AgentKit

An AgentKit setup in TypeScript looks like this. You create a CdpAgentkit instance, which internally provisions a wallet through the CDP Wallet API and wires it into a LangChain toolkit.

import { CdpAgentkit } from "@coinbase/cdp-agentkit-core";
import { CdpToolkit } from "@coinbase/cdp-langchain";
const agentkit = await CdpAgentkit.configureWithWallet({ cdpWalletData: null });
const toolkit = new CdpToolkit(agentkit);
const tools = toolkit.getTools();

After this runs, the agent has a Base wallet with an address you can fund. Fund it once with USDC (or have your user fund it through an OnchainKit flow), and the agent now has a stablecoin balance it can spend.

Step 2: Give the agent an Eco Routes action

AgentKit's action set is extensible. You can register a custom tool that calls the Eco Routes API. The tool takes a destination chain, a destination token, an amount, and a recipient, and returns an intent ID plus a settlement hash once the intent fills.

The underlying API call is a standard POST to the Routes endpoint. You construct an intent describing the source (the agent's Base wallet and USDC balance) and the destination (the target chain, token, amount, and recipient), sign it with the agent's CDP-managed key, and submit. Solvers pick it up; settlement usually lands in seconds. The Routes API surface is documented alongside the other treasury APIs, and the same pattern applies whether the caller is an agent or a batch job.

Step 3: Agent composes actions across chains

With both tools registered, the LLM can now plan multi-chain workflows. "Pay this 2 USDC x402 endpoint on Optimism" becomes a two-tool call: first a Routes intent to move 2.01 USDC from Base to Optimism (buffering for fee), then the x402 payment on Optimism using the newly-funded balance. The agent doesn't need to reason about bridging mechanics — the tool abstracts them.

For multi-chain treasury patterns, the same approach extends to stablecoin rebalancing workflows. An agent monitoring yields across HyperEVM and Base can move capital between them as rates shift, without human intervention.

Code-level walkthrough

Here is a minimum viable AgentKit + Eco Routes loop in pseudocode. It elides error handling for clarity but captures the real execution path.

// 1. Provision wallet
const agentkit = await CdpAgentkit.configureWithWallet({ cdpWalletData: null });
const wallet = await agentkit.getWallet();
const baseAddress = wallet.getDefaultAddress();

// 2. Register Eco Routes tool
const routesTool = {
name: "eco_routes_intent",
description: "Move stablecoins cross-chain atomically",
func: async (params) => {
const intent = {
source: { chain: "base", token: "USDC", amount: params.amount, from: baseAddress },
destination: { chain: params.destChain, token: params.destToken, to: params.recipient },
deadline: Date.now() + 60_000,
};
const signed = await wallet.signMessage(intentToEIP712(intent));
return await fetch("https://api.eco.com/routes/intents", {
method: "POST", body: JSON.stringify({ intent, signature: signed })
}).then(r => r.json());
}
};

// 3. Agent plans and executes
const tools = [...toolkit.getTools(), routesTool];
const agent = createReactAgent({ llm, tools });
await agent.invoke({ input: "Pay 2 USDC to 0xABC on Optimism" });

The LLM chooses to call eco_routes_intent with { amount: "2.01", destChain: "optimism", destToken: "USDC", recipient: "0xABC" }. The intent settles in a few seconds. Balance now sits on Optimism. A follow-up tool call completes the actual transfer on Optimism, using the agent's CDP-provisioned wallet on that chain (or a delegated signing address).

Why this decomposition works

There's a reason to keep AgentKit and the routing layer separate, even though Coinbase could in theory build cross-chain primitives directly into AgentKit. The same reason Stripe doesn't run an ACH network and Twilio doesn't run a mobile carrier: specialization produces better unit economics and faster iteration.

  • AgentKit's moat is identity, actions, and onramps. It wins by making agent onboarding five minutes of work and by tying into the rest of CDP's custody and fiat infrastructure. Every hour spent on cross-chain routing is an hour not spent deepening that moat.

  • Routing's moat is solver density and chain coverage. A routing network becomes more valuable as more solvers join and as more chains are supported. Building that inside a single developer platform would be slower than using a dedicated stablecoin network with an established solver network.

  • Composability is the point. An agent built on AgentKit should be able to swap out its routing layer as easily as a backend service swaps Redis clients. Keeping the surfaces clean makes that possible.

This layered design is also how the broader agentic stack is converging. Identity (ERC-8004), account abstraction (ERC-4337), HTTP-native payments (x402), and cross-chain settlement are all developing as independent standards that compose. AgentKit's strength is that it doesn't try to own all four — it owns identity and wallet, and plays well with the rest.

Operational considerations

If you're about to build on this pattern, a few practical notes.

  • Pre-fund Base, don't pre-fund everywhere. Keep the agent's working balance on Base. Let the routing layer move capital to destinations just-in-time. This minimizes idle float and simplifies reconciliation.

  • Set intent deadlines conservatively. A 30-60 second deadline gives solvers enough room to fill without leaving the agent waiting too long if no solver takes it.

  • Budget for fees explicitly. Intent-based routing has a small solver fee baked in. Include it in the agent's budgeting logic — don't assume 1 USDC in equals 1 USDC out.

  • Use webhooks for settlement notification. Don't poll. The Routes API supports webhook notifications for intent lifecycle events, which keep the agent's event loop clean.

Related articles

FAQ

What is Coinbase AgentKit?

AgentKit is a library from Coinbase that gives AI agents a wallet and a set of onchain actions — transfer, swap, deploy, read contract — exposed as structured tools an LLM can call. It sits inside the CDP agent stack alongside OnchainKit (UI) and the CDP Wallet API (wallet provisioning), and it's optimized for Base.

Does AgentKit support cross-chain transfers?

Not natively. AgentKit is focused on Base. For cross-chain stablecoin movement, pair it with an intent-based routing layer like Eco Routes, which handles the cross-chain mechanics across 15 chains including Optimism, Arbitrum, Solana, and other cross-chain stablecoin infrastructure destinations.

How do I add an Eco Routes action to an AgentKit agent?

Register a custom tool in the AgentKit toolkit that wraps the Routes API. The tool accepts a destination chain, token, amount, and recipient, constructs an intent, signs it with the CDP-managed wallet, and submits it to the Routes endpoint. The LLM then calls this tool like any other AgentKit action.

Does the agent need gas on every destination chain?

No. Intent-based routing handles settlement on the destination chain through solvers, so the agent doesn't need native gas tokens everywhere. Keep working balance on Base, let the routing layer move value, and use delegated signing or smart accounts for actions on the destination chain.

Can I use AgentKit with stablecoins other than USDC?

AgentKit's default flows are USDC-centric on Base. Once you add Eco Routes, the agent can settle into USDT, USDC.e, oUSDT, and other supported stablecoins on destination chains, because the routing layer handles stablecoin translation as part of the intent.

Did this answer your question?