Agentic AI System Design / Before the scenarios
How to Think Under Pressure
Whether you are leading a post-mortem at 2 a.m. or standing at a whiteboard in a system design interview, the cadence of senior engineering is the same: frame the boundary, reject the naive trap, defend the trade-off, and predict the breaking point. Every scenario in this book is a different system failing in a different way, but the thinking that solves them does not change. This chapter gives you that thinking up front, so that a few scenarios in, it runs on its own.
Behavioral vs. structural fixes
When an AI system misbehaves, there are two kinds of fixes.
A behavioral fix asks the system to act differently: a stricter prompt, more examples, a bigger model, a polite instruction not to do the dangerous thing. A structural fix changes what the system can do: removing a tool, splitting a step, constraining an output grammar, adding a gate that no model output can bypass.
Behavioral fixes are cheap, fast, and usually the first idea in the room. They are not wrong. But they are probabilistic: they work most of the time, and production runs long enough to find the rest of the time. Structural fixes are what make a failure impossible rather than unlikely.
Instructions are behavioral. Architecture is structural.
When the stakes are real, reach for structure.
This does not mean prompts never matter. Many scenarios end with better prompts inside a better structure. The mistake is reaching for a behavioral fix to solve a structural problem.
The eight pressures
Every scenario is tagged with the pressures acting on it. Real systems rarely face just one, and most hard decisions trade one pressure against another.
| Cost | Dollars per request, per task, per month. |
| Latency | Time to first token, time to finish, and the tail (p95, p99). |
| Quality | Whether one output is accurate, grounded, and actually useful. |
| Reliability | Whether it keeps working: across runs, steps, changes, and time. |
| Scale | What happens at 10× the traffic, data, or tools. |
| Safety | What the system damages when it is honestly wrong: its blast radius. |
| Security | What it damages when someone is trying: injection, exfiltration, abuse. |
| Compliance | What you must be able to explain, retain, delete, or prove. |
The pressure loop
Strong answers, in interviews and in incidents, follow the same six moves. The four stages of every scenario are built around them.
- Clarify the envelope. Before designing anything, pin down volume, latency budget, cost ceiling, and what failure costs. Most weak answers are good answers to the wrong question.
- Separate symptoms from causes. List what is going wrong, then trace each symptom to the design decision that allowed it.
- Classify the cause. Is this behavioral or structural? If a smarter model with the same design would fail the same way, it is structural.
- Make the fewest structural changes. Two or three decisions that remove root causes beat ten patches that chase symptoms.
- Price every decision. Every fix costs latency, money, complexity, or autonomy. Say what you are paying.
- Break your own design. Name where it fails before someone else does. This is the move that separates senior engineers from everyone else.
Napkin math cheat sheet
You do not need exact numbers to design well, but you need the right order of magnitude, fast. These rules of thumb appear throughout the book. Prices are deliberately left out: they change monthly, and the formulas do not.
How you are being scored
Interviewers rarely grade the final diagram. They grade the reasoning that produced it, and the same signals appear in every Evaluator’s Lens in this book:
If you are not interviewing, read the same ladder as a map of what the next level of answer looks like on your own team.
Notice what is missing: nobody is scored on knowing the newest model or the trendiest framework. Vocabulary gets you into the room. Judgment gets you the offer.
The four stages of every scenario
- 1
The Setup & Tipping Point. You are dropped into an incident, a hard deadline, or an architectural fork, always anchored to a concrete artifact: a log trace, a billing spike, a malformed payload, a saturated memory profile.
- 2
Digest & Disarm. At the Pause Point, stop and write down what you would ask. Then compare it with the questions worth asking first and the team’s answers (in an interview, the team is your interviewer), watch the tempting fixes get disarmed (Not Enough, or Wrong), see what the problem really is and is not, and trace each symptom to its structural cause in the Root-Cause Map.
- 3
The Pro Architecture. Two or three decisions, each tied to the root cause it removes, with the numbers (Napkin Math), the price (Trade-off), and the one rule to keep (Senior Take).
- 4
Beyond: The Signal Ladder and Stretch Round. The Evaluator’s Lens shows how Mid, Senior, and Staff+ responses diverge on the same problem. The Bonus Round adds interviewer curveballs, such as a 10× traffic surge or a zero-retention mandate, and an honest look at where even the recommended design reaches its limit.
Above the title, the scenario’s number is followed by the system it is about. Under every scenario title sit two markers. The difficulty meter shows how hard the problem is, from to . No scenario in this book is rated one out of four: nothing here is easy, and pretending otherwise would be misleading. The meter rates the problem; the Evaluator’s Lens, later in each scenario, rates the answer. The outlined pressure tags, such as CostSafety, name the forces acting on the system. Tags run from the dominant pressure to the lesser ones, and the stronger the tint, the more that pressure drives the scenario. Within each chapter, scenarios run from easier to harder; if a topic is new to you, start with its first scenario.
The boxes
Six boxes, each with exactly one job. Cards hold analysis you study; badges mark the moments when the book steps outside the flow to tell you to stop, remember, or stretch.
| Pause Point | Badge | Stop. Write down what you would ask and sketch a design. |
| Napkin Math | Card | Back-of-the-envelope numbers: tokens, memory, latency, dollars. |
| Trade-off | Card | What a decision costs, and when you would choose differently. |
| Senior Take | Badge | The one rule worth remembering when the pressure spikes. |
| Evaluator’s Lens | Card | What separates a Mid, Senior, and Staff+ answer. |
| Bonus Round | Badge | Curveballs, scale jumps, and where the design itself breaks. |
Inside the text, outlined uppercase tags name agents (Writer), and gray chips name the tools they call (search_filings).
The plain gray panel with a file-name tab is not a callout. It is the exhibit: the log, invoice, or trace you reason from in the Setup.
Do not read this book passively. Pause when prompted, sketch before you read the answer, and test your instincts against the curveballs. The gap between your first answer and the one on the page is exactly what this book is trying to close.
Diagnose before you design. Price before you promise.
Break it before production does.
Now try it on a real failure
Start with Scenario 1.2, and stop at the Pause Point to sketch your own answer first.