By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
This is a review lesson, with no new code. Take the system built across twenty-four lessons and walk a ticket through it end to end, naming what each part owns, what happens when it fails, and what a test proves. Most production incidents live in the joins — between two lessons that each looked fine on its own — so the joins are what this case study examines.
Read the diagram as a request being passed between four containers. The interesting controls are the hand-offs: edge to agent (authorisation), agent to executor (approval), and evidence back to the eval suite (learning from a bad outcome).
Write down the few paths a ticket can take. A path with no test and no trace is not designed; it is improvised, and the first failure is the design review.
| Path | What happens | Failure mode | Control |
|---|---|---|---|
| Read-only answer | Validate, look up the order or search docs, answer with citations | Invented order detail, or a retrieved passage that leaks data | Grounded prompt, citations, eval contains and safety checks |
| Write request | Model proposes, the queue stores it, a human decides, the executor acts | The model executes without approval, or a retry duplicates the write | Approval gate, executor allowlist, idempotency key |
| Escalation | The agent hands off with context and the request id | The customer repeats everything and the ticket is lost | Hand-off tool that writes the transcript and request id to the ticket |
| Retried request | The same request id arrives twice or is replayed after a timeout | A second replacement or refund is created | Dedupe on request id, idempotency key, check before retrying |
Rehearse these in staging with a revoked key, a scripted provider failure and a fixture document. The question is not "does the code raise" but "what does the customer see, and what does the on-call see?"
| Failure | Customer sees | What contains it | Test that proves it |
|---|---|---|---|
| Provider timeout | A short apology and a hand-off inside the deadline | Request deadline, fallback, degrade path | Revoked key: clean 503, health stays green |
| 429 burst | Slower replies, then a queue or a hand-off | Rate limits, backoff with jitter, burst queue | Load test at the traffic you expect |
| Injected document | Maybe a confusing answer, never a write | Allowlist, approval gate, executor validation | Injection fixture stays pending |
| Duplicate retry | One replacement, not two | Idempotency key, dedupe on request id | Replay the same request twice, assert one record |
| Stale cache | An answer quoting the old policy | Policy version in the cache key, TTL, invalidation | Change the policy fixture, assert the key changes |
| Runaway loop | A hand-off, or nothing because the cap stopped it | Step cap, model and tool call limits, budget | A scripted model that never stops hits the cap |
| PII leak | Nothing visible — the logs are the leak | Redaction boundary before logs, traces and caches | Scan test logs for the fixture email and card number |
Scaling is not one change; it is a list of assumptions that stop being true. This is the review checklist, ordered roughly by what breaks first.
| Concern | Today | Before 10x |
|---|---|---|
| Cache | A process-local InMemoryCache | A shared cache with tenant namespace and TTL; measure hit rate |
| Provider capacity | One provider with default retries | Cross-provider fallback, explicit timeouts, a load-tested queue |
| Traffic bursts | One synchronous request per turn | Queue and backpressure at the edge, per-customer rate limits |
| State | One process with in-memory memory | A shared checkpointer and thread store; no session affinity required |
| Evidence | Local logs and manual evals | Centralised traces with retention, an eval dashboard per prompt version |
| Safety | Allowlists and approvals in place | Keep them: never trade the approval gate or the allowlist for latency |
| Cost | The invoice arrives after the fact | Per-request token accounting, a daily budget alarm, cache and fallback rates on the dashboard |
| Readiness | "It worked in staging" | A load test at peak, a rollback rehearsal and an on-call runbook |
Key takeaways
Review the joins, not the parts: edge to agent owns authorisation, agent to executor owns approval, evidence to evals owns learning.
Write down every request path and its failure mode; a path with no test and no trace is not designed.
Rehearse provider timeouts, 429s, injection, duplicate retries, stale cache and runaway loops in staging before customers find them.
Before 10x, scale shared caches, fallbacks, queueing, shared state and evidence — and keep the allowlist, approval gate and budget caps exactly where they are.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.