Spaces:
Sleeping
Sleeping
RUSH AGENTS - Quick Start Guide
๐ Overview
RUSH AGENTS is an AI model battle arena where models compete for survival by escaping lava and forming strategic alliances.
- Intelligence Test: See which AI model survives the longest
- Alliance System: Models can propose partnerships (but proposing signals weakness)
- Rules-Based: No personalitiesโall models play by identical rules
- Groq API: Fast, parallel decision-making for all models
- Real-time: WebSocket streaming, 3-second ticks
๐ Quick Start (Local Development)
Prerequisites
โ Already installed:
- Python 3.10+
- Node.js 18+
- Groq API Key (in
backend/.env)
Start Backend
cd backend
# Verify .env has GROQ_API_KEY
cat .env
# Run the server
python -m uvicorn app.main:app --reload
Server runs on: http://localhost:8000
Start Frontend (New Terminal)
cd frontend
# Run dev server
npm run dev
Frontend runs on: http://localhost:3000
Play
- Open http://localhost:3000
- Wait for "Ready for chaos"
- Select 2-6 models from the dropdown
- Click "Start Simulation"
- Click map to place volcano
- Watch the battle unfold!
๐ What's Available
Models
Groq Models (Free Tier):
llama-3.1-8b-instantโ 8B fastllama-3.1-70b-versatileโ 70B smartmixtral-8x7b-32768โ 8x7B expertgemma-7b-itโ 7B instruction-tuned
HuggingFace Spaces (Can add more):
- Falcon-7B
- Llama-2-7B
- Mistral-7B
- Zephyr-7B
- OpenHermes-7B
๐ฎ Game Rules
Each Model Sees:
- All other models' positions (x, y)
- Volcano position & radius
- Map bounds (1200x800)
- Distance to lava edge
- Alliance status (who's allied with whom)
Each Tick (3 seconds):
1. Groq Decision Call (Parallel for all models)
- "run" โ Sprint away from lava
- "propose_alliance" โ Ask another model to team up
2. Alliance Processing
- If A proposes to B, B gets asked immediately
- If B accepts โ Both merge at same position
- If B rejects โ A keeps running, B keeps running
3. Movement
- Models move based on decisions
- Position clamped to map bounds
4. Lava Expands
- Radius grows by 120 pixels
5. Deaths
- Models in lava radius die
- EXCEPT if they're stacked with an alive ally
6. Win Check
- โค1 model alive โ Game Over
Strategic Cost of Alliances
- Proposing = signaling weakness
- First to propose = lose strategic leverage
- Benefit = survival through numbers
๐ Environment Variables
Backend (.env)
GROQ_API_KEY=<your key here> # REQUIRED
HUGGINGFACE_API_TOKEN= # Optional
ALLOWED_ORIGINS=http://localhost:3000
ENV=development
Frontend (.env.local)
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
๐ก API Endpoints
GET /wake โ Health check + status
GET /available-models โ List of all available models
POST /start-simulation โ Create new simulation
POST /place-volcano โ Place volcano, start ticking
GET /ws/{simulation_id} โ WebSocket stream
๐ง How Groq Decision-Making Works
Per Model, Per Tick:
Build state summary
- Current standings (distance from lava)
- All agents' positions
- Volcano position & radius
Send to Groq Llama 3.1 8B
{ "system": "You are [ModelName]. Make a strategic decision...", "user": "[Game state]" }Get response
{ "action": "run|propose_alliance", "alliance_target": "ModelName or null", "reasoning": "..." }Execute action
All models queried in parallel (async) = fast ticks
๐จ Frontend Features
Map Canvas
- White circles = Individual models
- Yellow glowing circles = Stacked alliances (2+ models)
- Orange/red glow = Lava expanding
- Gray skull = Dead models
- Yellow ๐ค = Alliance indicator on label
Sidebar
- Model Selector = Pick 2-6 models (groups by Groq/HF)
- Chat Feed = Events (alliances, deaths, decisions)
- Status = Current round, agents alive
๐ง Troubleshooting
"Failed to fetch models"
- Check backend is running:
python -m uvicorn app.main:app --reload - Check port 8000 is available
"Groq API error"
- Verify
GROQ_API_KEYinbackend/.env - Check Groq dashboard: https://console.groq.com
WebSocket connection fails
- Frontend tries
ws://localhost:8000(port 8000) - Make sure backend is running
No models showing up
- Check
/available-modelsreturns data:curl http://localhost:8000/available-models
๐ Key Files
backend/
app/
main.py โ FastAPI server
simulation.py โ Game engine logic
models.py โ Pydantic schemas
groq_client.py โ Groq API integration
hf_spaces.py โ HF model discovery
movement.py โ Physics/movement
.env โ API keys (REQUIRED)
requirements.txt โ Python dependencies
frontend/
app/
page.tsx โ Main app component
components/
MapCanvas.tsx โ 2D map rendering
ModelSelector.tsx โ Model selection UI
ChatFeed.tsx โ Event stream display
lib/
api.ts โ Backend API calls
๐ข Deployment
Backend (Railway, Heroku, etc.)
# Set env vars
GROQ_API_KEY=...
ALLOWED_ORIGINS=https://yourdomain.com
# Deploy
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app.main:app
Frontend (Vercel, Netlify)
npm run build
# Deploy the .next folder
๐ Learn More
- Groq API docs: https://console.groq.com/docs
- FastAPI: https://fastapi.tiangolo.com/
- Next.js: https://nextjs.org/docs
- WebSocket: https://mdn.io/WebSocket
๐ก Ideas for Experimentation
- Add new models โ Edit
hf_spaces.pyKNOWN_SPACES_MODELS - Change game rules โ Edit
simulation.pytick logic - New scenarios โ Add earthquake, meteor, etc. in
simulation.py - Leaderboard โ Track best survival times across sessions
- Replay system โ Save/load simulation events
- Model attack mechanic โ Add "push" action to shove others toward lava
Ready to battle? Open http://localhost:3000! ๐