Checking a tool's arguments
Argument checks read a call's arguments, not only its tool name, so the engine can block a protected file path or a destructive SQL statement even when the tool itself is allowed.
Last updated: 14 Oct, 2026 · Agent Governance Toolkit 4.1.0
The Allow-lists and default deny lesson decided on the tool name alone. But read_file is safe right up until the path is /etc/passwd, so the engine goes one level deeper for a few tools, and there is a trap in how far that goes.
A protected path is refused
The engine keeps a list of protected directories and compares a file tool's path argument against it, after resolving .. so a path walking upward cannot sneak past.
from agent_control_plane import PolicyEngine
policy = PolicyEngine()
policy.add_constraint("support", ["read_file"])
print(policy.check_violation("support", "read_file", {"path": "notes.txt"}))
print(policy.check_violation("support", "read_file", {"path": "/etc/passwd"}))None Path Violation: Cannot access protected directory /etc/
The tool was on the allow-list and the call was still refused, because the argument named a protected directory. The refusal names the directory it matched.
Destructive SQL is caught by a pattern
For a database tool, the engine matches the query argument against a set of destructive patterns and names the one that fired.
policy.add_constraint("support", ["database_query"])
print(policy.check_violation("support", "database_query", {"query": "SELECT 1"}))
print(policy.check_violation("support", "database_query", {"query": "DROP TABLE orders"}))None Destructive SQL blocked: \bDROP\s+
The checks are keyed on a few tool names
Here is the trap. Each argument check fires only for a short list of hardcoded tool names. The same dangerous query, through a tool with a name the engine does not know, is allowed.
policy.add_constraint("support", ["database_query", "run_sql"])
dangerous = {"query": "DROP TABLE orders"}
print("database_query:", policy.check_violation("support", "database_query", dangerous))
print("run_sql: ", policy.check_violation("support", "run_sql", dangerous))database_query: Destructive SQL blocked: \bDROP\s+ run_sql: None
Identical arguments, opposite answers, and nothing warned you. The second call is allowed because the engine's SQL check runs for the names it knows and no others.
| Check | Tool names it fires for | What it blocks |
|---|---|---|
| Path | read_file, write_file, delete_file | A path under /etc/, /sys/, /proc/, /dev/ or Windows System32 |
| SQL | database_query, database_write | A destructive statement such as DROP or TRUNCATE |
| Command | execute_code, run_command | A dangerous shell pattern in code or command |
| Endpoint | api_call | An endpoint starting internal:// |
Covering a tool with another name
Two fixes work. Name your tools the names the engine already knows, or write the rule yourself in the next lesson. Mapping your own name onto a known one costs nothing and belongs next to the gate.
NAMES = {"run_sql": "database_query"} # map your name onto one the engine knows
def checked(policy, role, tool, args):
return policy.check_violation(role, NAMES.get(tool, tool), args)
policy.add_constraint("support", ["database_query"])
print(checked(policy, "support", "run_sql", {"query": "DROP TABLE orders"}))Destructive SQL blocked: \bDROP\s+
What the argument checks did and did not do
- They read the argument, not only the name. A protected path and a destructive query were refused even though the tool was allowed.
- They are a short list of names, not a general rule. A tool called
run_sql,queryor anything else gets no SQL protection at all. - The refusal names the rule that fired, so you can see which check you hit rather than guessing.
Where argument checks help
- A file tool you can name
read_file, so the protected-directory check covers it for free. - A database tool named
database_query, to catch a destructive statement before it reaches the database. - An agent whose tools you can rename, so a cheap adapter maps each one onto a name the engine protects.
Related
- Previous: Allow-lists and default deny
- Next: Writing your own policy rules
- Try
read_filewith a path ofsafe/../../etc/passwdand confirm the normalisation still catches it. - Try an
api_callwith an endpoint startinginternal://and read the refusal. - Put a newline in a
read_filepath and read the different refusal you get.
Every expert started right here.