CSE Roadmap

Core tier · about 6 hours · 4 parts

Part 2 of 4 · 11 min read

Definitions

Covers: Definitions; The debugging loop and more.

Definitions

Trace and span

  • Trace: the record of one request. Span: one step in it (a guard, retrieval, planner call, tool call or answer) with its duration, status, arguments and sizes.

Root cause

  • Root cause: the change that, if removed, makes the failure disappear. A symptom (a wrong answer) can have several, and two causes can share a symptom.

Localisation

  • Localisation: finding the first step where a failing run departs from a healthy one.

Regression case

  • Regression case: a stored failing input (or trace) that must pass after the fix and in all later versions.

Swallowed error

  • Swallowed error: a tool failure that the agent continues past as if it had succeeded.

Precision and recall of a detector

  • Precision: of the traces it flags, the share that truly have the fault. Recall: of the traces that have the fault, the share it flags.

The debugging loop

AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTo3MDM2MWJlNS1kNjliLTQxYTgtYWFjZC1lZWU4OThlMDU4NmQAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaB4y+2Kz44NACSahUNql1NYAAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDphN2FlOTA1My0xYmVlLTQyOTctODRjYy1mNDhjMzQ3MDE2Y2FscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNoKn84yzU56X2A/FkTlS6TmwAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJjdXJseC1zZWxmI2p1bWJmPWMycGEuYXNzZXJ0aW9ucy9jMnBhLm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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQHbm50sfTai53aozpaKq5K6kKpXvSFWTc8U7GwyI/PlgAuAUPORBYjyy5QJEnDGQxiNnAS8Ac6Pf4kfqdH/pwAQ=A fictional trace with a swallowed tool error, and the six-step loop to find itguard0.1sretrieval0.1splanner3.5sissue_refund0.4sanswer_llm1.3sThe tool call failed (red). The answer span then ran as if it had succeeded and the answer did not admit doubt: no later tool span, no hedge.1 ReproduceSave the exact input, tool results andmodel version. If you cannot repeatit, log more first.2 LocaliseCompare with a healthy run of the sametask and find the first span thatdiffers.3 HypothesiseList causes that predict the evidence:tool, prompt, retrieval, model,context, data.4 Test one changeChange one thing; rerun on the failingcase and on a held-out set.5 Fix and guardFix the cause, then add a check thatwould have caught it earlier.6 Keep the traceTurn the failing trace into aregression test.The loop is my own summary. Step 6 is the idea of keeping failing traces as regression tests.
A swallowed-error trace and the six-step loop.
  1. Reproduce. Store the input, retrieved documents, tool outputs, prompts and model version. Nondeterminism means one rerun proves little; repeat several times or replay stored tool results.
  2. Localise. Compare with a healthy run of the same task and find the first difference.
  3. Hypothesise. Write down at least three causes and what each predicts in the trace.
  4. Test one change. Change one variable, rerun on the failing case and on a held-out set.
  5. Fix and guard. Fix the cause; add a check earlier in the pipeline.
  6. Keep the trace as a regression case.

Results

