Metadata-Version: 2.4
Name: tool-permission-gate-py
Version: 0.1.0
Summary: Policy-check agent tool calls before execution. Python port of @mukundakatta/tool-permission-gate.
Project-URL: Homepage, https://github.com/MukundaKatta/tool-permission-gate-py
Project-URL: Issues, https://github.com/MukundaKatta/tool-permission-gate-py/issues
Project-URL: Source, https://github.com/MukundaKatta/tool-permission-gate-py
Project-URL: JS sibling, https://www.npmjs.com/package/@mukundakatta/tool-permission-gate
Author-email: Mukunda Katta <mukunda.vjcs6@gmail.com>
License: MIT
License-File: LICENSE
Keywords: agent,gate,llm,policy,security,tool-calls
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# tool-permission-gate-py

Policy-check agent tool calls before execution. Pure Python, zero deps. Python port of [`@mukundakatta/tool-permission-gate`](https://www.npmjs.com/package/@mukundakatta/tool-permission-gate).

```bash
pip install tool-permission-gate-py
```

```python
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
