🚀 Now with the latest XMTP Agent SDK! These examples have been updated to use the newest version of the
agent-sdk
. Want to go back to legacy? try out the node-sdk branch.
These example agents serve as a starting point for building your own agents. They are built with the agent-sdk
and run on the XMTP network.
- xmtp-gm: A simple agent that replies to all text messages with "gm"
- xmtp-gpt: An example using GPT API's to answer messages
- xmtp-gated-group: Add members to a group based on arbitrary criteria
- xmtp-coinbase-agentkit: Agent that uses a CDP for gasless USDC on base
- xmtp-transactions: Allow transactions between users and agents
- xmtp-gaia: Agent that uses a CDP for gasless USDC on base
- xmtp-smart-wallet: Agent that uses a smart wallet to send messages
- xmtp-attachments: Agent that sends and receives images
- xmtp-inline-actions: An example using inline actions (dynamic buttons)
- xmtp-thinking-reaction: Agent that reacts to messages with a thinking emoji
- xmtp-queue-dual-client: Agent that uses two clients to send and receive messages
- xmtp-welcome-message: Agent that sends a welcome message when its added and to new members
See these Cursor rules for vibe coding with XMTP using best practices.
Prompt: lets create an example that gets a number and returns its 2x multiple (use claude max)
🎥 Watch Vibe coding agents with XMTP for a quickstart guide to building with these example agents.
# git clone repo
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
# go to the folder
cd xmtp-agent-examples
# install packages
yarn
# generate random xmtp keys (optional)
yarn gen:keys
# run the example
yarn dev
To run an example, you must create a .env
file with the following variables:
XMTP_WALLET_KEY= # the private key of the wallet
XMTP_DB_ENCRYPTION_KEY= # encryption key for the local database
XMTP_ENV=dev # local, dev, production
Use this script to generate random XMTP keys:
yarn gen:keys
Warning
Running the gen:keys
command will append keys to your existing .env
file.
You can revoke old installations by running:
# you can get your values from terminal logs
yarn revoke <inbox-id> <installations-to-exclude>
You can enable debug mode by adding the following to your .env
file:
XMTP_FORCE_DEBUG=true
This will print additional information to the console.
Try out the examples using xmtp.chat, the official playground for agents.
dev
and production
networks are hosted by XMTP, while you can run your own local
network.
-
Install Docker
-
Start the XMTP service and database
./dev/up
-
Change the
.env
file to use thelocal
networkXMTP_ENV = local
See how to build and deploy your own production-grade agent with XMTP.