Skip to content

xmtplabs/xmtp-agent-examples

Repository files navigation

XMTP agent examples

A collection of examples for building XMTP agents using the @xmtp/agent-sdk.

Examples

Runnable example agents that demonstrate specific capabilities:

Example Description
xmtp-gm Simple agent that replies "gm"
xmtp-gpt GPT-powered responses
xmtp-gated-group Group gating with passphrase
xmtp-domain-resolver ENS and Farcaster resolution
xmtp-transactions USDC transactions
xmtp-smart-wallet Smart wallet usage
xmtp-attachments File attachments with Pinata
xmtp-generalstore Shopping cart with inline actions
xmtp-thinking-reaction Thinking emoji pattern
xmtp-queue-dual-client Dual client architecture
xmtp-welcome-message Welcome messages with buttons

Quick start

Run an example

# Clone the repo
git clone https://github.com/xmtplabs/xmtp-agent-examples.git
cd xmtp-agent-examples

# Install packages
yarn

# Generate random XMTP keys
yarn gen:keys

# Run an example
cd examples/xmtp-gm
yarn dev

Environment variables

Create a .env file with:

XMTP_WALLET_KEY=      # Private key for the wallet
XMTP_DB_ENCRYPTION_KEY= # Encryption key for local database
XMTP_ENV=dev          # local, dev, or production

Generate keys

yarn gen:keys

Warning: Running yarn gen:keys will append keys to your existing .env file.

Development

Vibe coding

See the skills directory for AI-assisted development patterns.

Prompt: Create an agent that multiplies numbers by 2

Debug mode

XMTP_FORCE_DEBUG=true
XMTP_FORCE_DEBUG_LEVEL=debug # debug, info, warn, error

Talk to your agent

Test using xmtp.chat, the official playground for agents.

CLI debugging

yarn debug
yarn debug --agent 0x81bddb3d7cd9ccdfaeb117ce19fd77c1433b907d

Local XMTP network

# Start local network
./dev/up

# Update .env
XMTP_ENV=local

# Stop
./dev/down

Revoke installations

yarn revoke <inbox-id> <installations-to-exclude>

Deploy

See Deploy your own agent for production deployment guides.

Community examples

Example Description
xmtp-gaia Gaia AI integration
xmtp-groq Groq AI integration

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT

About

Examples for creating agents using xmtp

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Used by

Contributors

Languages