PrepGenAICerts

Layered Guardrails & Defense in Depth

Core

Design layered guardrails and safety controls for production Claude systems · Difficulty 2/5

0%
guardrailsdefense-in-depthsafety-controlslayered-security

Explanation

Making a Claude system safe in production means engineering safety into the system around the model with layered, defense-in-depth controls -- not delegating it to a single prompt. No individual layer is assumed to be perfect; the layers are independent so that one failure does not become catastrophic.

The Five Layers

LayerControl
InputValidate and sanitize input; separate trusted instructions from untrusted data; classify/filter disallowed requests
PermissionsLeast privilege on tools and data; scope what the agent can do
Deterministic controlsHooks and permission rules that fire in code -- e.g., a PreToolUse hook that blocks a destructive action every time, regardless of what the model "decides"
OutputValidate and constrain output; check for policy violations and data leakage before it leaves
MonitoringLog and alert on anomalous or unsafe behavior

Why Layering Matters

Each layer covers a different failure surface. Input filtering can miss a novel injection pattern; if it does, least-privilege permissions limit what a compromised turn can actually do; if a policy-violating tool call still gets attempted, a deterministic hook blocks it outright; if something slips through anyway, output validation and monitoring catch it before or after the fact. Removing any one layer does not collapse the whole system -- that is the point of defense in depth.

Common exam traps

  • "Put the safety rule in the system prompt." Prompts guide behavior probabilistically; for a hard limit, use a deterministic hook/permission control instead.
  • Relying on one layer. Guardrails are layered -- input filtering *and* least privilege *and* output validation *and* monitoring, not any single one of these alone.

Key Takeaways

  • Guardrails are layered: input, permissions, deterministic controls, output, and monitoring
  • No single layer is assumed to be perfect -- layers are independent so one failure isn't catastrophic
  • A PreToolUse hook is a deterministic control that blocks a destructive action every time
  • Exam trap: a single strong system prompt is not a substitute for layered controls

Glossary Terms

Related Concepts

PrepGenAICerts is an independent exam-prep site. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. Claude and Anthropic are trademarks of Anthropic, PBC. Exam details are taken from publicly available Anthropic and Pearson documentation. About PrepGenAICerts.