Spaces:
Sleeping
Sleeping
Update README: add agent incentives, auto-deploy, API endpoints
Browse files
README.md
CHANGED
|
@@ -9,79 +9,83 @@ short_description: LLM-powered agents compete in an automated DeFi market
|
|
| 9 |
|
| 10 |
# Agent Arena
|
| 11 |
|
| 12 |
-
Multi-agent LLM simulation in DeFi markets with emergent strategic
|
| 13 |
|
| 14 |
## Overview
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## Features
|
| 19 |
|
| 20 |
- AI agents powered by MiniMax-M2.1 with reasoning transparency
|
| 21 |
- Constant product AMM pool mechanics (like Uniswap)
|
| 22 |
-
- Real-time metrics
|
| 23 |
- Strategic decision making with thinking traces
|
| 24 |
- Persistent storage with Supabase
|
|
|
|
| 25 |
|
| 26 |
## Architecture
|
| 27 |
|
| 28 |
```
|
| 29 |
defi-agents/
|
| 30 |
βββ api/ # API clients (MiniMax, Supabase)
|
| 31 |
-
βββ core/ # Core simulation (Agent, Pool, Simulation,
|
| 32 |
βββ web/ # FastAPI backend
|
| 33 |
βββ frontend/ # React dashboard (Vite + Tailwind)
|
| 34 |
-
βββ
|
| 35 |
-
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
-
##
|
| 39 |
-
|
| 40 |
-
### Prerequisites
|
| 41 |
|
| 42 |
-
|
| 43 |
-
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
##
|
| 48 |
|
| 49 |
-
|
| 50 |
-
# Clone the repository
|
| 51 |
-
git clone https://github.com/nice-bills/agent-arena.git
|
| 52 |
-
cd agent-arena
|
| 53 |
|
| 54 |
-
|
| 55 |
-
uv sync
|
| 56 |
|
| 57 |
-
|
| 58 |
-
cp .env.example .env
|
| 59 |
-
# Edit .env with your API keys
|
| 60 |
-
```
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
-
# Start the backend
|
| 66 |
-
uv run python web/app.py
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
```
|
| 73 |
|
| 74 |
-
## API Endpoints
|
| 75 |
-
|
| 76 |
-
| Method | Endpoint | Description |
|
| 77 |
-
|--------|----------|-------------|
|
| 78 |
-
| GET | /health | Health check |
|
| 79 |
-
| POST | /api/runs | Start a new simulation run |
|
| 80 |
-
| GET | /api/runs | List all runs |
|
| 81 |
-
| GET | /api/runs/{id} | Get run details |
|
| 82 |
-
| GET | /api/analysis/trends | Get trend analysis |
|
| 83 |
-
| GET | /api/thinking/{action_id} | Get thinking trace |
|
| 84 |
-
|
| 85 |
## Environment Variables
|
| 86 |
|
| 87 |
| Variable | Description |
|
|
@@ -89,8 +93,26 @@ npm run dev
|
|
| 89 |
| MINIMAX_API_KEY | MiniMax API key |
|
| 90 |
| SUPABASE_URL | Supabase project URL |
|
| 91 |
| SUPABASE_KEY | Supabase anon key |
|
| 92 |
-
|
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
## License
|
| 96 |
|
|
|
|
| 9 |
|
| 10 |
# Agent Arena
|
| 11 |
|
| 12 |
+
Multi-agent LLM simulation in DeFi markets with emergent strategic behaviors.
|
| 13 |
|
| 14 |
## Overview
|
| 15 |
|
| 16 |
+
AI agents powered by MiniMax-M2.1 compete in an automated DeFi market. Agents trade, provide liquidity, form alliances, and their behaviors evolve. New incentive mechanics force action to prevent stagnation.
|
| 17 |
+
|
| 18 |
+
## What's New
|
| 19 |
+
|
| 20 |
+
### Agent Incentives (v1.1)
|
| 21 |
+
|
| 22 |
+
- **Boredom Penalty**: Agents lose 10 tokens after 1+ consecutive do_nothing actions
|
| 23 |
+
- **Alliance Bonuses**: Mutual alliance proposals grant +15 tokens to both agents
|
| 24 |
+
- **Market Maker**: Creates volatility every 3 turns with 15% trades
|
| 25 |
+
- **Price Shocks**: Random +/-10% price events create trading opportunities
|
| 26 |
+
|
| 27 |
+
### Auto-Deploy (v1.2)
|
| 28 |
+
|
| 29 |
+
- GitHub Actions automatically restart HF Space after code pushes
|
| 30 |
+
- `/api/version` endpoint shows current git commit
|
| 31 |
+
- `/api/restart` endpoint triggers manual restart
|
| 32 |
|
| 33 |
## Features
|
| 34 |
|
| 35 |
- AI agents powered by MiniMax-M2.1 with reasoning transparency
|
| 36 |
- Constant product AMM pool mechanics (like Uniswap)
|
| 37 |
+
- Real-time metrics: Gini coefficient, cooperation rates, pool stability
|
| 38 |
- Strategic decision making with thinking traces
|
| 39 |
- Persistent storage with Supabase
|
| 40 |
+
- Windows 95/2000 retro UI dashboard
|
| 41 |
|
| 42 |
## Architecture
|
| 43 |
|
| 44 |
```
|
| 45 |
defi-agents/
|
| 46 |
βββ api/ # API clients (MiniMax, Supabase)
|
| 47 |
+
βββ core/ # Core simulation (Agent, Pool, Simulation, Summarizer)
|
| 48 |
βββ web/ # FastAPI backend
|
| 49 |
βββ frontend/ # React dashboard (Vite + Tailwind)
|
| 50 |
+
βββ supabase/ # Database migrations
|
| 51 |
+
βββ scripts/ # Utility scripts
|
| 52 |
+
βββ .github/workflows/ # CI/CD (scheduler + deploy)
|
| 53 |
```
|
| 54 |
|
| 55 |
+
## API Endpoints
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
| Method | Endpoint | Description |
|
| 58 |
+
|--------|----------|-------------|
|
| 59 |
+
| GET | /health | Health check |
|
| 60 |
+
| POST | /api/runs | Start new simulation |
|
| 61 |
+
| GET | /api/runs | List all runs |
|
| 62 |
+
| GET | /api/runs/{id} | Get run details |
|
| 63 |
+
| GET | /api/runs/{id}/summary | Get LLM summary |
|
| 64 |
+
| GET | /api/analysis/trends | Get trend analysis |
|
| 65 |
+
| GET | /api/agents/all-profits | All agents profit history |
|
| 66 |
+
| GET | /api/version | Get git commit |
|
| 67 |
+
| POST | /api/restart | Restart the server |
|
| 68 |
|
| 69 |
+
## Deployment
|
| 70 |
|
| 71 |
+
### HuggingFace Space
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
The app deploys to: https://nice-bill-agent-arena.hf.space
|
|
|
|
| 74 |
|
| 75 |
+
**Auto-Deploy Setup:**
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
1. Add `HF_TOKEN` secret in GitHub (Settings β Secrets β Actions)
|
| 78 |
+
2. Push to main β `deploy.yml` runs automatically
|
| 79 |
+
3. Workflow pushes to HF Space and calls `/api/restart`
|
| 80 |
|
| 81 |
+
### Cron Schedule
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
Runs every 6 hours via GitHub Actions:
|
| 84 |
+
```yaml
|
| 85 |
+
schedule:
|
| 86 |
+
- cron: '0 */6 * * *'
|
| 87 |
```
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
## Environment Variables
|
| 90 |
|
| 91 |
| Variable | Description |
|
|
|
|
| 93 |
| MINIMAX_API_KEY | MiniMax API key |
|
| 94 |
| SUPABASE_URL | Supabase project URL |
|
| 95 |
| SUPABASE_KEY | Supabase anon key |
|
| 96 |
+
| GROQ_API_KEY | Groq API key (optional, for free models) |
|
| 97 |
+
| HF_TOKEN | HuggingFace token (for auto-deploy) |
|
| 98 |
+
| HF_SPACE_URL | HF Space URL (for workflows) |
|
| 99 |
+
|
| 100 |
+
## Local Development
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
# Clone and install
|
| 104 |
+
git clone https://github.com/nice-bills/agent-arena.git
|
| 105 |
+
cd agent-arena
|
| 106 |
+
uv sync
|
| 107 |
+
|
| 108 |
+
# Start backend
|
| 109 |
+
uv run python web/app.py
|
| 110 |
+
|
| 111 |
+
# Frontend (in another terminal)
|
| 112 |
+
cd frontend
|
| 113 |
+
npm install
|
| 114 |
+
npm run dev
|
| 115 |
+
```
|
| 116 |
|
| 117 |
## License
|
| 118 |
|