Defense in depth places multiple inspection points across an AI assistant’s request lifecycle, so one missed threat or invalid action does not directly produce an unsafe outcome. The architecture validates user input at the gateway, checks tool arguments between the model and tools, and filters responses before delivery. section 10.7
Apply the pattern at three distinct control boundaries:
- Input validation detects prompt-injection attempts, classifies topics, and blocks or redirects requests outside the assistant’s domain. section 6.7.1
- Tool argument validation checks schemas, required fields, ranges, dates, authenticated identities, and resource existence before execution. section 6.7.1
- Output filtering inspects the model’s response before returning it and records applied safety filters. section 10.7
Constrained assistant actions
A calendar tool rejects events whose timestamps are in the past, while a ticket-creation policy limits activity within a session. Separately, a topic policy blocks medical, legal, financial-trading, and personal-relationship requests before they reach the main model. section 10.7
Figure 10.7 Adding guardrails. Safety policies validate inputs, tool arguments, and outputs at multiple points in the request flow.

Trace how input, tool-call, and output controls are positioned across the request flow. section 10.7










