A DeFi agent built using Langchain and powered by CDP SDK, operating over the XMTP messaging protocol.
- Node.js (v20+)
- OpenAI API key
- Coinbase Developer Platform (CDP) API credentials
- USDC Faucet
To run your XMTP agent, you must create a .env
file with the following variables:
WALLET_KEY= # the private key for the wallet
ENCRYPTION_KEY= # the encryption key for the wallet
# public key is
NETWORK_ID=base-sepolia # base-mainnet or others
OPENAI_API_KEY= # the OpenAI API key
CDP_API_KEY_NAME= # the name of the CDP API key
CDP_API_KEY_PRIVATE_KEY= # the private key for the CDP API key
XMTP_ENV=local # local, dev, production
You can generate random xmtp keys with the following command:
yarn gen:keys <name>
Warning
Running the gen:keys
or gen:keys <name>
command will append keys to your existing .env
file.
Example prompts:
- "Send 0.01 USDC to 0x1234..."
- "Check my wallet balance"
# git clone repo
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
# go to the folder
cd xmtp-agent-examples
cd examples/coinbase-langchain
# install packages
yarn
# generate random xmtp keys (optional)
yarn gen:keys
# run the example
yarn dev