Skip to main content

PermissionAllowlist

Defined in the approval module.
AI Agent Persistent permission allowlist for tools. Allows pre-approving tools and paths to skip interactive approval. Can be saved/loaded from JSON for persistence across sessions.

Methods

load()

Load allowlist from JSON file.

add_tool()

Add a tool to the allowlist.

remove_tool()

Remove a tool from the allowlist.

is_allowed()

Check if a tool is allowed.

is_empty()

Check if allowlist is empty.

list_tools()

List all allowed tools.

clear_session_permissions()

Clear session-only permissions.

save()

Save allowlist to JSON file.

Usage

allowlist = PermissionAllowlist()
    allowlist.add_tool("read_file")
    allowlist.add_tool("write_file", paths=["./src", "./tests"])
    
    if allowlist.is_allowed("read_file"):
        # Skip approval prompt
        pass

Source

View on GitHub

praisonaiagents/approval.py at line 75