Default Behaviour
PraisonAI is safe by default: a fresh install on an interactive terminal asks before running dangerous tools (shell exec, file writes, code execution). Pipes, CI runners, and redirected I/O fall back to deny by default — dangerous tools never run unattended without an explicit policy.sys.stdin and sys.stdout are TTYs. This avoids surprises in CI / Docker / scheduled-task contexts.
Reject with a Reason
When you reject a tool call in the Rich prompt or Textual TUI, PraisonAI asks for an optional one-line explanation. That reason is passed back to the agent as the tool’s result, so the next turn can course-correct instead of retrying blindly.
The reason travels as
ApprovalResponse.reason (a new Optional[str] field, defaulting to None, also serialised in to_dict()). Downstream, the denied tool’s result is set from ApprovalDecision.reason, so the agent sees the correction as the tool’s output — not just a log line.
Blank input keeps today’s plain denial. A non-blank reason (“use a smaller batch”, “don’t touch
production.env”) becomes the denied tool’s result, letting the agent adjust on its next turn.Bypassing the Prompt
Per-run bypass — --dangerously-skip-approval
For one-off runs you trust completely:
--no-safe. Both set PRAISONAI_TOOL_SAFETY=off for the subprocess and run dangerous tools without prompting.
Session-wide bypass — PRAISONAI_TOOL_SAFETY=off
For a whole shell session:
off, full, none, 0, false (case-insensitive). Any other value falls back to the default preset.
Python-level bypass — approval="bypass"
approval=False instead if you want deny-by-default without the prompt (CI-style behaviour from inside a TTY-attached process).
Declarative Permissions
Pre-declare allow/deny rules for CI-safe runs. See Declarative Permissions.Overview
Certain tools are marked with risk levels and require approval before execution:When called from PraisonAI’s interactive modes (
praison "prompt" / praisonai tui launch) under the default approval_mode="auto", edit_file and apply_patch are context-approved by the interactive-tools loader so they don’t block on a console prompt. In manual / scoped modes the normal HIGH-risk prompt with diff preview still applies. See Interactive Tools.YAML Configuration
Configure approval settings in your YAML configuration file using theapproval: block:
Shorthand Forms
Legacy YAML Aliases (Backward Compatible)
Primary keys win when both are present.
Validation
Unknown keys now raiseValueError with the list of allowed keys — silent typos no longer pass through undetected.
CLI ⇄ YAML ⇄ Python Mapping
All three surfaces use the same unified configuration:praisonai code Safety Flags
Auto-Approve All Tools (--trust)
Use the --trust flag to auto-approve all tool executions without prompting:

Usage
Level-Based Approval (--approve-level)
Use --approve-level to auto-approve tools up to a specific risk level:
low- Only auto-approve low risk toolsmedium- Auto-approve low and medium risk toolshigh- Auto-approve low, medium, and high risk toolscritical- Auto-approve all tools (same as--trust)
Examples
Approval Backend (--approval)
Use --approval to route tool approvals to a specific backend — Slack, Telegram, Discord, a webhook, or more:
Available Backends
Works With All CLI Commands
Programmatic Control
Custom tools registered via
add_approval_requirement(...) are now gated on the interactive ConsoleBackend ask path, not just the deny path. Previously, registry-required custom tools were only blocked in non-interactive mode — that gap is now closed.Risk Level Reference
Critical Risk Tools
execute_command- Run shell commandskill_process- Terminate processesexecute_code- Execute arbitrary code
High Risk Tools
write_file- Write to filesdelete_file- Delete filesmove_file- Move/rename filescopy_file- Copy filesedit_file- Edit existing file contentapply_patch- Apply a patch/diff to filesexecute_query- Database queries
Medium Risk Tools
evaluate- Evaluate expressionscrawl- Web crawlingscrape_page- Web scraping
Best Practices
Use deny-by-default in CI
Use deny-by-default in CI
Set
approval=False (or let the non-TTY default kick in automatically) so an agent run in CI never silently executes a destructive tool, even on a misconfigured runner that mistakenly attaches a TTY.For development/testing: use --trust for faster iteration
For development/testing: use --trust for faster iteration
When you’re actively monitoring the AI’s actions,
--trust speeds up iteration by skipping prompts entirely.For production scripts: use --approve-level high
For production scripts: use --approve-level high
Allow file operations but still require approval for shell commands:
Related Features
Approval Protocol
All approval backends (Slack, Telegram, Discord, Webhook, HTTP, Agent)
Sandbox Execution
Secure isolated command execution
Autonomy Modes
Control AI autonomy levels
Tool Tracking
Monitor tool usage

