Agent Governance ToolkitAgent Governance Toolkit 4.1.0 · Python 3.10+
Dashboard
0%

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.

ExampleThe tool is allowed; the path is still refused
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"}))

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.

ExampleA read passes; a DROP is blocked by its pattern
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"}))

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.

ExampleIdentical arguments, opposite answers
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))

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.

CheckTool names it fires forWhat it blocks
Pathread_file, write_file, delete_fileA path under /etc/, /sys/, /proc/, /dev/ or Windows System32
SQLdatabase_query, database_writeA destructive statement such as DROP or TRUNCATE
Commandexecute_code, run_commandA dangerous shell pattern in code or command
Endpointapi_callAn 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.

ExampleA one-line adapter gets the built-in check back
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"}))

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, query or 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.
Watch out. This is one of the costliest things to find out late: the argument checks are not general. A tool named outside the known list gets no check, with no warning. When a tool cannot be renamed, write the rule yourself, which Writing your own policy rules shows.
Try it yourself
  • Try read_file with a path of safe/../../etc/passwd and confirm the normalisation still catches it.
  • Try an api_call with an endpoint starting internal:// and read the refusal.
  • Put a newline in a read_file path and read the different refusal you get.

Every expert started right here.