Policy-check agent tool calls before execution. Python port of @mukundakatta/tool-permission-gate.
Project description
tool-permission-gate-py
Policy-check agent tool calls before execution. Pure Python, zero deps. Python port of @mukundakatta/tool-permission-gate.
pip install tool-permission-gate-py
from tool_permission_gate import can_call_tool, filter_tool_calls
policy = {
"allow": ["search", "fetch", "transfer"],
"deny": ["shell"],
"max_amount": 100,
"require_human_for": ["deploy"],
}
can_call_tool({"name": "search"}, policy)
# Decision(allowed=True, reasons=[], tool='search')
can_call_tool({"name": "transfer", "args": {"amount": 500}}, policy)
# Decision(allowed=False, reasons=['amount_over_limit'], tool='transfer')
filter_tool_calls([{"name": "search"}, {"name": "shell"}], policy)
# [FilteredCall(allowed=True, ...), FilteredCall(allowed=False, reasons=['tool_denied'], ...)]
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tool_permission_gate_py-0.1.0.tar.gz.
File metadata
- Download URL: tool_permission_gate_py-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5cd68a2aa6fb863fcafd8e7d86854dfd8937f4cac3ac4bc9f4aca4d8e49b26a
|
|
| MD5 |
fc2cf3e1ccf31ae613e4a1e47eb95a3a
|
|
| BLAKE2b-256 |
9e3fdfd28a57078fac33100b8fa142f5f67244cb94712b80c6b4f4a3effb4804
|
File details
Details for the file tool_permission_gate_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tool_permission_gate_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db0abdc7ad01ab9e265024e7a1de5a9e6c796d23dda75c86a816d23bc6e1eb80
|
|
| MD5 |
dee2c7e621c6aa0eb6c2a448bd77df73
|
|
| BLAKE2b-256 |
105d12771c4d0694e42721daa4fb24d8a7d84adc1de7b5842a289c79e1ada71c
|