2. ElizaOS and AI Agent Frameworks

Now that you know the basics of interacting with VeChainThor, let's look at how to make the SDK a resource for our first AI Agent on-chain. For this tutorial we’ll be using ElizaOS framework, but you will be able to use your VeChain knowledge to apply it on any other agentic model.

2.1 What is ElizaOS?

ElizaOS is an open-source framework that makes it easy to build AI agents with persistent personalities. Think of it as an operating system for your AI. 

We chose it for this tutorial because it's widely used in Web3 and makes it straightforward to integrate blockchain tools like VeChain into your agent. 

The framework's plugin architecture means you can add VeChain functionality without modifying core code - you simply register your blockchain actions and they become part of your agent's capabilities. 

If you want to learn more about ElizaOS check out the official documentation for detailed guides.

2.2 Installing ElizaOS

ElizaOS uses Bun (a fast JavaScript runtime) instead of Node.js.
As mentioned in Prerequisites, first, install Bun if you don't have it:

Once you have Node.js and Bun installed, you can install the ElizaOS CLI globally:

bun i -g @elizaos/cli

After installation, verify that elizaOS CLI is properly installed:

elizaos --version

2.3 Creating Your First Agent

We'll use the veAgentX starter template which already has VeChain tools configured:

git clone https://github.com/alexlofe/veAgentX.git 
cd veAgentX

In your root directory, install all the dependencies using

npm install

This command will install all the necessary ElizaOS plugins and the VeChain SDK libraries you learned about in the introductory section.

2.4 Configuring Your Agent

Edit the .env file to configure your agent:

# AI Model Configuration
OPENAI_API_KEY=your_openai_key_here
OPENAI_SMALL_MODEL=gpt-4o-mini
OPENAI_LARGE_MODEL=gpt-4o-mini

DATABASE_URL=./data/agent.db

# VeChain Configuration
VECHAIN_NODE_URL=https://mainnet.vechain.org

2.5 Running Your Agent

Start your agent with:

bun run dev

This will:

  1. Load your character file

  2. Connect to your chosen AI model

  3. Initialize the database for memory

  4. Start the web interface at http://localhost:3000