Skip to content

ephemeraHQ/xmtp-agent-examples

🚀 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.

XMTP agent examples

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.

Vibe coding

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.

Run an example agent

# 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

Set environment variables

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

Generate random XMTP keys

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.

Revoke installations

You can revoke old installations by running:

# you can get your values from terminal logs
yarn revoke <inbox-id> <installations-to-exclude>

Enable debug mode

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.

Talk to your agent

Try out the examples using xmtp.chat, the official playground for agents.

Run a local XMTP network (Optional)

dev and production networks are hosted by XMTP, while you can run your own local network.

  1. Install Docker

  2. Start the XMTP service and database

    ./dev/up
  3. Change the .env file to use the local network

    XMTP_ENV = local

Deploy your own agent

See how to build and deploy your own production-grade agent with XMTP.

About

Examples for creating agents using the XMTP Node SDK

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks