Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

GPT agent example

This example uses the OpenAI API for GPT-based responses and XMTP for secure messaging. You can test your agent on xmtp.chat or any other XMTP-compatible client.

Environment variables

To run your XMTP agent, you must create a .env file with the following variables:

WALLET_KEY= # the private key of the wallet
ENCRYPTION_KEY= # encryption key for the local database
OPENAI_API_KEY= # the API key for the OpenAI API
XMTP_ENV= # 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.

Run the agent

# git clone repo
git clone https://github.com/ephemeraHQ/xmtp-agent-examples.git
# go to the folder
cd xmtp-agent-examples
cd examples
cd gpt
# install packages
yarn
# generate random xmtp keys (optional)
yarn gen:keys
# run the example
yarn dev