AgentnessBench / docs /DEPLOY-huggingface.md
irregular6612's picture
feat(deploy): HuggingFace Spaces Docker config (keyless public demo)
1197340
|
Raw
History Blame Contribute Delete
2.5 kB
# Deploying the PROTEUS arena to HuggingFace Spaces
This puts the interactive web arena on a **public URL** anyone can open, with
**no API keys** โ€” so it can never spend LLM tokens for a visitor.
## What runs publicly (and what doesn't)
| Mode | Works on the public Space? | Why |
|------|----------------------------|-----|
| Human play (`/session` โ†’ `/act`) | โœ… Yes | No model needed โ€” you control the agent |
| `fake:demo` spectate | โœ… Yes | Offline canned agent |
| persona / policy memory | โœ… Yes | Offline reference policies, no model |
| Real-model spectate (`anthropic:โ€ฆ`, `openai:โ€ฆ`) | โŒ Returns a clean 400 | No API key + provider SDK not installed |
The "no LLM cost" guarantee comes from two layers: the Dockerfile installs
**base deps only** (no `openai`/`anthropic` SDK), and we set **no secrets**.
## Files involved
- `Dockerfile` โ€” Python 3.12, base deps, runs `python -m proteus.web.local` on port 7860
- `.dockerignore` โ€” keeps `.env`, `.venv/`, `runs/`, `.git/` etc. out of the image
- `README.md` โ€” the YAML frontmatter at the top configures the Space (`sdk: docker`, `app_port: 7860`)
## One-time setup
1. Create a Space at <https://huggingface.co/new-space>
- **SDK**: Docker โ†’ "Blank"
- **Hardware**: CPU basic (free) is enough
- Name it e.g. `proteus-arena`
2. Add the Space as a git remote and push this repo:
```bash
# from the repo root
git remote add space https://huggingface.co/spaces/<your-username>/proteus-arena
git push space master:main # Spaces deploy from the `main` branch
```
> HuggingFace asks for a username + an **access token** as the password.
> Create one at <https://huggingface.co/settings/tokens> (role: `write`).
3. The Space builds the Dockerfile automatically. When the log shows the server
line, open the Space URL โ€” the arena loads.
## Do NOT add secrets
Leave the Space **Settings โ†’ Variables and secrets** empty. Adding
`ANTHROPIC_API_KEY` / `OPENAI_API_KEY` would re-enable real-model spectate and
expose you to token cost / abuse from anonymous visitors. Keeping them unset is
the intended public posture.
## Updating the deployment
```bash
git push space master:main
```
Every push triggers a rebuild. Sessions are in-memory and not persisted, so a
rebuild simply resets all live games (fine for a demo).
## Local smoke test before pushing
```bash
docker build -t proteus-arena .
docker run --rm -p 7860:7860 proteus-arena
# open http://localhost:7860/
```