Skip to main content
PanelReady
Menu

Diagnose a Failing AI Support Assistant

11 min readFree lesson

Trace six real-world failures in the HelpDesk AI case to their root causes, rank them by severity and plan fixes with tests.

HelpDesk AI is the case you will meet throughout this course: a support assistant that serves many companies, answers from each one's help articles, and drafts tickets for a human agent to approve. It must never issue a refund or change an account on its own. This lesson hands you six failures from its first month in production and shows how to separate them, because "use a bigger model" is not a diagnosis, and interviewers ask debugging questions like this in almost every AI round.

What interviewers are testing

  • You separate symptoms from root causes and do not jump to a fix.
  • You localize a failure to the first component where it goes wrong, using evidence.
  • You rank failures by severity, with security and data leaks first.
  • You turn every fix into a test, so the same failure cannot return silently.

The system in one picture

A request moves through six stages. Each one can fail in its own way.

  1. Auth and tenant check: who is asking, and which company's data they may see.
  2. Retrieval: search that company's articles and past tickets for relevant passages.
  3. Context assembly: build the prompt from instructions, retrieved passages and conversation history.
  4. Generation: the model writes an answer with citations, or calls a tool.
  5. Tools: draft a ticket or look up an order, with approval for any write.
  6. Output checks and delivery: validate the format, check citations, stream to the user, log everything.

The habit to build is simple. When something goes wrong, find the first stage where the data stops being correct. Everything after that stage is a symptom.

Six failures from the first month

A billing answer quotes last year's refund policyRetrieval and indexingThe current policy is in the top results and the model still quotes the old one
A user sees a paragraph from another company's docsAuth and tenant filter in retrievalEvery retrieved chunk carries the correct tenant ID
A ticket is created twice after a timeoutTools: retry and idempotencyThe two tickets carry different request IDs from two separate user actions
A prompt change helps long questions but breaks short onesEvaluation coverageThe eval set already contains short questions and they passed
Answers cite article 4471, which says nothing of the kindGeneration and citation checksThe cited passage does support the claim on a careful read
Answers take 9 seconds at peak, up from 3Serving: queueing, context size, model choiceTime to first token is flat and only total time grew

Reading each one

Stale policy. The old article probably still sits in the index because deletes or updates were not propagated. Check the document timestamps and whether a retired version is still searchable. A bigger model would quote the stale policy just as confidently.

Cross-tenant leak. Treat it as a security incident, not a quality bug. The filter must run before any text reaches the model, enforced in the retrieval query rather than requested in the prompt. Check how the tenant ID gets from the session to the search call.

Duplicate ticket. The client timed out, retried, and the server ran the write twice. The fix is an idempotency key per user action, so a repeated request returns the first result instead of creating a second ticket.

Prompt regression. The change was judged on a few long examples. Short questions were never in the test set. The fix is in the process: a fixed eval set covering each question type, run before every prompt change.

Bad citation. The model attached a real ID to an unsupported claim. Inspect whether the right passage was retrieved at all. If it was, add a citation check that verifies the claim against the cited passage, and let the assistant say it does not know.

Slow answers. Split the latency. A long time to first token points at queueing or a very large prompt. A long total time points at long outputs or a slow model. The common cause is context creep: history and retrieved passages growing until each request carries thousands of extra tokens.

Rank by severity, not by frequency

Not all failures are equal. The cross-tenant leak may affect one user in ten thousand, yet it blocks release on its own, because it breaks a promise to every customer. A useful order:

  1. Security and privacy: data leaks, unauthorized actions.
  2. Harmful wrong actions: duplicate tickets, writes nobody approved.
  3. Wrong answers stated confidently: stale policies, bad citations.
  4. Quality regressions: the prompt change that broke short questions.
  5. Performance and cost: slow answers, expensive requests.

Quick check

HelpDesk AI scores 94% on the eval set, and a week of logs shows one cross-tenant leak. What do you do?

  1. Ship, since 94% clears the team's 90% quality target
  2. Block the release until the tenant filter is fixed in code and a leak test passes
  3. Fix the most frequent wrong answers first, since they affect the most users
  4. Add a system prompt line forbidding other companies' data, then ship
Show the answer

B. One leak breaks a promise to every customer, so it blocks release whatever the average says. Frequency is the wrong way to rank severity, and a prompt line is not an access control.

Worked example: tracing one slow request

The latency complaint arrives with a trace from a peak hour. Here it is, simplified:

Auth and tenant check40 msNormal
Retrieval220 msNormal
Context assembly15 msPrompt is 14,200 tokens, up from about 4,000 at launch
Queue wait at the model provider2,100 msPeak-hour rate limiting
Time to first token after the queue1,900 msLarge prompt to process
Generation4,800 ms620 output tokens
Output checks60 msNormal

