Skip to content

A working answer for a live AI sales coach

Coach reliability kit

Reliable answers when several reps ask at once, the trainer's exact lines instead of paraphrases, and a 30-question test that stops a bad publish. Built on the Clear Next Step method, a fictional sales method written for this demo.

Three reps ask at once

Today’s client (no retry)
2/3 answered
1 failed · slowest 1.9 s
1 rep sees an error
With retry queue
3/3 answered
0 failed · slowest 31.6 s
Answered, but one rep waits 31.6 s
+ smaller prompts
3/3 answered
0 failed · slowest 1.5 s
Everyone answered quickly

14,500-token prompts against an assumed 30,000 tokens-per-minute limit. Answer-bank hits never call the model, so common questions cannot hit a 429 (about 69% of questions in the simulated day). Simulated provider: no real model calls.

Your first milestone: the 429 fix and the 30-question test

  1. Read one failed requestThe 429 headers in your logs say which limit was hit, how much is left and whose key it is: Replit's AI integration or an OpenAI account you control.
  2. Wrap your OpenAI callPut the retry-queue client around the call you have today: token-aware waiting, backoff that honors retry-after, and “Lots of reps are asking right now” instead of an error.
  3. Load your 30 questionsYour questions and the exact lines a good answer must use go into the test format. Today's score becomes the baseline.
  4. Gate the Replit publishThe deployment build runs the test. If the score drops, or more questions get a wrong line, the build fails and nothing is published.

What I need from you

  • A log export with one failed request, headers included.
  • Your 30 questions and the lines a good answer must use.
  • Access to the Replit project, and which key the AI integration uses.

The library test also catches the bug you just fixed: it fails the build if any approved line can no longer be found.

Read the handover notes

Your question 2

Why do one in three requests fail when three reps ask at once?

Three prompts of 14,500 tokens plus 500 output tokens need 45,000 tokens in the same minute. An assumed 30,000 tokens-per-minute limit fits two; the third gets a 429.

Your question 3

How does the coach use the exact approved lines?

Common questions hit a bank of 20 approved answers returned exactly as stored. Everything else finds the exact source line by ID, a verbatim check restores it if a model rewrites it, and when two lines fit the coach asks which one.

  • 5 current documents
  • 42 approved lines
  • old versions never searched

Task 4: the regression test

How do we know a change didn't make answers worse?

Thirty fictional questions scored on exact lines before every publish: 28/30 today. A change that lets the model paraphrase drops it to 19/30, and the gate blocks it. 45 held-out phrasings get 0 wrong lines.

Task 5: monitoring

How would we notice failures in production?

Each answer is logged with its path, outcome and wait. Alerts fire on unanswered questions and on the error rate, with a simple error-rate view. The page shows an illustrative day of simulated traffic run through the same clients.

What is real here

Running code

The clients, token bucket, backoff, matcher, retrieval and scorer are the TypeScript behind the numbers on the 429, Ask and 30-question pages, with unit, integration and end-to-end tests. Monitoring runs a simulated day of traffic through the same clients.

A simulated provider

An OpenAI-compatible endpoint that enforces tokens and requests per minute, returns 429 with retry-after, and streams over SSE. It never calls a model, so every run is repeatable. The limits are assumptions to check against your own headers.

Fictional content

The Clear Next Step method, its documents, answers and test questions were written for this demo. No real trainer's material is used. How it works.