Build unstoppable ZerePy agents
In the tutorial, we describe how to use ZerePy framework with EternalAI API (instead of OpenAI API).
Prerequisites
Python 3.10 or higher
Poetry 1.5 or higher
Step 1: Create an on-chain ZerePy Agent
EternalAI allows creating on-chain Agent on +10 blockchains.
In this guide, we create a new on-chain ZerePy agent on Base.
First, we need to compile a system prompt, save it to a file and then run the following commands:
git clone https://github.com/eternalai-org/eternal-ai.git
cd eternal-ai/developer-guides/examples/how-to-mint-agent
npm i
export RPC_URL=https://mainnet.base.org PRIVATE_KEY=<PRIVATE_KEY> AGENT_SYSTEM_PROMPT=<PATH_TO_YOUR_SYSTEM_PROMPT> AGENT_FEE=0
ts-node ./mintAgent.tsNote: replace PRIVATE_KEYand AGENT_SYSTEM_PROMPTto your private key (that has some ETH on Base) and path to system prompt file created above respectively.
We've run the commands above and created an on-chain agent (id: 1711) as shown in the follwing transaction:

Step 2: Clone ZerePy repository
Step 3: Install dependencies
Go to the zerepy directory and install dependencies.
This will create a virtual environment and install all required dependencies.
Step 4: Activate the virtual environment
Step 5: Update agent configuration
Edit agents/eternalai-example.json file to tell ZerePy framework to use the agent 1711's system prompt which we've created in step 1 (instead of the default system prompt defined in the file)
For this tutorial, we'll use Base chain and Hermes 3 70B model, so we need to update configurations as follows:
Step 6: Run application
You will see the following output in your terminal.
Step 7: Load the agent
In the previous step, the ExampleAgentis loaded by default, we will need to load eternalai-example agent for using with EternalAI API.
First, list all available agents.
You will see the following agents in your terminal.
Next, load the eternalai-example agent.
Step 8: Configure EternalAI connection
Follow the EternalAI API setup guide to obtain API key and API url then enter them into prompts to set up environment variables (which will be stored in .env file).
Once the EternalAI connection is successfully configured, you should see the following output in your terminal.
Step 9: Configure Twitter connection
Follow the Twitter authentication setup guide to obtain API Key (consumer key) and API Key Secret (consumer secret) then enter them into prompts to sett up environment variables (which will be stored in .env file).
Step 10: Update Twitter Username
Add TWITTER_USERNAME environment variable to the .env file. (You need to exit the current process prior to adding)
Step 11: Run run application
Agent 1711 should tweet based on its system prompt defined on-chain.
Step 12: Verify the onchain prompt transaction
With Eternal AI's Decentralized Inference, everything is onchain verifiable.
Let's look at an onchain prompt transaction on BaseScan. You can verify that this prompt runs on Hermes 3 70B and see the prompt content.

Step 13: Verify the onchain response transaction
Now, let's look at the onchain response tx on BaseScan. You can see the actual response content. Everything is onchain and verifiable.

Step 14 (Advanced): Reproduce the response
Here is a detailed guide for verifying the response by code and reproducing it yourself.
More agents will live among us, so we think it's important to build onchain-verifiable AI agents.
As with anything in crypto — "Don't trust the AI, verify it."
Step 15 (Advanced): Read the whitepaper
If you want to understand how Eternal AI's Decentralized Inference works, you can read the "AI-powered Base" whitepaper.

Congrats!
Congrats! You've finished building your Rig agent with two superpowers: - Onchain verifiable on Base - Powered by Hermes 3 70B
Questions? Join the Eternal AI Devs group on Telegram: https://t.me/EternalAIDevs.
Last updated