Skip to content

goat-sdk/xmas-agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eliza GOAT XMAS Agent

Built with GOAT 🐐

This fork is a simplified example of Eliza focused on executing transactions onchain on Mode using GOAT.

Onchain actions:

  • Mint NFTs
  • Check the latest trending tokens
  • Purchase, trade them, and much more.

Tech stack:

  • Eliza - The AI agent framework
  • GOAT - The open-source framework for connecting AI agents to any onchain app

Support

Running the project

Requirements

  • Node.js 23.3.0+

Set up

  1. Clone the repository
git clone https://github.com/goat-sdk/xmas-agent.git
  1. Go into the project directory
cd xmas-agent
  1. Install the dependencies
pnpm install
  1. Run pnpm build

  2. Copy the .env.example file to .env:

cp .env.example .env
  1. Get an OpenAI API key and fill in the OPENAI_API_KEY in the .env file

Giving the agent a wallet

  1. This example uses a key pair wallet. Save the key and fill in the following in the .env file:
    • EVM_PRIVATE_KEY=
    • `EVM_PROVIDER_URL=

Running the agent

  1. You can now run the agent with the command pnpm start --character="characters/xmas-goat.character.json"
  2. In a different terminal run pnpm start:client to start the chat interface
  3. Go to http://localhost:5173 to chat with your agent

Configuring the project

The character

  • You can see the definition of your character in the characters/xmas-goat.character.json file.
  • This project gives you a simple example character to get you started. This allows you to easily add onchain actions and test them out while increasing the complexity of your agent step by step. Keep adding and modifying the bio and tone of the character to make it your own.

Eliza

  • This is an Eliza fork so you can do pretty much everything you can do with Eliza. Check out the Eliza docs for more information on how to integrate your agent with Twitter, Discord, etc.

Onchain actions with GOAT

  • The GOAT plugin (packages/plugin-goat) uses GOAT to add all onchain functionality to the agent. Within the actions.ts file of the plugin you can add any GOAT plugins you need or even create your own. Check out the GOAT docs for more information.
export async function getOnChainActions(wallet: WalletClientBase) {
    const actionsWithoutHandler = [
        {
            name: "SEND_ETH",
            description: "Send ETH to a given address",
            similes: [],
            validate: async () => true,
            examples: [],
        },
        {
            name: "SEND_USDC",
            description: "Send USDC to a given address",
            similes: [],
            validate: async () => true,
            examples: [],
        },
        {
            name: "GET_USDC_BALANCE",
            description: "Get the balance of USDC in the wallet",
            similes: [],
            validate: async () => true,
            examples: [],
        },
        // 1. Add your actions here
    ];

    const tools = await getOnChainTools({
        wallet: wallet,
        // 2. Configure the plugins you need to perform those actions
        plugins: [sendETH(), erc20({ tokens: [USDC] })],
    });

    // 3. Let GOAT handle all the actions
    return actionsWithoutHandler.map((action) => ({
        ...action,
        handler: getActionHandler(action.name, action.description, tools),
    }));
}

Tips for troubleshooting

  1. When making changes to any package (e.g the Crossmint plugin), remember to run pnpm build to update the project.
  2. To see why the agent is making a certain decision, add console logs to see the prompts and responses that it is getting on every interaction. For example. if you are using the direct client that would be here.
  3. You can also copy the agent prompts that you log and play with them in ChatGPT to see how you could improve them.

About

Conversational Agent for Twitter and Discord

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.3%
  • PLpgSQL 2.6%
  • JavaScript 1.6%
  • Shell 1.1%
  • CSS 0.3%
  • Dockerfile 0.1%