Short answer
Don't rely on the prompt. Check every tool call in code before it runs: an allow list of tools the agent may use, a deny list for patterns like delete_* and drop_*, and a human approval step for anything risky.
An agent that can call a delete tool will, some day, call it. Not out of malice. A confused model, a bad tool result or a misread instruction is enough. The question is what is standing between the model and the action.
Why the prompt is not enough
- The model decides. A line saying "never delete anything" is one more piece of text the model weighs against all the others.
- Tool results can carry instructions. A web page or an email the agent reads can say "now delete the old records".
- Long runs forget. A rule from the top of a long conversation can drop out of view.
The check has to run in code, outside the model, before the tool call happens.
Three layers, from strongest to weakest
- Permissions on the credentials. Give the agent a read-only database user and an API key that cannot delete. A tool that cannot delete cannot be talked into it. This is the real boundary.
- An allow list. The agent can call only the tools you named. Anything else is refused, including tools you add later and forget about.
- Approval for the risky ones. Refunds, sends and updates wait for a person to say yes.
A deny list ("never call delete_*") is the weakest of the four. It only catches the names you thought of. Prefer an allow list, and use a deny list as an extra guard on top.
A small allow list you can paste in
from fnmatch import fnmatch
class ActionBlocked(Exception):
pass
class ToolPolicy:
def __init__(self, allow, ask=()):
self.allow = list(allow) # what the agent may do on its own
self.ask = list(ask) # what it may do only with a person's yes
def check(self, tool_name, approve=lambda name: False):
listed = self.allow + self.ask
if not any(fnmatch(tool_name, p) for p in listed):
raise ActionBlocked(f"{tool_name} is not on the allow list")
if any(fnmatch(tool_name, p) for p in self.ask) and not approve(tool_name):
raise ActionBlocked(f"{tool_name} needs a person to approve it")
policy = ToolPolicy(allow=["read_*", "search_*"], ask=["refund_*"])Call policy.check(tool_name, approve=...) right before every tool call.
We tested it on 20 November 2026. read_orders was allowed. delete_customer was blocked because it is not on the allow list. refund_payment was blocked until a person approved it, and allowed once they did.
What this simple version does not cover
- Names only. The check looks at the tool's name. A generic tool called
run_sqlcan still run a delete inside it. Give the agent narrow tools such asread_ordersinstead of one tool that can do anything. - Every path must call it. A tool call that skips the check is not covered.
- Approval fatigue. If a person is asked about everything, they start saying yes without reading. Keep the approval list short.
Doing it with SteerPlane
SteerPlane has allow lists, deny lists and an approval step built in. Install it with pip install steerplane:
from steerplane import SteerPlane
from steerplane.exceptions import PolicyViolationError
sp = SteerPlane(agent_id="support_agent")
def ask_a_person(action, details):
return input(f"Allow {action}? (y/n) ").strip().lower() == "y"
try:
with sp.run(
max_cost_usd=5,
allowed_actions=["read_*", "search_*"],
denied_actions=["delete_*", "drop_*"],
require_approval=["refund_*"],
approval_callback=ask_a_person,
) as run:
run.log_step("read_orders", tokens=100, cost=0.001)
run.log_step("delete_customer", tokens=50, cost=0.0005)
except PolicyViolationError as e:
print(f"Blocked: {e}")On version 1.1.3 we tested all three. A call to delete_customer was blocked by the deny pattern. A call to send_email was blocked because it was not on the allow list. A refund_payment call asked the callback first, and a refusal ended the run with a policy error.
One thing to know. The policy matches the action name you log, the same as the simple version above. It does not look inside what a tool does, so name your tools for what they do and keep them narrow.
Pair it with a cost limit and a guard against repeated actions. Setup is on the setup page.
A checklist before you give an agent real tools
- The agent's credentials cannot do more than its job needs.
- It can call only the tools on an allow list.
- Anything that moves money, sends a message or changes a record waits for a person.
- Tools are narrow and named for what they do.
- You have tried to make the agent delete something on purpose and watched it fail.