Fault class (6,000 traces) True cases Precision Recall
Swallowed tool error 169 1.00 1.00
Retry storm (repeated failing calls) 166 1.00 (v1: 0.48) 1.00
Plan loop 177 1.00 1.00
Empty retrieval, answer not hedged 189 1.00 1.00
Bad tool arguments 189 1.00 1.00
Latency spike (k = 4) 165 0.63 0.99
Context truncation 191 0.75 1.00
Fluent wrong answer 156 n/a 0.00
Look-alike that is not a fault Traces Flagged by some rule
Plain healthy 3,416 51 (1.5%, all latency)
Transient error then a successful retry 325 3
Empty retrieval with a hedged answer 287 1
Two planning rounds 284 4
Prompt at 90 to 100% of the limit 286 73 (26%)
Latency rule threshold Precision Recall
2 times median 0.07 1.00
3 times 0.27 1.00
4 times 0.63 0.99
6 times 0.94 0.94
8 times 0.99 0.81
Localisation (first divergence equals injected span) Share
Swallowed error, plan loop, empty retrieval, bad arguments, truncation, retry storm 0.96 to 0.98
Latency spike 0.81 (15% show no divergence)
Fluent wrong answer 0.00 (92% show no divergence)
AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTpmMzlhYjk2Ni0yY2Y3LTQ3OWUtYjRlMS1mZmM5N2VhZTExNmQAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncm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AAAAAAAAAAAAAAAAAAAAAAPZYQMoJMVzcoPs2ZT+t2OC3IktlT5AjNyZ1nVahlXmzcxpuu6eflyEd1qT8lLQT7maz40ay6e1juP0YnkxC8upbxQ4=Precision and recall of seven rules on 6,000 synthetic traces (circular: I wrote the faults and the rules)Per fault class (latency k = 4)precisionrecallswallowed_error1.001.00retry_storm1.001.00plan_loop1.001.00empty_retrieval_unhedged1.001.00bad_tool_args1.001.00latency_spike0.630.99context_truncation0.751.00fluent_wrongn/a0.00Retry-storm rule v1 also fired on plan loops (their tool calls repeat too): precision 0.48. Requiring the repeats to be errors: 1.00.Failing traces flagged by any rule: 1082 of 1237. Missed class: fluent_wrong (spans all look healthy).Latency rule: choosing the thresholdk = 2P 0.07R 1.00k = 3P 0.27R 1.00k = 4P 0.63R 0.99k = 6P 0.94R 0.94k = 8P 0.99R 0.81Localising the fault: share of failing traces where the first difference from a healthy run is the injected spanswallowed_error0.97retry_storm0.96plan_loop0.97empty_retrieval_unhedged0.98bad_tool_args0.96latency_spike0.81context_truncation0.97fluent_wrong0.00
Detector scores, threshold trade-off and localisation.
  1. A rule is a hypothesis about a symptom; check its false positives.
  2. Shared symptoms hide causes: a retry storm and a plan loop both repeat tool calls.
  3. Precision depends on how common the look-alikes are: the context rule's false flags came mostly from near-limit prompts that were fine.
  4. Localisation is not diagnosis: it names the first departure, and my first label for the retry storm pointed to the second call until I noticed the first failing call was the real departure.
  5. Across eight corpora of 2,000 traces, latency precision ranged 0.59 to 0.75 and context precision 0.71 to 0.80, so quote precision with its spread.

Design rules

  • Log spans with arguments, statuses, durations, token counts and versions from day one.
  • Return structured errors from tools and never let a loop treat an error as an observation silently.
  • Compare with a healthy run before reading prompts.
  • Write rival hypotheses and what each predicts, then choose the cheapest test.
  • Change one thing at a time.
  • Read the false positives of every alert.
  • Use rules for structure and evaluations for quality; a fluent wrong answer needs a grader or a human.
  • Put every fixed failure into a regression set.
  • Bound loops and retries and alert on the bound being hit.

Interview questions, with the follow-ups

Walk me through the hardest bug you found in an agent you built.

Use the six beats. Example (fictional, built from the example trace): "Customers were told a refund was issued when it was not. I pulled traces for the complaints: the refund tool span had status error, there was no later tool call and the answer did not hedge. Compared with a healthy refund trace, the first difference was that span. Hypotheses: tool outage, bad arguments, or the loop ignoring errors. Arguments were valid and the tool was up, so the loop treated an error string as an observation. Fix: tools return structured errors, the loop stops or hands off on an error, and the answer must say so. I added the trace as a regression test and an alert on a tool error followed by a non-hedged answer." Follow-up: "How did you know it was the cause?" Changing only the error handling made the failing cases pass and the held-out set did not regress.

An agent gives a confident wrong answer and every span looks fine. What now?

"Trace rules will not see this. I would sample the failing cases, label the error type (stale data, misread tool result, hallucination), build an evaluation set from them, and use a grader plus human spot checks. Fixes could be grounding, citations, a verification step or a handoff." Follow-up: "How do you know the fix worked?" A measured improvement with an interval on a held-out set.

Your alert for slow requests fires constantly. What do you do?

"Look at the false positives. In my example a threshold of 2 times the median had 7 percent precision; at 6 times it was 94 percent with 94 percent recall. I would pick the threshold by the cost of missing a spike against the cost of a review, and alert on a rate over a window rather than single spans." Follow-up: "What else could cause slow spans?" Provider latency, large context, retries, a cold cache.

How do you stop the same bug coming back?

"Add the failing trace to a regression corpus, add a guard that catches the pattern earlier, and monitor the rate. Keep good traces as golden paths too." Follow-up: "What if the trace contains personal data?" Redact or synthesise before storing it.

