Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tool_permission_gate_py-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tool_permission_gate_py-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for tool_permission_gate_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f5cd68a2aa6fb863fcafd8e7d86854dfd8937f4cac3ac4bc9f4aca4d8e49b26a
MD5 fc2cf3e1ccf31ae613e4a1e47eb95a3a
BLAKE2b-256 9e3fdfd28a57078fac33100b8fa142f5f67244cb94712b80c6b4f4a3effb4804

See more details on using hashes here.

File details

Details for the file tool_permission_gate_py-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tool_permission_gate_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db0abdc7ad01ab9e265024e7a1de5a9e6c796d23dda75c86a816d23bc6e1eb80
MD5 dee2c7e621c6aa0eb6c2a448bd77df73
BLAKE2b-256 105d12771c4d0694e42721daa4fb24d8a7d84adc1de7b5842a289c79e1ada71c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page