← Engineering notes
Security & guardrails · Advisory note

Put guardrails where the model cannot bypass them

A safety rule written inside a system prompt is a suggestion the model can ignore under pressure. A guardrail built into the surrounding workflow cannot be skipped. Here is what a production guardrail architecture looks like, and why every check needs an explicit failure policy agreed before launch.

For: CTOs, heads of product, trust & safety, legalRelated engagement: AI Reliability Audit, Agent MVP

What your risk reviewers will ask

Once an agent can execute actions such as issuing a credit, updating an account or sending customer communications, its failures carry real financial and legal consequences. Before Trust & Safety, Legal or InfoSec sign off on a launch, they will ask a simple question: what stops the system from paying out an invalid claim, leaking another user’s data or treating two identical cases differently?

Pointing to the model vendor’s built-in safety alignment will not pass review. Vendor alignment is opaque, unconfigurable and subject to silent shifts whenever the provider updates weights, which means it cannot serve as your primary compliance control.

Five ways prompt-only safety fails

Every failure below bypasses instructions written in the system prompt because untrusted user input and untrusted tool output share the exact same context window as your rules.

SCENARIOWHAT HAPPENSWHY THE PROMPT FAILS TO STOP IT
Direct prompt injectionThe agent overrides its operating policySystem instructions and user text sit in the same token stream
Social-engineered PII requestA customer record is disclosed in chatThe system prompt says “never share”; the user’s framing convinces the model an exception applies
Indirect injection via retrieved recordsThe agent executes instructions hidden inside a ticket or documentTool output is injected into context as trusted text
Angry legitimate customerA high-value customer is wrongly blocked by a blunt filterA single toxicity threshold cannot distinguish frustration from an attack
Over-limit payoutMoney leaves the accountThe monetary cap was described in prose instead of enforced on the server

Build guardrails as deterministic workflow steps

We design guardrails as mandatory code stages around the model. When every request and tool call must pass through deterministic middleware, the agent has no path around the control.

  1. Run input gates in a fixed sequence before the model is called. Execute PII redaction (redact and continue), prompt-injection classification (fail closed), toxicity screening (route angry customers to a human agent) and topic bounds (fail open and log).
  2. Place an unavoidable output gate on the return path. Every response and tool payload passes through schema, PII and policy validation before reaching the user or downstream API.
  3. Enforce monetary and permission limits inside the tool server. The microservice executing the refund or database write checks caller entitlement and caps directly.
  4. Separate risk scoring from enforcement. Let models or classifiers produce risk scores, and let deterministic application code decide what action is allowed.
  5. Write an explicit failure policy for every check. Agree with Trust & Safety before launch whether each guardrail fails closed, fails open with logging, redact-and-continues or escalates to a human queue.
  6. Test demographic invariance in the same harness. Verify that identical cases with swapped customer names produce identical outcomes, as detailed in our fairness testing note.
  7. Emit a structured decision trace for every request. Log which guardrail ran, what it scored and which rule fired so any incident can be audited.

Our recommendation

Ask your engineering lead to put the system architecture diagram on screen and point to the exact component that stops a bad payout or data leak from reaching a customer. If they point to the system prompt, you do not have a guardrail yet.