Common mistakes

  • Reading prompts first before looking at the trace.
  • Changing several things at once.
  • Blaming the model without checking tool outputs and context.
  • Alerting on a rule without checking its false positives.
  • Fixing the one failing case and not testing on a held-out set.
  • Not storing the failing run, so it cannot be replayed.
  • Telling a bug story with no evidence, only the conclusion.
  • Treating a retry as harmless: it hides errors and adds tail latency.

What the example does not do

  • No real logs: the faults are injected, one per trace, with clean labels.
  • No overlapping causes: real failures often have two causes at once.
  • Circular scoring: the detector recall is about my own definitions.
  • Rules only: no model-based grading, so quality faults are invisible.
  • Simple localiser: it compares against one canonical healthy trace; real systems have many valid paths.
  • Optional experiment (I did not run this): take 20 real failing runs from your own agent, label each by hand, then see how many of your labels a trace rule could have found.

Check yourself

How do you answer "walk me through the hardest bug you found in an agent you built"? (Six beats: symptom, how you reproduced it, how you localised it, the hypotheses you tested, the cause and fix, and what you changed so it cannot recur.)

For the curious Rules catch structural faults, not fluent wrong answers

On my synthetic traces, seven simple rules reached recall near 1.00 on six fault classes, but 0 of 156 fluent-wrong answers, because every span looked healthy. That needs an evaluation, not a trace rule. Precision is where rules hurt: my first retry-storm rule had precision 0.48 because plan loops also repeat tool calls; requiring the repeated calls to be failures raised it to 1.00. The traces, faults and rules were all written by me, so the recall figures are circular.

What you will use daily at work

Practice What it looks like
Start from the trace Spans, tool arguments and statuses.
Compare a failing run with a healthy one Report the first span that differs.
Turn each fixed failure into a test Keep the trace as a regression case.
Read your false positives They show which causes share a symptom.

Draft: confirm which tracing tool your team uses and what it records, so your debugging story names real spans and logs.

What you must be able to say (one page)

  • The interview question is "walk me through the hardest bug you found in an agent you built." Answer in six beats: symptom, how you reproduced it, how you localised it, the hypotheses you tested, the cause and fix, and what you changed so it cannot recur. The six-step loop is my own summary.
  • Agent failures are quiet. A tool succeeds but cascades errors, an LLM output sounds fluent yet misleads, or a plan partially works but misses the goal. These rarely crash the system, so production observability is not optional. The uneven success pattern is sometimes called a jagged frontier: similar-looking tasks succeed or fail unpredictably.
  • Everything starts with a trace. With structured events you can tell whether a failure was a reasoning error, a tool call failure or an agent coordination issue, and re-evaluate any past run from its logged events. Without spans, tool arguments and statuses, you are guessing.
  • Localise before you theorise. I compared each failing synthetic trace with a healthy run of the same task and reported the first span that differs. It named the injected span in 96 to 98% of cases for six fault classes and 81% for latency spikes (noise hides some). It cannot localise a fluent wrong answer (0%, since every span looks healthy), which needs an evaluation, not a trace rule.
  • Rules catch structural faults, not quality faults. Seven simple rules reached 1.00 recall on six fault classes and 0.99 on latency spikes in my synthetic corpus (circular: I wrote both the faults and the rules). Recall on fluent-wrong answers was 0 of 156, and 1,082 of 1,237 failing traces were flagged by at least one rule (87%); the unflagged ones were the fluent-wrong class.
  • Precision is where rules hurt. The latency rule at 4 times the median had precision 0.63; the context-limit rule 0.75 (benign near-limit prompts trigger it: 26% of them were flagged). A first version of my retry-storm rule had precision 0.48 because plan loops also repeat tool calls; requiring the repeats to be failures raised it to 1.00. Read your false positives; they tell you which two causes share a symptom.
  • A threshold is a trade-off. Latency precision/recall at 2, 3, 4, 6, 8 times the median: 0.07/1.00, 0.27/1.00, 0.63/0.99, 0.94/0.94, 0.99/0.81. Choose by the cost of a missed spike against the cost of reviewing a false alert.
  • Change one thing, then confirm on a held-out set. A fix that works on the failing trace may hurt others; rerun your evaluation set and report the change with an interval (module 9 of level 13).
  • Turn failures into tests. Export failure traces into the test suite as a regression corpus, so that once a fix is in, rerunning the trace should pass. Keep exemplar successes as golden paths too.
  • Look at the data. Fifteen minutes of reading real traces often saves hours; read twenty failing traces before building tooling.
  • Honest limits: the traces are synthetic, the fault list is mine, the detectors are simple rules, and a real production bug is messier (several causes at once, missing logs).