huggingface/pybot
Machine LearningA rule-based chatbot built entirely in Python, created by a swarm of agents, with no model weights or training.
Project overview
PyBot is a chatbot whose replies come from plain Python code: if-else branches, regular expressions and lookup tables, rather than a trained model. The project is an experiment in how far rule-based conversation can go when a swarm of more than 1,000 agents writes and evaluates the rules instead of people. According to the README, the agents produced over 5,000 versions and raised PyBot's win rate on SmolTalkBench from 0% to 26%, which the authors compare with SmolLM-360M-Instruct.
The repository holds the generated bot as-is: about 640,000 lines of Python in bot/, plus roughly 550,000 lines of tests the agents wrote. On each turn, modules in bot/modules/ may propose a reply, and an arbiter in bot/modules/arbiter.py chooses the one returned. Shared components cover understanding user input, conversation memory, a data-backed knowledge base and response composition.
Quick start
PyBot requires Python 3.8 or newer and no other packages or model downloads. Clone the repository and run the package as a module:
git clone https://github.com/huggingface/pybot
cd pybot
python -m pybot
This opens a terminal chat. Type a message and press Enter; /reset starts a new conversation and /exit quits. Startup takes a few seconds because Python loads roughly 640,000 lines of code, and replies take about a second.
For one-shot questions, or to pipe messages and receive one reply per line:
python -m pybot -p "Why do onions make you cry?"
echo "how long should i boil an egg" | python -m pybot
Useful options include -i to keep chatting after a -p prompt, -s N to fix wording and reproduce replies, and -v to show which module produced each reply and how long it took. To get a pybot command available anywhere, run pip install . from the clone. The browser demo on Hugging Face shows which module produced each reply.
Constraints and limitations
PyBot's capabilities are bounded by hand-written rules and lookup data, and the reported 26% benchmark win rate is a comparison against a reference answer, not a claim of general conversational quality. Answers depend on what the generated modules cover; questions outside that coverage fall back to the response composer. The terminal interface is text-only, and conversation state is in memory, with /reset clearing it. The project is licensed under Apache-2.0.
Repository layout
bot/ contains the chatbot itself, pybot.py contains only the command-line wrapper, and tests/ covers the command line; run it with python -m unittest discover -s tests. The README also documents the internal split: understanding (25,000 lines), memory (109,000), knowledge base (317,000), response composition (104,000) and modules (81,000).
HotRepo's take
PyBot's value is as a readable, inspectable experiment: the full rule set, supporting data and generated tests are in the repository, so the benchmark claim can be checked against the code rather than taken on trust. The project is new and its only recorded HotRepo snapshot is a new-list entry on 2026-11-16, gaining 20 stars in about an hour; that is a brief observation window, not evidence of sustained traction. The stated win rate is a single benchmark result reported by the authors, and the comparison with SmolLM-360M-Instruct depends on that benchmark's judge and reference answers.
Written by AI from the project's README, updated . The project's own docs are the source of truth.