DEV Community

Cover image for I made a game where you debug a broken RAG pipeline from a terminal
Saurabh Pathak
Saurabh Pathak

Posted on Edited on

I made a game where you debug a broken RAG pipeline from a terminal

Most RAG tutorials end when the first answer comes back right. Real work starts later: the bot is already in production, it is giving wrong answers, and you have to find out why.

I wanted a way to practise that part, so I built a small browser game around it. It is called AI On-Call, it is free, and there is no sign-up.

How it plays

You get paged. A support bot's answer accuracy has dropped to 52% against a 90% target. You have a terminal, a dashboard with three service levels (accuracy, response time, cost) and five commands:

Command What it does
logs lists the failing requests
trace 4812 follows one request through the pipeline
set chunk_size 400 stages a change, nothing is live yet
replay tests the staged settings on 60 saved questions
deploy ships it, but only if every target is green

A trace shows evidence, not the answer:

oncall@prod $ trace 4812
trace 4812  "How long do refunds take?"
2 retrieve   top_k=1  dense
     #1 score 0.71  policy.md  1,200 tokens in one chunk
4 generate   -> "Refunds take 90 days."
WRONG  expected "5-7 business days"
Enter fullscreen mode Exit fullscreen mode

That one chunk holds the refund policy, the warranty policy and the invoicing policy, and the model quoted a number from the wrong one. You still have to decide what to change.

Three rules I held myself to

Several causes, never one. The support bot has three unrelated faults: chunks that are too big, product codes that meaning-based search can't find, and a temperature that makes the model invent numbers. Fix one and accuracy goes from 52% to 72%. Fix two and you reach 85 to 87%. The target is 90%.

Trade-offs are real. Turning everything up doesn't work. With top_k at 10 and reranking on, accuracy hits 100% and the deploy is still blocked, because the response time is 2.45 s and the cost is $3.25 per 1,000 requests.

More than one right answer. 256 of the 1,440 possible configs fix the incident, at $0.47 to $2.00 per 1,000 requests. You can fix the product-code problem properly with hybrid search, or brute-force it with a big top_k. Both pass. The brute-force version costs $1.98 against $0.59.

There is no model behind it

Each incident is a plain function from a config to three numbers. The same config always gives the same result. That keeps hosting free, makes it work on a slow connection, and means a score can be checked by replaying the commands.

It also means the numbers are teaching values I chose, not measurements. The failure modes are real; the exact percentages are not.

The fairness is tested. A test walks every config of every incident and fails the build if an incident:

  • starts already fixed
  • has no winning config
  • can be won by changing fewer than three settings
  • has only one answer
  • lets more than 35% of configs win

The second incident, a research agent that burned its budget overnight (no stop rule, retry storms, a prompt that grows every step), has only 7 valid fixes out of 192.

What is in it today

  • a 2-minute guided drill that shows each command once
  • two incidents, ten badges, XP, ranks and a daily streak
  • light and dark themes, and tappable commands on phones

Progress stays in your browser. There are no accounts or leaderboard yet.

Open source

It's plain JavaScript with no dependencies, in the same repo as the lessons it's based on: techsaurabh-394/ai-engineer-roadmap. An incident is one object in one file, and the repo has a short guide to adding one. If you have debugged a failure that would make a good incident, I'd like to hear it.

The game sits inside the free AI Engineer Roadmap on mernstackdev.com, next to the MERN tutorials and error-fix guides I write there.

How many commands did it take you? The best possible run is 4.

I wrote this post with help from an AI assistant. I checked every number against the game's code.

Top comments (0)