How to Build an Agent with ElizaOS
This guide will walk you through building an agent using LAW (Lit Agent Wallet) and integrating it with the ElizaOS plugin.
For the most up-to-date and detailed instructions, always refer to the official ElizaOS Documentation.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js v23.3 (required for ElizaOS compatibility)
- pnpm (package manager)
- Git
Step 1: Download the ElizaOS Repository
Clone the ElizaOS repository to your local machine:
git clone https://github.com/elizaOS/eliza.git
cd eliza
Step 2: Install Dependencies
Install the dependencies using pnpm
. Since the project moves quickly, we recommend using the --no-frozen-lockfile
flag to avoid issues with outdated dependencies:
pnpm install --no-frozen-lockfile
Step 3: Add the litPlugin
to Your Agent
The litPlugin
is located in the ElizaOS repository under the develop
branch. You can find it here.
If the litPlugin
is not included in your current branch, follow these steps:
Option 1: Use the Latest Stable Release
If you're having issues with the main branch, check out the latest stable release:
git checkout $(git describe --tags --abbrev=0)
Option 2: Download the litPlugin
Manually
If the litPlugin
is not included in the stable release, download it manually from the develop branch and place it in the appropriate directory. You can then integrate it into your agent.
Once the litPlugin
is available, integrate it into your agent by editing the agent/src/index.ts
file. Simply add litPlugin
to the list of plugins:
import { litPlugin } from 'lit-agent-wallet';
// Other imports and configurations
const agent = new Agent({
plugins: [
// Other plugins
litPlugin, // Add litPlugin here
// Other plugins
],
});
// Start your agent
agent.start();
Step 5: Configure Your .env
File
For LAW integration, you'll need a private key in your .env
file. Ensure the private key starts with 0x
:
PRIVATE_KEY=0xYourPrivateKeyHere
Step 6: Run Your Agent
Once everything is set up, you can start your agent with a specific character configuration. For example, to run the agent with the "Trump" character:
pnpm start --character="characters/trump.character.json"
Additional Resources
- Lit Agent Wallet Repository:
- Lit Faucet:
- ElizaOS Documentation:
Troubleshooting
Issues Running the Agent
If you encounter issues running the agent:
- Ensure you're using Node.js v23.3.
- Verify that the
litPlugin
is correctly installed and configured. - Check the
.env
file to ensure the private key is formatted correctly (starts with0x
). - If the project has changed significantly, refer to the ElizaOS Quickstart Guide for the latest instructions.
Outdated Dependencies
If you encounter dependency issues, try cleaning and reinstalling the dependencies:
pnpm clean
pnpm install --no-frozen-lockfile
Conclusion
You've successfully built an agent with LAW and integrated it with ElizaOS! You can now extend your agent's functionality by adding more plugins or customizing its behavior.
For further reading, refer to the official documentation: