Spaces:
Sleeping
Sleeping
File size: 1,561 Bytes
43d708a a64703a 43d708a 117a348 43d708a b2c8834 43d708a b2c8834 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ---
title: RUSH AGENTS RUSH Backend
emoji: 🔥
colorFrom: red
colorTo: yellow
sdk: docker
sdk_version: latest
python_version: "3.11"
pinned: false
---
# Rush Agents Rush Backend
FastAPI server driving the fire-suppression simulation.
## What It Does
- Accepts model selections and starts a new simulation.
- Places a fire on the map and generates water wells.
- Runs the tick-based AI loop with coalition voting, movement, and extinguishing.
- Streams state updates and events over WebSockets.
## Key Endpoints
- `GET /wake` - health and readiness check
- `GET /available-models` - list available models for the UI
- `POST /start-simulation` - create a new simulation
- `POST /place-fire` - place the fire and spawn water sources
- `WS /ws/{simulation_id}` - stream live simulation ticks
## Environment Variables
- `HUGGINGFACE_API_TOKEN` or `HF_API_TOKEN`: Required for Hugging Face router model calls.
- `ALLOWED_ORIGINS`: CORS whitelist.
## Local Run
```bash
cd backend
pip install -r requirements.txt
python -m uvicorn app.main:app --reload --port 8000
```
## Notes
- Simulation state is in memory.
- Fire growth, extinguish rate, and movement are tuned in `app/simulation.py`.
- Model decisions are generated in `app/groq_client.py` through `https://router.huggingface.co/v1/chat/completions`.
- `/available-models` is backed by `app/hf_spaces.py` and filters a preferred model list against the live Hugging Face router catalog.
- This `backend/` app is the local development copy; the Hugging Face Space runtime uses the root `app/` package.
|