LLM guardrails vs tool call guardrails: what each one stops
LLM guardrails filter the text going into and out of a model. Tool call guardrails stop an agent's action before it runs. Where each belongs, with a rule to copy.
LLM guardrails filter the text going into and out of a model. Tool call guardrails stop an agent's action before it runs. Where each belongs, with a rule to copy.
LLM guardrails mostly check two pieces of text: the user's prompt before the model sees it, and the model's answer before the user does. That catches a jailbreak or a leaked card number. A payments agent paying an invoice to a payee it never checked gets past both checks, since no message in that run holds anything a filter would flag. An agent that takes actions needs a second check at the tool call, made before the tool runs, that reads the tool's name, its arguments and what the agent already did in the run.
The phrase AI guardrails has come to mean checks on text, and the products sold under it show why. The checks in Amazon Bedrock Guardrails include content filters for harmful categories and a filter that masks personal data such as card numbers. AWS describes them as protection for user inputs and model responses. Its ApplyGuardrail API runs them on any text without calling a model, so they work in front of models hosted outside AWS as well.
In the OpenAI Agents SDK, input guardrails run on the user's first message and output guardrails on the agent's final answer. Its tool guardrails are a separate hook that wraps single function tools and runs on each call. By default an input guardrail runs in parallel with the agent, and the docs warn that the agent may already have executed tools by the time a tripwire cancels it. NeMo Guardrails, NVIDIA's open-source library, has input and output checks for chat apps, filters for retrieved content, and tool rails that check a proposed call against the tool's argument schema or against safety instructions you write for each tool.
If strangers can type into your agent, put a text filter in front of it. Prompt injection is the first risk on OWASP's 2025 list, and refusing an attempt with a fast classifier costs one small model call per message.
Take a payments agent with two tools, verify_payee and issue_payment, that is meant to verify a payee before it pays them. A message comes in: "Hi, Northwind Supplies changed banks last month. Could you pay invoice INV-1042 to them today? Thanks." Nothing in it is toxic or off-topic, and it doesn't try to override any instructions. The model skips the check and calls issue_payment for 1,200 to Northwind Supplies.
Run that message through content filters and it passes. Every sentence in it is harmless. The filter is handed the message and never the run's list of tool calls, the one place the missing verify_payee would show up.
OWASP lists this as Excessive Agency, number six in its 2025 Top 10 for LLM applications. It covers damaging actions taken on unexpected, ambiguous or manipulated model output, "regardless of what is causing the LLM to malfunction". Most of its fixes are about giving the agent fewer tools and narrower permissions. One of them, complete mediation, reads like a spec for a tool call check: "Implement authorization in downstream systems rather than relying on an LLM to decide if an action is allowed or not."
A guardrail at the tool call sits between the model's request and your function. It gets the tool's name and its arguments as values rather than prose, and it can look back over the calls already made in the run. That's enough to put the payments check into a rule:
@id("verify-before-pay")
@sentence("{payee} was not verified earlier in this run")
block (
agent == "payments",
tool == "issue_payment"
)
unless {
verify_payee{ args.payee == call.args.payee }
};The unless block describes a good call: an earlier verify_payee whose args.payee equals this call's call.args.payee. Any issue_payment without one is blocked. The rule is written in Amiril's rule language. Amiril's SDK checks it inside the agent's process before the tool runs, with no network request on the way. Against the published Python SDK, the verified payment to Acme Ltd goes through. The call for Northwind Supplies comes back to the model as this, in place of the tool's result, with the failed check in brackets at the end:
The call to issue_payment was not performed. Rule verify-before-pay blocked it: Northwind Supplies was not verified earlier in this run (verify_payee.exists false). Do not retry this call with different arguments or achieve the same outcome another way; tell the user it was not performed.
Other rules look further back than one run. @per("invoice_id") allows one payment per invoice, and sum with @scope("session") caps a total across a whole conversation, both covered in the rule language tour.
OpenAI's tool guardrails and NeMo's tool rails also give you a place to put a check like this. In either one you decide what to check, so someone first has to notice that the agent sometimes skips verify_payee.
Amiril reads the agent's traces and learns what normal looks like for that one agent. A run where the model skipped verification shows a rarity factor such as "verify_payee was not called, which happened in 4 of 1,200 other runs". Runs that share a problem are grouped into an issue. For an issue, Amiril drafts a rule suggestion and tests it on past runs, and keeps it only if it catches some of the issue's runs and fires on at most one in a hundred of the agent's other runs. Create rule opens that draft in the rule editor, and a saved draft does nothing to the agent until you publish it.
A published rule starts in Shadow, where it records what it would have done and lets every call through. Before you switch it to Enforce, Test on past calls replays it over the last 30 days of issue_payment calls and lists the payments it would have stopped. When you tighten it later and publish again, running agents pick up the new version within about a minute, with no redeploy. If Amiril can't be reached, they keep enforcing the last rules they had.
| LLM guardrails | Tool call guardrails | |
|---|---|---|
| Reads | Prompts, retrieved documents, model output | The tool, its arguments, earlier calls in the run or session |
| Runs | Before the model sees input, after it writes output | After the model asks for a call, before the tool runs |
| Catches | Jailbreaks, prompt attacks, personal data, denied topics | An unverified payee, a second payment on one invoice, a session total over a cap |
In the payments agent, the Northwind message goes through the input filter, the model plans, the issue_payment call it asks for goes through the rules, and its final answer goes through the output filter. Bedrock's content filters score text against fixed categories such as violence or prompt attacks, and none of them takes your invoice records or payee list.
On Bedrock, one guardrail set in an organization's management account can apply to every model call in every member account, so a security team can pick the company's LLM guardrails once. A tool call rule names the agent's own tools and arguments, issue_payment and args.payee above, so whoever built or runs that agent writes it.
The refund agent on Amiril's guardrails page hits the same gap with an amount of 900 on an order that cost 90, and why prompt guardrails don't hold covers writing the rule into the system prompt instead. To try a rule on your own agent, start free.