Total: about 9.1 seconds. Three causes stack up. The prompt tripled because the whole conversation history is resent every turn. Peak traffic hits a rate limit. And answers are long. The fixes follow the evidence: summarize or trim old turns and cap retrieved passages, which cuts input tokens and time to first token. Raise the rate limit or route simple questions to a smaller, faster model. Ask for shorter answers by default and stream them so users see text within a second or two.

Then measure again on the same peak-hour traffic. If time to first token drops below two seconds, the main complaint is solved even if total time stays near five.

The course map, through HelpDesk AI

Every section of this course fixes one part of this system.

Why models make things up, context limits, token costsLLM Foundations
Instructions, structured outputs, prompt changesPrompt and Context Engineering
Stale or missing passages, tenant filters, citationsRAG Interviews
"How do we know it helped?", release gatesLLM Evaluation and Experimentation
Tool calls, retries, approvals, MCPAI Agents, Tools and MCP
When to fine-tune or switch modelsFine-Tuning, Model Selection and Multimodal
Injection, leaks, rollouts, incidentsAI Safety, Security and Production Reliability
Latency, cost, scaling the whole systemAI System Design sections
Building and debugging it in codePractical and AI-Assisted Coding
Explaining what you did and whyBehavioral, and Project Deep Dives

How to answer in the interview

For any "our AI system is doing X wrong" question:

  1. Clarify the symptom: how often, since when, which users, what changed.
  2. Ask for a failing example with a full trace.
  3. Walk the pipeline and find the first stage where the data is wrong.
  4. State one testable hypothesis and the evidence that would disprove it.
  5. Propose the fix and the regression test that keeps it fixed.
  6. Rank it against other open issues by severity.
"First I'd check whether anything changed around when this started: a model version, a prompt, the index. Then I'd want two or three failing conversations with their traces. For the stale policy, my hypothesis is that the retired article is still in the index, so I'd search the index for it directly. If it's there, that's the cause. If it isn't, and the right article is retrieved, the problem is in generation and I'd look at the prompt. Once fixed, I'd add update and delete cases to the eval set so it can't regress quietly."

Practise out loud

“Users say our support assistant is quoting last year's refund policy. How would you debug it?”

Answer out loud in about 2 minutes. In the PanelReady app you can record it and play it back.

"Switch to a better model.""Find the first stage where the data is wrong."
"Add 'only use current policies' to the prompt.""Check whether the retired article is still in the index."
Treats the leak as a quality issueCalls it a security incident, blocks release, fixes the filter in code
Fixes the bug and moves onAdds a regression test and asks why the gate missed it

Likely follow-up questions

  • How would you catch a cross-tenant leak before production? A test suite that queries as tenant A and asserts no chunk from tenant B is ever retrieved, run in CI on every change to retrieval.
  • The citations are real IDs but wrong. What do you check? Whether the supporting passage was retrieved. If not, it is a retrieval problem. If so, add a claim-versus-source check and an "I don't know" path.
  • How do you stop duplicate tool actions? An idempotency key per user action, stored with the result, so retries return the first outcome.
  • The fix for latency hurts answer quality. Now what? Measure both on the eval set, look for a setting that keeps quality within your tolerance, and route only simple questions to the faster path.
  • What would you log to make this easier next time? Request and tenant IDs, model and prompt versions, retrieved chunk IDs, token counts, timings per stage, and tool calls with their idempotency keys, without storing personal data you do not need.

Quick recap

  • Walk the pipeline and find the first stage where the data is wrong.
  • Ask for a failing example with a full trace before you guess.
  • Rank failures by severity: security first, then harmful actions, wrong answers, regressions, performance.
  • Access control lives in code, never only in the prompt.
  • Every fix gets a regression test, and every incident gets a "why did the gate miss it" question.

Practise it

  • Pick any two failures from the table and explain each in 90 seconds: hypothesis, evidence, fix, test.
  • Sketch the six-stage pipeline from memory and mark where you would log what.
  • Use this case in the next topic's diagnostic and in the assignment "Build Your Baseline and Repair Plan".
Show a worked answer for the duplicate ticket
  • Hypothesis: the client timed out and retried, and the server ran the ticket write twice.
  • Evidence: both tickets come from one user action, seconds apart, with a timeout in the client log between them.
  • Fix: an idempotency key per user action, stored with the result, so a retry returns the first ticket.
  • Test: send the same create request twice with one key and assert that exactly one ticket exists.

Sources and further reading