Prompt guardrails are theater. Put the check outside the model
Prompt guardrails ask the model to behave, and nothing checks that it did. Take the permission decision away from the model with a deterministic check on each tool call.
Prompt guardrails ask the model to behave, and nothing checks that it did. Take the permission decision away from the model with a deterministic check on each tool call.
A February 2026 Ask HN thread asked "How are you controlling AI agents that take real actions?", and one reply began "Prompt guardrails are theater". A line in the system prompt such as "never refund more than the customer paid" is a request to the model. Nothing checks that the model did what it was asked. The answer the thread lands on is to keep the model out of the permission decision and check each action outside it, deterministically, before it runs. For a support agent's refund tool, that check is a few lines that block a refund larger than the order total.
The person who started the thread put the problem in two sentences. "Prompt instructions like 'never do X' don't hold up. LLMs ignore them when context is long or users push hard". By the fortieth turn the refund limit is one line near the top of the context, and below it sits a customer explaining why they deserve more. To the model, prompt guardrails are more text, weighed against the customer's. Usually the limit holds, and when it doesn't the refund goes out, because a tool function runs whatever arguments the model hands it.
OWASP makes the same point from the security side, in its entry on system prompt leakage, LLM07:2025. It says the system prompt "should not be considered a secret, nor should it be used as a security control". Its example is a banking chatbot whose prompt says "The Transaction limit is set to $5000 per day for a user". Anyone who gets the model to repeat that line now knows the number to argue around, and the only thing holding it is the model they're arguing with.
OWASP's advice is guardrails outside the model, in an independent system that checks what the model does. "Critical controls such as privilege separation, authorization bounds checks, and similar must not be delegated to the LLM," it says, and they should run "in a deterministic, auditable manner".
One reply in the thread treats a refund as a business rule, where the order exists and the amount matches, and adds "That decision shouldn't be made by an LLM at all". We make Amiril, which checks tool calls against rules, so here is the amount half of that in Amiril's rule language. It blocks an issue_refund call unless an earlier lookup_order call in the same run returned a total at least as large as the refund:
@id("refund-within-paid")
@sentence("A refund of {amount} is more than order {order_id} was paid ({paid})")
block (
agent == "support",
tool == "issue_refund"
)
unless {
paid = latest(lookup_order{ args.order_id == call.args.order_id }).result.total;
call.args.amount <= paid
};latest(...) is a rule language pattern that finds the most recent lookup of the same order earlier in the run, and .result.total reads what the order system said was paid. The refund amount is the model's choice. The total it's checked against is the order system's, so the model controls only one side of the comparison. An unless rule also blocks a call when a value it reads is missing, which covers a refund the model tries before any lookup. Whether the order is this customer's is for lookup_order to settle, by returning only the orders of the customer in the chat.
The check happens in the agent's own process, where the Amiril SDK wraps each tool function and checks the call before the function body runs. For an agent loop you wrote yourself, that looks like this:
import amiril
from amiril import plain
amiril.init() # reads AMIRIL_API_KEY; amiril.init(rules_file="rules.json") needs no account
agent = plain.Agent("support")
@agent.tool
def lookup_order(order_id: str) -> dict:
"""Look up an order."""
return orders.get(order_id)
@agent.tool
def issue_refund(order_id: str, amount: float) -> dict:
"""Refund part or all of an order."""
return payments.refund(order_id, amount)
tools = {"lookup_order": lookup_order, "issue_refund": issue_refund}
with agent.run(session_id=chat_id) as run:
for tool_calls in model_replies(): # your own model call goes here
run.turn()
for call in tool_calls:
# a blocked call returns a dict holding the refusal below, and the function never runs
result = tools[call["name"]](**call["args"])
# hand result to the model as the tool resultWhen the model asks to refund 385 on an order that cost 38.50, payments.refund never runs and the model gets this back in its place:
The call to issue_refund was not performed. Rule refund-within-paid blocked it: A refund of 385 is more than order A-1042 was paid (38.5). Do not retry this call with different arguments or achieve the same outcome another way; tell the user it was not performed.
The rule never reads the chat. It reads the call's arguments and the lookup's result, so neither a customer's fortieth message nor an instruction planted in a retrieved document can change what it decides. That makes a refused refund easy to explain. With deterministic guardrails the whole answer is the rule version, the call and the lookup it read. Limiting each order to one refund takes a second rule, one that looks back over the whole session.
Prompt guardrails are good at shaping what the model tries, and we'd keep the refund limit in the prompt for that reason. Usually the model follows that line, so the rule rarely fires and customers rarely hear no.
The blocked message does some of the prompt's job too. It tells the model why, and tells it not to try again with another amount, so the agent says sorry to the customer. A model handed a bare tool error tends to have another go at 384.
The thread's author also asked "how do you update those rules without a redeploy every time?", then put a similar question under another reply, and neither got an answer. An if in the tool function has exactly that problem. The limit lives in the repo, and changing it means a deploy.
An Amiril rule lives in your workspace. The SDK keeps a copy inside the agent's process and refreshes it about once a minute, so a rule you publish reaches every running agent without a deploy. Checks run against that copy and wait on no network request. If Amiril can't be reached, the SDK goes on enforcing the last rules it had and keeps them on disk for a restart.
A newly published rule starts in Shadow, where it checks every call, records what it would have done and lets the call run. Test on past calls replays any version of a rule, a draft included, over the last 24 hours, 7 days or 30 days of the agent's real calls. That's where you'd find out the refund rule also blocks the goodwill credit your support team adds on top of an order. Once the list of calls it would have blocked looks right, switch the rule to Enforce.
The refund rule here was written by hand. A first draft can come from Amiril too: a rule suggestion is a rule drafted for an issue and tested on past runs, and Create rule opens it in the rule editor in Shadow.
On a voice agent the same failure is a 100% discount for a caller who says they're a friend of the owner, and the LiveKit booking post blocks it with a rule of the same kind. Which tools each agent may call at all is a gateway setting, separate from rules like this one.
You can try this before you have an account: the no-framework setup runs from a local rules.json passed to amiril.init.