Chapter 7: Guardrails
Put guardrails in code, not in the prompt.
- Argument checks. Reject a
minutesvalue outside 1 to 1440 before the tool runs. Return the error text to the model. - Allowlist. Each agent has a fixed set of tool names. Reject any other name.
- Loop detection. Count each tool name plus arguments. Stop when one key repeats three times.