praisonaiagents.approval
Core SDK Human Approval Framework for PraisonAI Agents This module provides a minimal human-in-the-loop approval system for dangerous tool operations. It extends the existing callback system to require human approval before executing high-risk tools.Overview
This module provides components for approval.Classes
ToolPermission
Permission entry for a tool.
PermissionAllowlist
Persistent permission allowlist for tools.
ApprovalDecision
Result of an approval request
Functions
get_permission_allowlist()
Get the global permission allowlist.
set_permission_allowlist()
Set the global permission allowlist.
set_approval_callback()
Set a custom approval callback function.
get_approval_callback()
Get the current approval callback function.
mark_approved()
Mark a tool as approved in the current context.
is_already_approved()
Check if a tool is already approved in the current context.
is_yaml_approved()
Check if a tool is auto-approved via YAML approve field.
is_env_auto_approve()
Check if PRAISONAI_AUTO_APPROVE environment variable is set.
set_yaml_approved_tools()
Set the list of YAML-approved tools for the current context.
reset_yaml_approved_tools()
Reset YAML-approved tools to previous state.
clear_approval_context()
Clear the approval context.
require_approval()
Decorator to mark a tool as requiring human approval.
console_approval_callback()
Default console-based approval callback.
request_approval()
Request approval for a tool execution.
configure_default_approvals()
Configure default dangerous tools to require approval.
add_approval_requirement()
Dynamically add approval requirement for a tool.
remove_approval_requirement()
Remove approval requirement for a tool.
is_approval_required()
Check if a tool requires approval.
get_risk_level()
Get the risk level of a tool.
Constants
| Name | Value |
|---|---|
DEFAULT_DANGEROUS_TOOLS | {'execute_command': 'critical', 'kill_process': 'critical', 'execute_code': 'critical', 'write_file': 'high', 'delete_file': 'high', 'move_file': 'high', 'copy_file': 'high', 'execute_query': 'high', ... |

