A free playbook, as a PDF and an EPUB

The LLM guardrails playbook

Least privilege, input and output checks, tool-call validation and red-team tests for a support agent that can refund and email.

The PDF opens in a new tab. Your details go to learnwithparam only. This does not subscribe you to the newsletter.

Look insidePages from the PDF, as they print.

  1. Page 2: Contents
    Page 2: Contents
  2. Page 3: Every guardrail sits between Acme's agent and something it reads or touches.
    Page 3: Every guardrail sits between Acme's agent and something it reads or touches.
  3. Page 23: By default an input guardrail races the agent, so a refund can run first.
    Page 23: By default an input guardrail races the agent, so a refund can run first.
  4. Page 34: In agent/guards/tools.py every tool call spends from a budget for its ticket.
    Page 34: In agent/guards/tools.py every tool call spends from a budget for its ticket.
  5. Page 54: Track the false positive rate next to the block rate, or the gate rewards blocking everything.
    Page 54: Track the false positive rate next to the block rate, or the gate rewards blocking everything.
  6. Page 65: Decide for each check whether it fails closed or open, before it fails.
    Page 65: Decide for each check whether it fails closed or open, before it fails.

What the playbook covers

  1. 1

    The guardrails between a ticket and a refund

    Acme Inc's support agent, the four things it touches, and where each guardrail sits. Read the map once, then build it one chapter at a time.

  2. 2

    Map the failures and baseline the agent

    Step 1 on the map. Acme lists where attacks enter, writes tickets for each, and runs them against the demo agent for the number every later chapter must beat.

  3. 3

    Cut what the agent is allowed to do

    Step 2 on the map. The order-note attack from the baseline works because the demo agent can refund any amount and email any address with one shared key. Acme narrows each tool so the same attack has nothing to grab.

  4. 4

    Screen tickets and tool results before the agent acts

    Step 3 on the map. Acme screens what goes into the model: every ticket before the agent starts and every tool result before the model reads it. The screen reduces attacks; it never replaces chapter 3.

  5. 5

    Check every tool call before it runs

    Step 4 on the map. A screened ticket can still lead the model to a wrong refund, by mistake or by an injection the screen missed. Acme checks each refund and email call against the order, the customer and its own limits before the tool runs.

  6. 6

    Check the reply before the customer sees it

    Step 5 on the map. Acme checks each reply against what the tools returned, rewrites once with no tools, then falls back to a template.

  7. 7

    Turn the red-team set into a CI gate

    Step 6 on the map. Acme runs the red-team set against staging on every pull request and fails the merge when the rates move.

  8. 8

    Give the guardrails an owner in production

    Step 7 on the map. Attacks keep coming after launch and each guard will fail in some way. Acme decides how each check fails, logs every verdict, writes a runbook and names an owner who reviews it every week.

  9. 9

    The page to keep

    Every step on the map in one line each, with the file it lives in.

Keep it on your deskIt comes with a one-page cheatsheet to print and pin up.

Get the playbook