{"slug": "three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs", "title": "Three rules for gating an AI agent's tool calls (and why approve/deny dialogs fail)", "summary": "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.", "body_md": "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?\"*\n\nNo — and the reason is structural, not a matter of making the dialog prettier.\n\nBy 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.\n\nWorse, 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.\n\nA 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.\n\nThe contract I use is deliberately boring:\n\nThat 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.\n\nRefusing a `DROP TABLE` is good. Not letting the agent *construct* a statement that could drop anything is better.\n\nPractical 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?*\n\nThis 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.\n\nNot 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.\n\nTwo properties matter more than the format:\n\nHonesty section, because every \"secure agent\" post is missing one:\n\n`bash` can do whatever the user can.\nThe 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.\n\nIf you want to see the contract I described wired into a real runtime, I built it into [GAL](https://github.com/gal-agent/gal-release) — 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.\n\n*What does your gate do when it panics? If the answer is \"allows the call\", that's the bug to fix this week.*", "url": "https://wpnews.pro/news/three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs", "canonical_source": "https://dev.to/galagent/three-rules-for-gating-an-ai-agents-tool-calls-and-why-approvedeny-dialogs-fail-3nj6", "published_at": "2026-12-05 11:37:53+00:00", "updated_at": "2026-12-05 11:43:34.144835+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-tools", "developer-tools"], "entities": ["GAL"], "also_reported_by": [], "takeaway": "Gate agent tool calls in code the model cannot edit, classify each call into read, write-within-root, execute, network egress or irreversible, deny anything unclassified, and log hook_deny separately from hook_error so a silently broken gate is visible.", "recommendation": {"advice": "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.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs", "markdown": "https://wpnews.pro/news/three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs.md", "text": "https://wpnews.pro/news/three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs.txt", "jsonld": "https://wpnews.pro/news/three-rules-for-gating-an-ai-agent-s-tool-calls-and-why-approve-deny-dialogs.jsonld"}}