← manishpande.in Contents
Reference architecture · 2026 The Agentic Platform by Manish Pande
© 2026 Manish Pande Mumbai, India Set in Space Grotesk · Source Serif 4 · JetBrains Mono
TRUST · Safety & Guardrails Chapter 16

Guardrails, Safety & the Lethal Trifecta

Identity and authorization decide what an agent is permitted to do. Guardrails decide what it actually does within those permissions — filtering harmful inputs and outputs, and defending against the adversary who will try to turn your helpful agent into their tool. The defining security insight of the agentic era has a name, and every architect must internalize it: the lethal trifecta.

16.1 Guardrails as a control layer

A guardrail is a check that sits around the model, inspecting what goes in and what comes out and intervening when policy is violated. Input guardrails screen for prompt-injection attempts, off-topic or disallowed requests, and PII that shouldn't be processed. Output guardrails screen generated text and — critically — proposed actions before they execute: blocking toxic or non-compliant content, validating that a tool call is permitted and well-formed, and catching attempts to leak data. Guardrails are deterministic policy wrapped around a probabilistic core (Chapter 2's founding move), and they belong in the request path, not in a dashboard reviewed after the fact.

user input input guardrailinjection · PIItopic model output guardrailtoxicityleakage user output action / tool-call guardrailpermitted? well-formed?+ policy PDP (Ch.16) tool / sandbox (Ch.9) proposed tool call if allowed tool / retrieved result = untrusted content → re-screen
Fig 16.1 · Defense in depth. Guardrails are gates in the request path. User input clears an input guardrail before the model; the model's proposed tool calls clear an action guardrail and the policy engine (Ch. 17) before anything runs in a sandbox (Ch. 9); generated text clears an output guardrail before reaching the user. Critically, tool and retrieved results re-enter as untrusted content and are re-screened — they are data, never commands (Ch. 811).

16.2 The lethal trifecta

The central security hazard, articulated by Simon Willison, is that catastrophic risk emerges when an agent combines three capabilities at once. Each alone is benign; together they are exploitable.

Untrustedcontentweb · email · docs Privatedatasecrets · user PII External communicationability to send data out exfiltration
Fig 16.2 · The lethal trifecta. When an agent simultaneously (1) ingests untrusted content, (2) has access to private data, and (3) can communicate externally, a prompt injection hidden in the untrusted content can instruct the agent to read the private data and send it to the attacker. Remove any one capability for a given action and the attack collapses.

The attack is concrete: a malicious instruction is hidden in a web page, email, or document the agent reads (untrusted content); that instruction tells the agent to gather sensitive information it can access (private data) and transmit it somewhere — an HTTP request, an email, a tool call (external communication). Because the model cannot reliably distinguish data it should process from instructions it should obey, it complies. This is indirect prompt injection, and there is no known way to make a model immune to it. The architectural response is therefore not "prompt the model to refuse" but to ensure the three capabilities are never simultaneously available for a sensitive operation — segregate trust domains, strip or sandbox untrusted content, and deny external egress on any path that has touched private data (echoing the sandbox egress rule of Ch. 9).

First principle · Break the trifecta, don't trust the model to resist it

You cannot reliably instruct a model not to be injected. Security must be structural: for any action, ensure at most two of {untrusted input, private data, external communication} are present. Treat all retrieved and tool-returned content as untrusted data — never as commands (Ch. 8, 11).

16.3 The guardrail toolkit

Table 16.1 — Guardrail types and placement
GuardrailWhereDefends against
Prompt-injection / jailbreak detectionInput + on retrieved contentHijacking the agent's instructions
Content moderationInput + outputToxic, illegal, or policy-violating text
PII detection & redactionInput + outputProcessing or leaking personal data
Action / tool-call validationBefore executionUnauthorized, malformed, or destructive actions
Output schema & grounding checksOutputMalformed structure; hallucinated, ungrounded claims
Topical / relevance boundsInput + outputOff-purpose use, scope creep

Frameworks such as NVIDIA NeMo Guardrails, Guardrails AI, and Llama Guard provide ready components; the gateway (Ch. 6) and policy engine (Ch. 17) are natural places to enforce them centrally so every agent inherits the same protections.

Hazard · Guardrails are layers, not a wall

No single guardrail is sound against a determined adversary; classifiers can be evaded and validators have gaps. Treat guardrails as defense-in-depth combined with the structural protections of §16.2, least privilege (Ch. 15), and human approval for high-consequence actions (Ch. 5). Assume each layer will sometimes fail and design so that one failure isn't catastrophic.

· · ·