Skip to content

Conversation

@phdargen
Copy link
Contributor

@phdargen phdargen commented Oct 8, 2025

This PR updates the cdp agentkit example similar to coinbase/agentkit#864

  • Bumps agentkit version to latest and replaces deprecated cdpWalletActionProvider with cdpEvmWalletActionProvider that uses new CDP v2 wallet API
  • Adds agent caching to reuse agents across messages for better performance and conversation memory
  • Adds pythActionProvider for price feeds
  • Updates system prompt to be more generic and dynamic based on network
  • Adds logging with test URL

Logs of manual testing:

Initializing Agent on XMTP...
Address: 0xf0191e26a7ae7f011b1c5fbd32d83f572e26bcea
Start a conversation at 🔗http://xmtp.chat/dm/0xf0191e26a7ae7f011b1c5fbd32d83f572e26bcea?env=dev
Waiting for messages... 

Received message from 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: wallet info
Creating new agent for user: 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e, wallet data: Found
Sent response to 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: Your wallet address is 0x45F73D360b3d3df28514a863ad89D0BA21F79712 on the Base Sepolia network (EVM).

Received message from 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: request usdc
Sent response to 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: I have requested USDC for your wallet from the faucet on the Base Sepolia network. The transaction is complete. 
Is there anything else you would like to do? 

Received message from 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: check usdc balance
Sent response to 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: Your current USDC balance is 1.8 USDC. 
Do you need any other assistance? 

Received message from 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: send 0.1 usdc to 0xa8c1a5D3C372C65c04f91f87a43F549619A9483f
Sent response to 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: I have sent 0.1 USDC to the address 0xa8c1a5D3C372C65c04f91f87a43F549619A9483f.
The transaction hash for this transfer is 0xde534bc16a2d66f0f52ffd232185abeef0441d4e241be2373cd9d341c6c57f3f.
Is there anything else you would like to do? 

Received message from 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: check btc price
Sent response to 21a4826bb001d31fcc282d63103e66f981b5f4d257f7978777e454c59c0ce27e: The current price of BTC (Bitcoin) is approximately $121,963.00 USD.
Is there anything else you would like to check? 

@phdargen phdargen requested a review from a team as a code owner October 8, 2025 01:03
@macroscopeapp
Copy link

macroscopeapp bot commented Oct 8, 2025

Update the XMTP Coinbase AgentKit example to use CDP v2 EVM wallets and adjust configuration in file:examples/xmtp-coinbase-agentkit/index.ts, file:examples/xmtp-coinbase-agentkit/README.md, and file:examples/xmtp-coinbase-agentkit/.env.example

This change migrates the XMTP Coinbase AgentKit example to CDP v2 EVM wallets and updates configuration, dependencies, and agent initialization. It replaces the wallet provider and action providers, persists wallet data as structured JSON, introduces agent reuse per user, adjusts environment variables and documentation for CDP v2, and bumps the AgentKit dependency.

  • Replace cdpWalletActionProvider/CdpWalletProvider with cdpEvmWalletActionProvider/CdpEvmWalletProvider and add pythActionProvider in index.ts
  • Persist wallet data as JSON via updated saveWalletData and getWalletData in index.ts
  • Reuse agents per userId, configure CDP v2 env vars (CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET), support IDEMPOTENCY_KEY and RPC_URL, and set NETWORK_ID default to base-sepolia in index.ts
  • Update environment variables and Node.js requirement to v22 in README.md and /.env.example
  • Bump @coinbase/agentkit to ^0.10.3 in package.json and refresh yarn.lock

📍Where to Start

Start with the initializeAgent function and action provider configuration in index.ts, then review the environment variable updates in README.md and /.env.example.


Macroscope summarized 7227cf9.

@humanagent
Copy link
Collaborator

nice @phdargen !

@humanagent humanagent merged commit 1dd88be into xmtplabs:main Oct 8, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants