cd /news/ai-agents/three-rules-for-gating-an-ai-agent-s… · home › topics › ai-agents › article
[ARTICLE · art-182395] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Three rules for gating an AI agent's tool calls (and why approve/deny dialogs fail)

A developer published a design contract for gating AI agent tool calls, arguing that approve/deny confirmation dialogs fail because they ask humans to judge model intent and can be argued down by the model. The proposed gate sits between the model's decision and the tool's effect, is evaluated by code the model cannot author or edit, classifies calls into a small explicit taxonomy (read, write within a root, execute, network egress, irreversible), denies anything unclassified, and fails closed with separate deny and error signals logged. The developer implemented the gate ahead of tool execution in GAL, a local single-binary agent runtime with kernel-level sandboxing.

recommendation

Put the gate between the model's decision and the tool's effect, deny unclassified calls by default, canonicalise paths before allowlisting, and log denials separately from gate errors so failures stay loud.

more in playbook: Securing agents and AI tools
by read3 min views1 publishedDec 5, 2026

Last week an engineer asked me a question I couldn't answer cleanly: "My agent posts a confirmation dialog before it touches anything dangerous. Isn't that enough?"

No — and the reason is structural, not a matter of making the dialog prettier.

By the time the dialog appears, the model has already decided what to do. The human is shown a blob of arguments and asked to judge intent from it. That's the wrong job for a human at 11pm: we skim, we click "allow", we learn to click "allow" because the dialog fires forty times a day.

Worse, the dialog is a request layer. Anything expressed as a request can be argued with. A model that decides the gate is inconvenient will produce arguments that look reasonable — narrower paths, friendlier flags, a "small" scope. You are not auditing; you are negotiating.

A useful gate sits between the model's decision and the tool's effect, and it is evaluated by code the model does not author and cannot edit mid-run.

The contract I use is deliberately boring:

That last point is the one people skip, and it is the one that matters. A gate that fails open is decoration. A gate whose failure is indistinguishable from a denial teaches you nothing about your agent. Keep the two signals separate in your logs: hook_deny and hook_error are different events, and if you merge them you will never notice a gate that has been silently broken for a month.

Refusing a DROP TABLE is good. Not letting the agent construct a statement that could drop anything is better.

Practical version: the gate operates on a small, explicit taxonomy — read, write within a root, execute, network egress, irreversible. Anything that doesn't classify cleanly is denied by default. You stop writing regexes for every awful command in the world and start asking one question: does this call have a shape I have already decided is safe?

This is also where path canonicalisation belongs: proj/../../etc is a different string and the same file. Check the resolved path against the allowlist root, not the string the model typed.

Not by the model. Every gate invocation writes: timestamp, session id, tool, the arguments it judged, the decision, and the reason. Now "why did it do that?" is a grep, not an archaeology project.

Two properties matter more than the format:

Honesty section, because every "secure agent" post is missing one:

bash can do whatever the user can. The uncomfortable conclusion: you cannot ask a human to approve every step, and you cannot trust the model to police itself. What you can do is make the dangerous step unrepresentable, make every decision legible, and make failure loud.

If you want to see the contract I described wired into a real runtime, I built it into GAL — a local, single-binary agent runtime with the gate ahead of tool execution and kernel-level sandboxing underneath. The interesting part isn't the product; it's that the gate is a process boundary, not a prompt. What does your gate do when it panics? If the answer is "allows the call", that's the bug to fix this week.

── more in #ai-agents 4 stories · sorted by recency
── more on @gal 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/three-rules-for-gati…] indexed:0 read:3min 2026-12-05 · —