← Back to Home
ElizaOS2026-02-01

How to Build Your First AI Agent with ElizaOS

A step-by-step beginner's guide to creating your first autonomous AI agent using the ElizaOS framework. Learn the fundamentals and get your agent running in minutes.

Perky News Team

Perky News Team

How to Build Your First AI Agent with ElizaOS

How to Build Your First AI Agent with ElizaOS

Ready to build your first AI agent? This beginner-friendly guide will walk you through creating an autonomous agent using ElizaOS, the open-source framework that's taking the Web3 world by storm. By the end of this tutorial, you'll have a working AI agent that can hold conversations, remember context, and be extended with powerful plugins.

Prerequisites

Before we begin, make sure you have:

  • Node.js 18+ installed on your computer
  • Git for cloning the repository
  • A code editor like VS Code
  • An OpenAI API key (or another supported LLM provider)
  • Basic familiarity with JavaScript/TypeScript

Don't worry if you're not an expert programmer—ElizaOS is designed to be accessible to developers of all skill levels.

Step 1: Clone the Repository

First, let's get the ElizaOS code on your machine. Open your terminal and run:

git clone https://github.com/elizaOS/eliza.git
cd eliza

This downloads the entire ElizaOS framework, including examples and documentation.

Step 2: Install Dependencies

ElizaOS uses pnpm as its package manager for faster, more efficient installations:

npm install -g pnpm
pnpm install

This will install all the required packages. The process might take a few minutes depending on your internet connection.

Step 3: Configure Your Environment

Create a .env file in the root directory to store your API keys and configuration:

cp .env.example .env

Now open the .env file and add your LLM provider credentials:

OPENAI_API_KEY=your-openai-key-here

Or use another provider:

ANTHROPIC_API_KEY=your-anthropic-key

Step 4: Create Your Agent's Character

This is where ElizaOS gets fun! You'll define your agent's personality, knowledge, and behavior through a character file. Create a new file called my-first-agent.json in the characters folder:

{
  "name": "Atlas",
  "description": "A friendly and knowledgeable AI assistant specializing in blockchain technology and cryptocurrency markets.",
  "personality": [
    "helpful and patient with beginners",
    "enthusiastic about Web3 technology",
    "explains complex concepts in simple terms",
    "occasionally uses crypto slang like 'WAGMI'"
  ],
  "knowledge": [
    "blockchain fundamentals",
    "DeFi protocols and concepts",
    "NFT ecosystems",
    "market analysis basics"
  ],
  "style": {
    "tone": "friendly and approachable",
    "formality": "casual but informative"
  }
}

Feel free to customize this character to match your vision! Give it a unique name, personality traits, and areas of expertise.

Step 5: Run Your Agent

Now for the exciting part—bringing your agent to life! Run the following command:

pnpm start --characters=characters/my-first-agent.json

If everything is configured correctly, you'll see your agent boot up in the terminal. You can now interact with it through the command line interface!

Understanding the Core Concepts

The Runtime

ElizaOS uses a "runtime" system that manages your agent's lifecycle. The runtime handles:

  • Processing incoming messages
  • Generating responses using the LLM
  • Managing memory and context
  • Executing plugins and actions

Memory System

One of ElizaOS's most powerful features is its memory system. Your agent doesn't just respond to messages—it remembers:

  • Conversation history: Past messages and their context
  • User information: Details about people it interacts with
  • Learned facts: New information acquired through conversations

This persistence makes your agent feel more intelligent and personalized over time.

Actions and Plugins

Actions are specific tasks your agent can perform, while plugins bundle related actions together. For example, a Twitter plugin might include actions for:

  • Posting tweets
  • Replying to mentions
  • Following users
  • Searching for topics

Adding Your First Plugin

Let's extend your agent with a simple plugin. ElizaOS comes with several built-in plugins. To enable the Twitter integration, update your character file:

{
  "name": "Atlas",
  "plugins": ["@eliza/plugin-twitter"],
  "settings": {
    "twitter": {
      "username": "your-twitter-handle"
    }
  }
}

Then add your Twitter credentials to the .env file:

TWITTER_USERNAME=your-handle
TWITTER_PASSWORD=your-password
TWITTER_EMAIL=your-email

Now your agent can post tweets, respond to mentions, and engage with your audience automatically!

Connecting to Telegram

Want your agent to live in a Telegram chat? It's straightforward:

  1. Create a bot via @BotFather on Telegram
  2. Copy the bot token
  3. Add to your .env file:
TELEGRAM_BOT_TOKEN=your-bot-token
  1. Enable the Telegram plugin in your character file:
{
  "plugins": ["@eliza/plugin-telegram"]
}

Best Practices for Beginners

Start Simple

Don't try to build everything at once. Start with a basic conversational agent, then gradually add plugins and complexity.

Test Thoroughly

Before deploying your agent publicly, test it extensively. Try different conversation scenarios, edge cases, and potential misuses.

Monitor and Iterate

Once your agent is live, monitor its interactions. Look for:

  • Responses that don't match your intended personality
  • Questions it struggles to answer
  • Opportunities to improve its knowledge base

Keep Secrets Secret

Never commit API keys or passwords to version control. Always use environment variables and .gitignore files.

Troubleshooting Common Issues

Agent won't start?
  • Check that your API keys are correctly configured
  • Ensure all dependencies are installed (pnpm install)
  • Verify your character JSON is valid
Responses are generic or wrong?
  • Improve your character's personality descriptions
  • Add more specific knowledge areas
  • Consider using a more capable LLM model
Plugin not working?
  • Verify credentials are set in .env
  • Check the plugin documentation for required settings
  • Look at the console logs for error messages

What's Next?

Congratulations! You've built your first AI agent with ElizaOS. From here, you can:

  1. Explore more plugins: Trading, NFTs, on-chain actions
  2. Customize the personality: Make your agent unique
  3. Connect multiple platforms: Discord, Twitter, Telegram simultaneously
  4. Contribute to ElizaOS: The community welcomes contributions!

Conclusion

Building an AI agent with ElizaOS is more accessible than ever. With its intuitive character system, powerful plugin architecture, and comprehensive documentation, you can go from zero to a working agent in under an hour.

The Web3 ecosystem is hungry for intelligent automation, and you now have the tools to deliver it. Whether you're building a trading assistant, a community manager, or something entirely new, ElizaOS provides the foundation for your AI-powered future.


Ready to dive deeper? Check out the ElizaOS documentation for advanced tutorials, plugin development guides, and community resources.
#elizaos#tutorial#ai-agents#development#web3#beginner