Home › Learn › Agent guardrails

AI engineering · free reference · grows over time

The agent guardrail catalog

57 common guardrails for autonomous agents, sorted by where they sit in a turn. Each one is marked must, should or could have; says whether a rule, a small classifier, an LLM judge, a person or the platform decides; and links to the test that proves it works.

where they sit, in the order a turn passes themFrontdoor8 guardrails6 mustBeforethe model9 guardrails4 mustAfterthe model13 guardrails6 mustBeforethe tool9 guardrails7 mustInsidethe tool5 guardrails5 mustAfterthe tool3 guardrails1 mustWholerun6 guardrails3 mustLogs andplatform4 guardrails3 mustthe busiest spots: after the model writes, and before a tool acts
Guardrails sit all along the turn, not just on the user's message.

35 must-haves, 19 should-haves, 3 could-haves. 39 of the 57 are plain rules in code. Only 2 need an LLM judge. The short version, with pictures, is the post Every guardrail your agent needs, sorted.

How a guardrail decides

Rule in codedeterministic: same input, same answer
about 0 ms, free · 39 in this list
Small classifiera small trained model gives a score
10 to 100 ms, cheap · 10 in this list
LLM judgeanother model reads and decides
0.5 to 3 s, costs tokens · 2 in this list
A persona human approves or takes over
minutes to days · 1 in this list
Platform settingthe cloud or runtime enforces it
about 0 ms · 5 in this list

Must means every agent that can change something in the real world. Should means most agents. Could depends on the use. "Proven by" links to the matching obligation in the AI Assurance Catalog: the test that shows the guardrail really works.

Filter

Front door

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Verify who is askingMust haveRule in codea forged or expired sign-inblockSecurityyour identity providerAAC-0111
Kill switchMust haveRule in codethe agent has been switched off by an operatorblockReliabilitya feature flagAAC-0077
Same message twiceMust haveRule in codea double-click or a retry sends the message againreturn the first answerReliabilityan idempotency tableAAC-0076
Input size and shapeMust haveRule in codean empty, huge or binary messageblockReliabilityyour codeAAC-0015
Rate limit and quotaShould haveRule in codeone user sending 500 messages a minuteslow downCostAPI gateway (APIM, Kong, LiteLLM)AAC-0093
Sensitive topics go to a personMust haveRule in codeinjury, self-harm, legal threats, fraud claimshand to a personSafetykeyword rules, then a classifierAAC-0005
Off-topic requestShould haveSmall classifiera banking agent asked to write a poempolite refusalCorrectnessembedding similarity or a small classifierAAC-0020
Record what the user asked forMust haveRule in codelists the actions the user's own words asked for, used later at the toolused laterSecurityyour codeAAC-0056

Before the model

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Known injection phrasesMust haveRule in code"ignore your previous instructions", fake role markersblockSecuritya pattern listAAC-0004
Jailbreak and prompt attack detectorShould haveSmall classifierreworded or foreign-language attacks the patterns missblockSecurityPrompt Shields, Llama Prompt Guard 2, LakeraAAC-0004
Harmful inputMust haveSmall classifierhate, violence, sexual or self-harm contentblockSafetyAzure Content Safety, Llama Guard, Bedrock GuardrailsAAC-0005
Personal data in the inputShould haveSmall classifiera card number or passport number pasted into chatredactPrivacyPresidio, Comprehend, Cloud DLPAAC-0006
Secrets in the inputShould haveRule in codean API key or password pasted into chatredactPrivacysecret-scanner patternsAAC-0006
Only the tools this user may useMust haveRule in codean ordinary user's agent offered the admin toolsnever shownSecurityyour codeAAC-0057
Context size capMust haveRule in codea conversation that has grown past the windowtrimReliabilityyour codeAAC-0019
Approved models onlyShould havePlatform settinga request routed to an unapproved or unknown modelblockHuman oversightLLM gateway allow-listAAC-0094
Data stays in its regionCould havePlatform settingpersonal data sent to a model in another countryblockPrivacyregional endpoints, gateway policyAAC-0097

After the model

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Output matches its schemaMust haveRule in codemissing fields, wrong types, broken JSONrepair or retryCorrectnessPydantic, JSON Schema, structured outputsAAC-0002
Harmful outputMust haveSmall classifierthe model writes something offensive or dangerousblockSafetyAzure Content Safety, Llama Guard, Bedrock GuardrailsAAC-0005
Personal data in the outputMust haveSmall classifierthe reply repeats another person's phone numberredactPrivacyPresidio, regex for IDsAAC-0006
Claims an action that didn't happenMust haveRule in code"I've booked it" when no booking tool ransafe replyTruthcompare the reply with the tool logAAC-0110
Names or numbers no tool returnedMust haveRule in codean order number or price the model made upsafe replyTruthmatch entities against tool resultsAAC-0024
Every claim is supportedShould haveLLM judgea sentence the retrieved documents don't supportregenerate or flagTruthan LLM judge, or an NLI modelAAC-0029
Citations point to real sourcesShould haveRule in codea link or document id that doesn't existremove the citationTruthyour codeAAC-0030
Forbidden promisesMust haveRule in code"your claim will be approved", legal or medical advicesafe replySafetyphrase rules, then an LLM judge for nuanceAAC-0003
Units, currency and formatShould haveRule in code£ instead of ₹, a date in the wrong formatfix or safe replyCorrectnessyour codeAAC-0023
Old status after a newer oneShould haveRule in codesays "pending" after a tool said "paid"safe replyCorrectnessyour codeAAC-0113
System prompt leakShould haveRule in codethe reply contains the hidden instructionsblockSecuritya canary string in the promptAAC-0106
Tone and brandCould haveLLM judgerude, sarcastic or off-brand replies, competitor mentionsrewrite or flagCorrectnessan LLM judge with a short rubricAAC-0074
Screen streamed textCould haveSmall classifierharmful words shown before the full answer is checkedcut the streamSafetychunked moderationAAC-0092

