In this lesson, you measured the held request from Place Guardrails Around the Stream and the Cache like a feature: what it lets through, what it wrongly blocks, how long hikers wait for the first words, and what its judge costs.
Key Points
- Recorded runs, December 2, 2026. Every number below comes from them, on OpenAI, through the request as Place Guardrails Around the Stream and the Cache leaves it: input moderation before the call, the answer held,
gate()with the checks span, and the eight-second deadline from Set a Time Budget. - Two kinds of cases. Thirty hiker questions in four languages got real answers in four runs, and all 120 answers were read and labeled right, so they must pass. Twelve wrong answers must be stopped: the seven from Check Answers in Code, the injected “open and safe” answer, and four more that state what no report says. They ran three times, for 36 cases. Every case went through the held request, eight-second deadline and all, in a replay with short answers and no beds lookups, which is lighter than the full app. Each run wrote one record per case to a results file: its case, its failed checks, any error, whether the deadline cut it, and its two times.
- The script reads that file. A case was blocked when its list of failed checks isn’t empty.
- A false negative is a wrong answer the gate lets through. Here, positive means the guardrail fired. None of the twelve got through, in any run. Twelve handwritten answers is a small set, though. Zero means none of these got through. A wrong answer you didn’t write still could.
- A false positive is a right answer the gate blocks. With the judge’s three-second limit, it blocked 88 of 120. Fifteen were right answers saying there’s no report, blocked for words like “open” or “storm”. Seventy-two waited on a judge that took longer than three seconds, and one hit the deadline. All 88 hikers got the latest reports instead.
- One run can’t give you the rate. The judge’s timeouts ranged from 10 to 22 per run of thirty.
- Holding the stream moves the first words. Streamed, half the answers in this replay would start within a second and 95 percent within 1.4. That includes input moderation before the call, about a tenth of a second on OpenAI’s free endpoint. On Anthropic, moderation is a billed call to the fast model, for the question and again for the answer, so time and price both there. Held, the hiker sees nothing until the whole answer and its checks are done: p50 4.7 seconds, p95 6.1.
- A longer judge limit trades one number for another. At six seconds, still none of the twelve got through. The word checks stop half the 36, and the judge’s own fail verdict stopped the other 18. At three seconds, the timer had stopped three of those. Wrongly blocked fell to 19 of 120. Seventeen were for words, a few more than before, since every run gets fresh answers. Two were cut by the deadline. But the held p95 grew to 7.0 seconds.
- The judge costs too: about 50 cents per thousand questions, half what the answers cost, at either limit, since a timed-out call is still billed. Moderation is free on OpenAI. On Anthropic, it’s a fast-model call per question and per answer.
- The decision, and where it holds. On this replay, six seconds wins. It blocks 19 right answers instead of 88, and the p95 stays under eight seconds. But the full app is slower: its whole answers reach 6.4 to 6.9 seconds at the p95 in Make Answers Feel Fast. And in one of the three-second runs, most judge calls took over six seconds to finish. On the full app, more answers may hit the deadline, and each one is another wrong block. So rerun these cases there, on your provider, before you ship. Then watch the first words’ p95, the blocks per check, and the judge timeouts in your traces.
- The rule: measure a guardrail like a feature. Count what it lets through and what it wrongly blocks, time the wait it adds, and price its calls, on cases that must pass and cases that must stop, more than once.
Final Code
Save this as scripts/guard-evals.js. It reads a results file, given as its argument, with one record per case run. A record’s cut is true when the eight-second deadline cut the answer. percentile() is the same as in scripts/latency.js: