This guide will help you set up and run your own agent, either Optimus or BabyDegen. Follow the steps below to get started.
- Get the Code
- Set Up the Virtual Environment
- Synchronize Packages
- Prepare the Data
- Configure for Optimus
- Configure for BabyDegen
- Run the Agent
Clone the repository from GitHub:
git clone https://github.com/valory-xyz/optimus.git
Navigate to the project directory and install the required dependencies using poetry
:
cd optimus
poetry install
poetry shell
Synchronize the necessary packages:
autonomy packages sync --update-packages
Create a keys.json
file containing wallet addresses and private keys for four agents:
autonomy generate-key ethereum -n 1
Extract one of the private keys from keys.json
and save it in a file named ethereum_private_key.txt
. Ensure there's no newline at the end of the file.
If you want to run the Optimus agent, follow these steps:
Deploy Safe contracts on the following networks:
- Ethereum Mainnet
- Optimism
- Base
- Safe Addresses:
- Deposit ETH and USDC into your Safe address on Ethereum Mainnet.
- Agent Addresses:
- Deposit ETH into your agent addresses on all networks (Ethereum Mainnet, Optimism, Base) to cover gas fees.
- Tenderly:
- Access Key
- Account Slug
- Project Slug
- Get them from your Tenderly Dashboard under Settings.
- CoinGecko:
- API Key
- Obtain it from your account's Developer Dashboard.
Instead of exporting environment variables, create a .env
file in your project directory and add the following configurations. Replace placeholder values with your actual data:
PYTHONWARNINGS="ignore"
ALL_PARTICIPANTS=["YOUR_AGENT_ADDRESS"]
SAFE_CONTRACT_ADDRESSES='{
"ethereum": "YOUR_SAFE_ADDRESS_ON_ETHEREUM",
"optimism": "YOUR_SAFE_ADDRESS_ON_OPTIMISM",
"base": "YOUR_SAFE_ADDRESS_ON_BASE"
}'
ETHEREUM_LEDGER_RPC=YOUR_ETHEREUM_RPC_URL
OPTIMISM_LEDGER_RPC=YOUR_OPTIMISM_RPC_URL
BASE_LEDGER_RPC=YOUR_BASE_RPC_URL
MODE_LEDGER_RPC=
SLIPPAGE_FOR_SWAP=0.09
TENDERLY_ACCESS_KEY=YOUR_TENDERLY_ACCESS_KEY
TENDERLY_ACCOUNT_SLUG=YOUR_TENDERLY_ACCOUNT_SLUG
TENDERLY_PROJECT_SLUG=YOUR_TENDERLY_PROJECT_SLUG
COINGECKO_API_KEY=YOUR_COINGECKO_API_KEY
ALLOWED_CHAINS=["optimism","base"]
If you prefer to run the BabyDegen agent, follow these additional steps:
Set the AGENT_TRANSITION
flag to true
in your .env
file:
AGENT_TRANSITION=true
Replace placeholders with your actual Safe address and agent address:
SAFE_ADDRESS="YOUR_SAFE_ADDRESS"
ALL_PARTICIPANTS=["YOUR_AGENT_ADDRESS"]
Deposit the following tokens into your Safe account, depending on the network:
LEDGER_TO_TOKEN_LIST = {
SupportedLedgers.ETHEREUM: [
"0x0001a500a6b18995b03f44bb040a5ffc28e45cb0", # Token A on Ethereum
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", # USDC on Ethereum
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH on Ethereum
],
SupportedLedgers.OPTIMISM: [
"0x4200000000000000000000000000000000000006", # WETH on Optimism
"0x0b2c639c533813f4aa9d7837caf62653d097ff85", # Token B on Optimism
"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1", # DAI on Optimism
],
SupportedLedgers.BASE: [
"0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca", # Token C on Base
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # Token D on Base
],
}
Ensure your agent address has enough native tokens to cover gas fees on your chosen network.
After completing the setup for either Optimus or BabyDegen, run the agent using the provided script:
bash run_agent.sh