I think we're going to live in a world where there are going to be hundreds of millions or billions of different AI agents. Eventually, probably, more AI agents than there are people in the world.
— Mark Zuckerberg
In recent months, AI agents seem to have struck a deep resonance with the ethos of web3. The crypto community has gone bonkers over innovative agents like aixbt, Clanker, El1za, Freysa AI, Botto, and countless others emerging daily. Platforms like Virtuals Protocol, Truth Terminal, and so on are opening doors to possibilities we've barely begun to imagine.
But what exactly are these onchain AI agents?
AI agents in crypto are autonomous, AI-powered systems designed to perform specific tasks within the blockchain ecosystem. These agents use LLMs and other ML models to analyze data, make decisions, and execute actions with minimal or no human intervention.
How are crypto AI Agents different from bots?
It's easy to confuse crypto AI agents with bots – after all, both automate tasks and help users. But the difference is fundamental. Bots are deterministic, meaning they follow strict rules and scripts. Think of a trading bot that blindly buys when a token drops below $10, regardless of market conditions. No learning, no adapting – just following preset instructions. AI agents, on the other hand, are probabilistic. They don't just follow rules – they learn from data, spot patterns, and adapt their strategies. When market conditions change, they adjust. When new trends emerge, they notice. This ability to learn and evolve makes them more intelligent assistants than simple automation tools.
What makes up the core architecture of Onchain AI Agents?
There are three main components in an AI agent's architecture:
Data Input Layer: The data input layer forms the foundation of any AI agent - it's where all the magic begins. To gather blockchain data, agents connect directly to nodes or use web3 libraries like Viem, ethers.js, or web3.js. This gives them access to everything happening onchain - from real-time transactions to smart contract states. But blockchain data alone isn't enough. That's where oracles come in. By integrating with services like Chainlink, agents can pull in off-chain data such as market prices, social media sentiment, and other real-world information, giving them a complete view of both onchain and off-chain landscapes.
AI / ML Layer: The AI/ML layer uses LSTM networks for pattern spotting, Random Forests for predictions, and reinforcement learning for strategy optimization. These models train on historical data through backpropagation and Q-learning, while LLM wrappers (OpenAI's GPT or Anthropic's Claude) add market sentiment analysis and complex reasoning capabilities.
Blockchain Interaction Layer: Agents interact with Ethereum Virtual Machine (EVM) compatible smart contracts through ABI (Application Binary Interface). The use of libraries for transaction signing, gas estimation, and nonce management to ensure transactions are executed correctly on the blockchain, enabling the AI agent to take actions on behalf of the user on the blockchain.
How Onchain AI Agents work?
AI agents have three key parts that make them tick - Assistant, Thread, and Run.
Think of the Assistant as the brain, complete with its own personality and special functions to handle blockchain tasks.
The Thread is where conversations live. When you ask your agent to mint an NFT or deploy a contract or send a transaction over to the Blockchain, the thread understands what needs to be done and kicks off the action.
The Run is where it all comes together - your agent executes the blockchain tasks, monitors the progress, and sends back updates.
These three components work together, turning blockchain interactions into simple conversations.
That's it! If you've followed me through this entire guide, it's now your turn to go out and build your own AI Agents.
The repository has some cool tools ready for you to test out. Feel free to try them and contribute if you create something interesting.
Always be shilling — Make sure you share this post on Twitter/X, and contribute to the repo if you create something cool.
Go share it with your friends — who knows, it might help them create their first AI agent!
This piece was hugely inspired by the "Build Your Own Onchain AI Agent!" video by Jarrod Watts.
Feel free to reach out to me on Twitter or GitHub if you need help or want to contribute!