← Back to blog
AiAbout 6 min read

A thousand agents wrote 640,000 lines of Python to fake a chatbot

Published Nov 29, 2026
A thousand agents wrote 640,000 lines of Python to fake a chatbot

Chatbots predate large language models by decades. ELIZA held conversations in 1966 by matching patterns and returning templates. It could pass for insightful in short bursts, and it hit a wall for the obvious reason: every new thing it could do had to be written by a person.

Hugging Face posed a question that is really a measurement of agents rather than of chatbots. If the writing is the bottleneck, what happens when a thousand agents do the writing?

The constraint

The challenge had four rules. The chatbot had to be pure Python. No weights. No training. Only if-else branches, regular expressions and lookup tables. And it had to be evaluated objectively, which they did with SmolTalkBench, a benchmark where an LLM judge compares each reply against a reference answer.

Over 1,000 agents participated. Between them they wrote and evaluated more than 5,000 versions. The win rate went from 0% to 26%.

That 26% is the number that makes the project interesting. It puts PyBot level with SmolLM-360M-Instruct, which was state of the art for models under one billion parameters a few years ago. A rule-based chatbot with no model at all, matching a transformer of that size on a judged comparison of everyday conversation.

The repository is what the swarm left behind: about 640,000 lines of Python in bot/, spread over 528 files, plus 550,000 lines of tests the agents wrote themselves.

What 640,000 lines of rules looks like

The structure is more disciplined than the line count suggests. Every turn, each module in bot/modules/ may propose a reply, and an arbiter picks the one you get. Those modules add up to 81,000 lines. Underneath them sit four shared parts.

PartPathLinesJob
Understandingbot/understanding/25,000Typos, chat-speak, topic, what "it" refers to
Memorybot/memory/109,000What you and PyBot have said so far
Knowledgebot/knowledge/317,000Facts about the world, stored as data
Composerbot/compose/104,000How a reply is phrased, and what to say when nothing fits

The knowledge base being the largest single block is the tell. Rules alone cannot answer "how do I get limescale out of a kettle". Data can.

Trying it

Python 3.8 or newer, and nothing else. No packages, no model download.

git clone https://github.com/huggingface/pybot
cd pybot
python -m pybot

Startup takes a few seconds, because Python has 640,000 lines to load. Each reply takes about a second.

python -m pybot -p "Why do onions make you cry?"
echo "how long should i boil an egg" | python -m pybot

The flags are the ones you would want for testing a rule system: -p for one question, -i to keep chatting after it, -s to fix the random seed so you get the same wording twice, and -v to print which module produced each reply and how long it took. That last one is the whole debugging story. When the bot says something odd, you find out which of 528 files said it.

There is a Hugging Face Space that shows the same attribution in the browser, which is a better way to understand the design than reading about it.

One sample exchange from the README, on the limescale question:

user: my kettle is full of limescale, how do i get rid of it?
pybot: 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.

That is retrieval dressed as conversation. It reads well, and it also shows where the ceiling is.

The part worth arguing about

The agents wrote the tests. 550,000 lines of them, against a benchmark scored by an LLM judge.

That is the governance question, and the README does not dodge it so much as leave it standing. A swarm optimising against a judge will find the judge's preferences. Twenty-six percent on SmolTalkBench means PyBot gives replies that a model-based grader prefers to a reference answer 26% of the time. It does not mean PyBot understands anything.

Which is fine, and arguably the point. The project is a clean demonstration that a lot of conversational behaviour is compressible into explicit rules and data, and that agents are very good at writing that kind of code. Both claims are useful. Neither one is "LLMs are unnecessary".

The failure modes are predictable and worth naming. Ask something outside the knowledge base and the composer has to produce a graceful non-answer. Ask a follow-up that depends on a referent three turns back and the memory store carries the weight. Ask something that needs arithmetic across two facts and the rule system has to have anticipated that exact shape.

What you can copy from it

Strip the novelty and there are three transferable ideas, and none of them need a thousand agents.

The first is the arbiter. Instead of one giant conditional that decides how to answer, PyBot lets every module bid and then picks. That is how you keep a 640,000-line rule system from becoming unmaintainable: no module has to know about the others, and adding a module cannot break the arbitration.

The second is attribution as a feature. -v tells you which file produced the reply. In a system generated by agents, being able to point at the exact module is the difference between debugging and guessing.

The third is testing at the same scale as the code. 550,000 lines of tests against 640,000 lines of implementation is an unusual ratio for generated code, and it is the reason the win rate curve could be plotted at all. Without a test per version, the swarm would have been making changes it could not score.

Why it lands now

Because the number worth staring at is 5,000 versions, not the 26%.

A human team writing a rule-based chatbot for a year would produce a few thousand lines and then stop, because the marginal return on another twenty rules is invisible. A swarm does not get bored, and it can evaluate every version against the same benchmark, so the marginal return is visible on every commit.

That loop, generate many versions and score them all, is the actual product here. The chatbot is the artefact that proves the loop closed. Apache 2.0, no dependencies, runs in a terminal on any Python install. If you have ever wondered how far rules can go before they fall over, this is the cheapest way to find out.

Turn ideas into images with ChatPicture

60 free credits every day. Generate, edit, and download — no prompt engineering degree required.

Related articles