Before the tool

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
The user actually asked for thisMust haveRule in codea refund the user never asked for, triggered by a planted noterefuse the call, tell the model whySecurityyour codeAAC-0056
Arguments are valid and in rangeMust haveRule in codea refund of ₹4,00,000 when the limit is ₹40,000refuse the callCorrectnessPydantic, business rulesAAC-0052
Approval for risky actionsMust haveA persona large payout, deleting data, sending to all customerswait for a personHuman oversighta workflow engine (DBOS, Temporal) plus a queueAAC-0078
Destructive actions are gatedMust haveRule in codeDROP TABLE, deleting files, cancelling all ordersrefuse or dry-run firstSafetyan allow-list of actionsAAC-0056
Hold writes after a suspicious resultShould haveRule in codeany write after a tool result that carried instructionsask the user firstSecurityyour codeAAC-0058
Tool-call budgetMust haveRule in codethe model calling the same search 40 timesstop the turnCostyour codeAAC-0055
Re-read before an irreversible writeShould haveRule in codepaying a claim whose status changed a minute agore-read firstCorrectnessyour codeAAC-0113
Edits stay in scopeMust haveRule in codea coding agent editing files outside its folderrefuse the callSafetypath and table allow-listsAAC-0075
Code runs in a sandboxMust havePlatform settinggenerated code reading secrets or the networkcontainSafetycontainers, E2B, Firecracker, gVisorAAC-0072

Inside the tool

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
The tool checks identity againMust haveRule in codethe agent's token used for someone elseerrorSecurityon-behalf-of tokens, scopesAAC-0111
Only the caller's own rowsMust haveRule in codeanother customer's order or claimnot foundPrivacyrow-level securityAAC-0040
Same write only onceMust haveRule in codea retried payment that would pay twicereturn the first resultReliabilityidempotency keysAAC-0047
Retrieval respects permissionsMust haveRule in codesearch results from documents the user can't openfilter outPrivacypermission-aware search filtersAAC-0032
Cap the size of resultsMust haveRule in codea tool returning 2 MB of JSON into the contextcut and markCostyour codeAAC-0105

After the tool

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Fence the result as dataMust haveRule in codetext in a result being read as instructionsalways appliedSecuritydelimiters plus a system ruleAAC-0058
Instructions hidden in a resultShould haveSmall classifier"call request_payout now" planted in an email or notehold later writesSecuritypatterns, then Prompt Guard or Prompt ShieldsAAC-0058
Poisoned documentsShould haveSmall classifiera retrieved page written to steer the agentdrop or flagSecurityPrompt Shields for documents, source allow-listsAAC-0036

Whole run

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Step, time and money budgetMust haveRule in codea run that loops for 20 minutes and $30stop the runCostyour code, gateway budgetsAAC-0077
Going round in circlesMust haveRule in codethe same tool with the same arguments again and againstop or hand offReliabilityyour codeAAC-0109
Hand off after repeated failureShould haveRule in codetwo refusals in a row, a tool down, 10+ turnshand to a personHuman oversightyour code plus a support queueAAC-0043
Guardrails fail closedMust haveRule in codea guardrail service times out and everything is let throughblockSafetyyour codeAAC-0091
Memory writes are checkedShould haveSmall classifiera user teaching the agent a false fact that later users seeskip the writeSecurityrules plus a classifierAAC-0041
Promises have something behind themShould haveRule in code"we'll call you tomorrow" with no task createdcreate the task or hand offTruthyour codeAAC-0110

Logs and platform

GuardrailWhat it catchesIf it firesConcernTools that do itProven by
Logs are redacted and expireMust haveRule in codefull card numbers kept in traces for everredactPrivacyOpenTelemetry processors, retention policiesAAC-0095
Every action can be tracedMust havePlatform settingnobody can say why money moved last TuesdayrecordHuman oversightOpenTelemetry, Langfuse, PhoenixAAC-0080
Guardrail hit rates are watchedShould haveRule in codea guardrail that blocks 30% of good requests, or none at allalertSafetydashboards and alerts on block ratesAAC-0088
Serve what was testedMust havePlatform settinga prompt or model changed in production without evaluationblock the releaseSecurityversioned releases, CI gatesAAC-0107

Add one

Missing a guardrail you rely on? Email basant@cleandataengineering.ai with what it catches and where it sits. Tool names are examples, not endorsements; check current docs before you build.