Autonomous agent for managing virtual pets on Pett.ai, built with Olas SDK compliance.
The Pett Agent is an autonomous agent service that manages virtual pets through the Pett.ai platform. It connects via WebSocket, monitors pet stats, and performs actions to keep pets healthy and happy.
- Docker installed and running
- Docker Hub account (for pushing images)
- Ethereum private key for the agent wallet
- Required API tokens and credentials (see Configuration section)
Navigate to the olas-sdk-starter directory and build the Docker image:
cd olas-sdk-starter
docker build -t pettaidev/oar-pett_agent:bafybeifb4opp4ej2f7msst54exbhh5egv5w2nmipgb5ul5t3a4jwtfec6m .docker push pettaidev/oar-pett_agent:bafybeifb4opp4ej2f7msst54exbhh5egv5w2nmipgb5ul5t3a4jwtfec6mdocker run -d \
--name pett_agent \
-p 8716:8716 \
-e ETH_PRIVATE_KEY="your_ethereum_private_key_here" \
-e PRIVY_TOKEN="your_privy_token" \
-e TELEGRAM_BOT_TOKEN="your_telegram_bot_token" \
-e WEBSOCKET_URL="wss://ws.pett.ai" \
-e OPENAI_API_KEY="your_openai_api_key" \
-e SAFE_CONTRACT_ADDRESSES="your_safe_addresses" \
-v $(pwd)/data:/data \
pettaidev/oar-pett_agent:bafybeifb4opp4ej2f7msst54exbhh5egv5w2nmipgb5ul5t3a4jwtfec6mCreate a file ethereum_private_key.txt in the olas-sdk-starter directory with your private key:
# Create the private key file
echo "your_ethereum_private_key_here" > olas-sdk-starter/ethereum_private_key.txt
# Run the container
docker run -d \
--name pett_agent \
-p 8716:8716 \
-v $(pwd)/olas-sdk-starter/ethereum_private_key.txt:/app/ethereum_private_key.txt \
-v $(pwd)/olas-sdk-starter/data:/data \
-e PRIVY_TOKEN="your_privy_token" \
-e TELEGRAM_BOT_TOKEN="your_telegram_bot_token" \
-e WEBSOCKET_URL="wss://ws.pett.ai" \
-e OPENAI_API_KEY="your_openai_api_key" \
-e SAFE_CONTRACT_ADDRESSES="your_safe_addresses" \
pettaidev/oar-pett_agent:bafybeifb4opp4ej2f7msst54exbhh5egv5w2nmipgb5ul5t3a4jwtfec6mCreate a docker-compose.yml file:
version: '3.8'
services:
pett_agent:
image: pettaidev/oar-pett_agent:bafybeifb4opp4ej2f7msst54exbhh5egv5w2nmipgb5ul5t3a4jwtfec6m
container_name: pett_agent
ports:
- '8716:8716'
environment:
- ETH_PRIVATE_KEY=${ETH_PRIVATE_KEY}
- PRIVY_TOKEN=${PRIVY_TOKEN}
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
- WEBSOCKET_URL=${WEBSOCKET_URL:-wss://ws.pett.ai}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- SAFE_CONTRACT_ADDRESSES=${SAFE_CONTRACT_ADDRESSES}
volumes:
- ./data:/data
- ./ethereum_private_key.txt:/app/ethereum_private_key.txt
restart: unless-stoppedThen run:
docker-compose up -d| Variable | Description | Required |
|---|---|---|
ETH_PRIVATE_KEY |
Ethereum private key for the agent wallet | Yes |
PRIVY_TOKEN |
Privy authentication token | Yes |
TELEGRAM_BOT_TOKEN |
Telegram bot token (if using Telegram features) | Optional |
WEBSOCKET_URL |
WebSocket URL for Pett.ai connection | No (defaults to wss://ws.pett.ai) |
OPENAI_API_KEY |
OpenAI API key for AI features | Optional |
SAFE_CONTRACT_ADDRESSES |
Safe contract addresses | Optional |
The agent supports multiple methods for providing the Ethereum private key:
- Environment Variable:
ETH_PRIVATE_KEYorCONNECTION_CONFIGS_CONFIG_ETH_PRIVATE_KEY - File:
./ethereum_private_key.txt(in the container's working directory) - File:
../agent_key/ethereum_private_key.txt(relative to working directory)
The private key can be:
- Plain text hex string (with or without
0xprefix) - Encrypted keystore (requires
--passwordflag when running)
Once the agent is running, you can access:
- Health Check: http://localhost:8716/healthcheck
- Agent UI: http://localhost:8716/
The agent exposes port 8716 for health checks and the web UI, as required by the Olas SDK.
# View logs
docker logs pett_agent
# Follow logs in real-time
docker logs -f pett_agentdocker ps | grep pett_agentdocker stop pett_agentdocker rm pett_agent- Install Python 3.11+ and dependencies:
cd olas-sdk-starter
pip install -r requirements.txt- Set up environment variables (create a
.envfile or export them):
export ETH_PRIVATE_KEY="your_key"
export PRIVY_TOKEN="your_token"
# ... other variables- Run the agent:
python run.pyThe frontend is built during the Docker build process. If you need to rebuild it manually:
cd olas-sdk-starter/frontend
yarn install
yarn buildThis agent follows the Olas SDK requirements:
- ✅ Health check endpoint at
/healthcheckon port8716 - ✅ Proper logging format:
[YYYY-MM-DD HH:MM:SS,mmm] [LOG_LEVEL] [agent] message - ✅ Docker image naming:
<author>/oar-<agent_name>:<package_hash> - ✅ Entrypoint:
python run.py - ✅ Environment variable support for configuration
- Check that the Ethereum private key is correctly configured
- Verify all required environment variables are set
- Check Docker logs:
docker logs pett_agent
- Verify
WEBSOCKET_URLis correct - Check network connectivity
- Ensure
PRIVY_TOKENis valid
- Verify port
8716is not blocked - Check container logs for errors
- Ensure the agent process is running inside the container
For issues related to:
- Olas SDK: See Olas SDK Documentation
- Pett.ai Platform: Contact Pett.ai support
- Agent Issues: Check the logs and GitHub issues
See the LICENSE file in the olas-sdk-starter directory for details.