01Chapter 1: Why LLM applications need guardrailsA language model produces text that looks plausible. It does not guarantee that the text is safe, correct, or in the format your program expects. A guardrail is a check that runs around a model call and decides whether an input or an output may continue. This chapter explains why you need them and p3 min read
02Chapter 2: What can go wrong with inputs and outputsThis chapter assumes you can write basic Python with functions and regular expressions, have called an LLM through an API or SDK, know what a system prompt is, and can read JSON. It names the risks that guardrails address. Later chapters cover how to check for each one.3 min read
03Chapter 3: Where checks go: before and after the model callThis chapter assumes you can write basic Python, call an LLM through an SDK, and read JSON. You should also know what a system prompt is. Here you will learn where guardrail checks sit around a model call and what each position can and cannot catch.2 min read
05Chapter 5: Detecting and redacting personal dataThis chapter assumes you can write Python functions and regular expressions, and that you have seen where input and output checks sit around a model call. Here you build a deterministic check for personal data (PII, personally identifiable information) and learn where it breaks.3 min read
06Chapter 6: Reducing the impact of prompt injectionThis chapter assumes you can write basic Python with regular expressions, call an LLM through an SDK, and know what a system prompt is. It also assumes you have read the chapters on guardrail placement and rule-based checks.2 min read
07Chapter 7: Validating structured outputThis chapter assumes you can write basic Python, read JSON, and call an LLM through an SDK. You should also know where input and output checks sit around a model call, and you should have seen simple rule-based checks.3 min read
08Chapter 8: Classifier and moderation modelsThis chapter assumes you can write basic Python, call an LLM through an SDK, and read JSON. It also assumes you know the deterministic checks from the earlier chapters: length limits, regular expressions and allowlists.2 min read
09Chapter 9: Using an LLM to judge another LLM's outputAn LLM judge is a second model call that reads the first model's output and returns a verdict. This chapter covers when a judge is worth using, how to build one, and where it fails.3 min read
10Chapter 10: Checking answers against source materialThis chapter assumes you can write basic Python, call an LLM through an SDK, and read JSON. It also assumes you know the earlier chapters on rule-based checks and LLM-as-judge checks.2 min read
11Chapter 11: What to do when a check failsThis chapter assumes you can write basic Python, call an LLM through an SDK, and read JSON. It also assumes you have seen the deterministic input and output checks from earlier chapters. A check that never fires is easy to build. The harder question is what your application does when a check does fi3 min read
12Chapter 12: Latency and cost of guardrailsThis chapter assumes you can write basic Python and call an LLM through an SDK. You should also know where input and output checks sit around a model call. Every guardrail adds time and sometimes money, so you need to decide which checks are worth their price.2 min read
13Chapter 13: Measuring false positives and false negativesThis chapter assumes you can write basic Python and have seen rule-based and model-based checks from earlier chapters. A guardrail is a classifier: it labels each input or output as "allow" or "flag". You can't tell whether it works without counting how often it is wrong.2 min read
14Chapter 14: Logging and monitoring guardrail decisionsThis chapter assumes you can write basic Python, call an LLM through an SDK, and read JSON. It also assumes you know the input and output checks from earlier chapters. Here you will record what each guardrail decided, so you can see how it behaves in production and catch problems early.2 min read
15Chapter 15: Layered defense and the limits of guardrailsThis chapter assumes you have read the earlier chapters on input and output checks. You should know basic Python, how to call an LLM through an SDK, and how a JSON validator works. Here we put the pieces together and look at what they cannot do.2 min read