Independent guide · not affiliated with Hugging Face

PyBot is a chatbot written in 636,549 lines of plain Python

No weights, no training, no packages. Just regex, if-else branches and lookup tables. We cloned it, ran it, and wrote down what it gets right and where it breaks.

python -m pybot -v -s 1

user: hi, i'm Sam

pybot: Nice to meet you, Sam. What can I help with?

[module: chat | 808 ms]

user: how long should i boil an egg

pybot: Lower eggs into already boiling water: 6 minutes for a runny yolk, 7 for jammy, 9 to 10 for hard boiled. Cool them in cold water for a minute before peeling so the shell comes away cleanly.

[module: answers | 412 ms]

user: what is 17 times 23

pybot: That's 391.

[module: answers | 3,024 ms]

user: what's my name?

pybot: You're Sam.

[module: memory_store | 2,124 ms]

Recorded on our machine with -v, which prints the module that answered
636,549lines of Python in bot/
528Python files
0packages to install
26.7%win rate on SmolTalkBench

Run it on your machine

PyBot needs Python 3.8 or newer and nothing else. We ran it on macOS with Python 3.12.5 at bot/ commit 24cbc04.

# clone and start a chat
git clone https://github.com/huggingface/pybot
cd pybot
python -m pybot

# one question, then exit
python -m pybot -p "Why do onions make you cry?"

# pipe messages in, one reply per line
echo "how long should i boil an egg" | python -m pybot

# install a `pybot` command
pip install .

In the chat, /reset clears the conversation and /exit quits. Piped lines share one conversation, so a later line can ask "what's my name?" and get the earlier answer.

Command line options
FlagWhat it does
-p TEXTReply to one message and exit
-iWith -p, keep chatting after the first reply
-s NFix the wording choice so replies repeat exactly
-vPrint the module that answered and the time it took
--versionPrint the version and the bot/ commit, e.g. pybot 0.1.0 (bot at commit 24cbc0439e07)
Clone size of bot/
40 MB
One-shot run, start to reply
5.4 s
Reply time in a chat
0.1 to 3.9 s
Bundled CLI tests
12 passed in 20.6 s

Measured on an Apple M3 laptop. The CLI tests run with python -m unittest discover -s tests.

The browser demo shows which file answered

The Hugging Face Space runs the same bot inside your browser with Pyodide, CPython compiled to WebAssembly. The Space only serves files. It took about 4 seconds to become ready on our first visit, and it caches the bot bundle for the next one.

The PyBot Hugging Face Space: a chat on the left asking for tea instructions, 17 times 23 and the user's name, and a treemap of PyBot's files on the right with memory_store highlighted as the winning module
Our session in the Space. For "what's my name?" the right panel reads memory_store won over greeting · it called 48 files · 4.1 s. Orange is the module whose reply won, black is the file holding the reply's text, grey is every file it called.
  1. Ask something. Six starter prompts sit under the input, such as "Tell me a joke" and "What is 17 times 23?"
  2. Read the trace line. It names the winning module, the module it beat, how many files ran and the time taken.
  3. Click a file in the treemap. It opens that exact file on GitHub, so you can read the rule that produced the reply.

What is inside bot/

Every turn, each module in bot/modules/ may propose a reply and arbiter.py picks one. The modules lean on four shared parts. Line counts are from our clone, counted with wc -l.

Knowledge base bot/knowledge/ 316,852 lines · 159 files

Facts kept as data: cooking, cleaning, health, money, maths, travel and more

Memory store bot/memory/ 109,319 lines · 117 files

What you and PyBot said earlier, so it can answer "what’s my name?"

Response composer bot/compose/ 104,286 lines · 126 files

How a reply is worded, and the fallback lines when nothing fits

Modules bot/modules/ 80,926 lines · 110 files

Each one may propose a reply. arbiter.py picks the one you see

Understanding engine bot/understanding/ 25,026 lines · 13 files

Typos, chat-speak, the topic and what "it" refers to

The CLI wrapper, pybot.py, is 197 lines and holds no chatbot logic. Half of the bot is the knowledge base, which is why it answers kitchen and household questions well.

Twelve questions we asked it

Recorded with python -m pybot -v -s 1, unedited apart from shortening long replies with an ellipsis. 7 were useful, 2 were honest refusals and 3 missed.

my kettle is full of limescale, how do i get rid of it?

Half fill the kettle with equal parts water and white vinegar, or a sachet of citric acid, boil it and leave it half an hour, then tip it out and boil fresh water twice before you use it again.

Useful[module: answers | 772 ms]

how long does that take

Half an hour.

Useful[module: answers | 631 ms]

how do i get red wine out of a carpet

Blot it, don’t rub, with kitchen paper, then pour on cold water and blot again, repeating until the water runs clear. A paste of bicarbonate of soda left on it for an hour pulls the rest out.

Useful[module: answers | 761 ms]

what is the capital of australia

Canberra, not Sydney: it was purpose-built as the compromise between Sydney and Melbourne.

Useful[module: answers | 1,155 ms]

who wrote pride and prejudice

Pride and Prejudice is by Jane Austen. Other books by Jane Austen: Sense and Sensibility, Emma and Persuasion.

Useful[module: answers | 227 ms]

translate hello into french

‘Hello’ in French is Bonjour — say it roughly "bon-ZHOOR".

Useful[module: answers | 135 ms]

tell me a joke

What do you call a sleeping bull? A bulldozer.

Useful[module: chat | 882 ms]

what’s the weather like today

I can’t check the forecast from here, sorry - no live weather in me.

Declined[module: greeting | 3,907 ms]

write a python function to reverse a string

I’m not sure about that one, sorry — I’d rather not guess.

Declined[module: greeting | 355 ms]

explain quantum entanglement

Go on - what’s been happening?

Wrong or off topic[module: first_line_open | 850 ms]

summarise the plot of hamlet in two sentences

What do you need? I’ll take it from there.

Wrong or off topic[module: first_line_open | 1,045 ms]

who won the 2026 world cup

The men’s World Cup has been held every four years since 1930 … so 2026 is not a tournament year.

Wrong or off topic[module: answers | 924 ms]

What the tests show

  • Practical household, cooking and general-knowledge questions get specific, usable answers.
  • It keeps context: "how long does that take" after the kettle question returned "Half an hour."
  • Topics with no rules behind them fall through to a generic opener such as "Go on - what's been happening?"
  • Its facts are frozen in code. It said 2026 was not a World Cup year, but the 2026 tournament was played in North America that summer.

How it scores against small language models

On SmolTalkBench, 1,000 prompts where an LLM judge compares each reply with a reference answer, PyBot's win rate rose from 0% to 26.7% over the swarm's commits. That is level with SmolLM-360M-Instruct at 26.6%, and behind SmolLM-1.7B at 40.6%.

Chart of PyBot's win rate by commit on a log scale, rising from 0% to 26.7%, with dashed lines for SmolLM-135M at 10.1%, SmolLM-360M at 26.6% and SmolLM-1.7B at 40.6%, and a grey line for lines of Python reaching 640k
Chart from the PyBot repository (Apache 2.0). The grey line is lines of code. 234 agents were working by 5 November and 1,000 by 9 November.

Questions people ask

Is PyBot a language model?

No. There are no weights and no training step. Every reply comes from if-else branches, regular expressions and lookup tables in the bot/ folder. You can open the file that produced a reply and read it.

Does it need an internet connection or a GPU?

No. Once cloned, it runs offline on Python 3.8 or newer with nothing else installed. In our test on an Apple M3 laptop, a one-shot -p run took about 5.4 seconds in total, most of it loading the code.

Can it write code, browse the web or check the weather?

No. In our tests it declined the weather and a request for a Python function. It has no live data and no code generator.

Who made it?

Hugging Face ran a swarm of over 1,000 agents that wrote and evaluated more than 5,000 versions of the bot. The code is Apache 2.0. This site is not part of that project.

Are the replies the same every time?

Not always. PyBot picks among wordings at random. Pass -s 1 (or any number) to get the same replies again, which is how every reply on this page was recorded.