Tiny, dependency-free permission engine for AI agents.
Project description
nopeai for Python
nopeai is a tiny, dependency-free permission engine for AI agents.
Install
pip install nopeai
Usage
from nopeai import PermissionDeniedError, createPermissionEngine
engine = createPermissionEngine(
[
{
"role": "agent",
"action": "call_tool",
"resource_type": "tool",
"resource_id": "search",
"effect": "allow",
}
]
)
agent = {"id": "agent_1", "roles": ["agent"]}
tool = {"type": "tool", "id": "search"}
assert engine.can(agent, "call_tool", tool) is True
try:
engine.authorize(agent, "call_tool", {"type": "tool", "id": "email"})
except PermissionDeniedError as error:
print(error.decision["reason"])
Included Examples
from nopeai.examples import examples, sample_agents, sample_resources
assert examples["tools"].can(
sample_agents["agent"],
"call_tool",
sample_resources["search_tool"],
) is True
assert examples["tenant"].can(
sample_agents["finance"],
"read",
sample_resources["invoice"],
) is True
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
nopeai-0.1.0.tar.gz
(5.1 kB
view details)
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 nopeai-0.1.0.tar.gz.
File metadata
- Download URL: nopeai-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7837d21d0b625519d4798aec391fdba08aa5dcc9cfcb7fe44a1379492f02246
|
|
| MD5 |
aeb8989e2df8fa9174e20e7bcca8525a
|
|
| BLAKE2b-256 |
ad49a82b903ca737e01e2e33e103eda9ca97d49f2deee21a54beeb5854c2d652
|
File details
Details for the file nopeai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nopeai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15532c1327835f480499cf896f73da3d8afbe655d6beee80060036280b7d8812
|
|
| MD5 |
62ee5db605dbfe846ef7befeabaa3c16
|
|
| BLAKE2b-256 |
fa77a8437add0a89d1b7987a3745e9b243f1acc5249f1ab4a1d17976ca89659c
|