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-mini-app: An example using mini app to access group members
- 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-domain-resolver: Resolve ens user tags in group messages
- xmtp-transactions: Allow transactions between users and agents
- xmtp-gaia: This example uses a Gaia API
- xmtp-smart-wallet: Agent that uses a smart wallet to send messages
- xmtp-attachments: Agent that sends and receives images
- xmtp-generalstore: 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
Visit miniapps to explore the latest agents and mini-apps.
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)# 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 devTo 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, productionUse this script to generate random XMTP keys:
yarn gen:keysWarning
Running the yarn 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
XMTP_FORCE_DEBUG_LEVEL=warn # debug, info, warn, errorThis will print additional information to the console.
Try out the examples using xmtp.chat, the official playground for agents.
# initialize the CLI
yarn debug
# connect to an agent
yarn debug --agent 0x81bddb3d7cd9ccdfaeb117ce19fd77c1433b907ddev 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
.envfile to use thelocalnetworkXMTP_ENV = local
See how to build and deploy your own production-grade agent with XMTP.
