PyBot / README.md
lewtun's picture
lewtun HF Staff
Document private bucket storage for the deployed chart
8c94880
|
Raw History Blame
2.8 kB
---
title: PyBot
emoji: 🐍
colorFrom: gray
colorTo: gray
sdk: docker
app_port: 7860
pinned: false
---
PyBot: a conversational bot without LLMs, written by a swarm of LLM agents. One page: the story and a live chat that shows
which of PyBot's modules and files produced each reply. Pinned to commit `64eb2c844738` of `HuggingFaceSwarms/SwarmChat-v8`.
`app.py` serves `site/` and `POST /api/chat` / `POST /api/trace`; `bot/bot-<sha12>.zip` holds the bot's source (`bot/**.py` only);
`bot_runner.py` runs it in a fresh worker per request. Built by `build_pybot.py` in the swarmchat-release workspace.
## Run locally
Use Python 3.12 (required by the trace endpoint) on macOS or Linux:
```sh
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -r requirements.txt
uvicorn app:app --host 127.0.0.1 --port 7860
```
Open http://127.0.0.1:7860. The health endpoint is `/health`.
Keep local logs and temporary files in `scratch/`, which is ignored by Git.
### Progress chart
Generate the chart snapshot from the leaderboard's v3 cache before starting the app:
```sh
python build_progress.py /path/to/swarmchat-leaderboard-v3.json --source-repo scratch/v8-history.git
```
The generated data stays in `scratch/progress.json` and is never committed. In the
hosted Space, the private `HuggingFaceSwarms/pybot-chart` bucket is mounted read-only
at `/home/user/app/scratch`, supplying `progress.json` across rebuilds and restarts.
To publish a regenerated snapshot, activate the local environment and run:
```sh
hf buckets cp scratch/progress.json hf://buckets/HuggingFaceSwarms/pybot-chart/progress.json
```
The bucket mount is configured in the Space settings, separately from Git. Preserve
it when changing volumes, and recreate it when duplicating the Space. No Hub token
is needed by the app. The chart shows an unavailable message if the snapshot is absent.
It uses the leaderboard's length-penalised percentage metric and latest successful
1,000-prompt run per revision, with all three SmolLM baselines. The contiguous outage
plateau from November 7, 2026, 12:12:47 through 13:15:11 UTC (commit times) is omitted;
other score fluctuations and the original revision positions are preserved.
The right axis overlays physical lines in `bot/**/*.py` at each retained evaluated
commit, including blank lines and comments but excluding tests. Counts come from
the source repository's first-parent Git diffs, including deletions and merges.
Fetch the source history into `scratch/v8-history.git` before building the snapshot;
unavailable commits get a null code-size value, rather than an estimate. The first
evaluated seed (`541b8def5107`) predates the current main history and is no longer
available from the Hub; its win-rate point remains, but its code-size point is absent.