Skip to main content
PraisonAI asks before running anything dangerous: a fresh install on an interactive terminal will prompt you the first time a tool wants to touch your files or shell.

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.
A session counts as interactive only when both 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.
Leave the prompt blank to reject without a reason — the plain-denial behaviour is unchanged. 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:
This is identical to --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:
Accepted values that bypass: off, full, none, 0, false (case-insensitive). Any other value falls back to the default preset.

Python-level bypass — approval="bypass"

Use 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 the approval: block:

Shorthand Forms

Legacy YAML Aliases (Backward Compatible)

Primary keys win when both are present.

Validation

Unknown keys now raise ValueError 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:
Trust mode auto-approves all tools example

Usage

Output:
The --trust flag bypasses all safety prompts. Only use this when you trust the AI’s actions completely, such as in controlled environments or for testing.

Level-Based Approval (--approve-level)

Use --approve-level to auto-approve tools up to a specific risk level:
Available levels:
  • low - Only auto-approve low risk tools
  • medium - Auto-approve low and medium risk tools
  • high - Auto-approve low, medium, and high risk tools
  • critical - 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

For full configuration of each backend (timeouts, polling intervals, custom parameters), see Approval Protocol.

Programmatic Control

Custom approval callbacks:
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 commands
  • kill_process - Terminate processes
  • execute_code - Execute arbitrary code

High Risk Tools

  • write_file - Write to files
  • delete_file - Delete files
  • move_file - Move/rename files
  • copy_file - Copy files
  • edit_file - Edit existing file content
  • apply_patch - Apply a patch/diff to files
  • execute_query - Database queries

Medium Risk Tools

  • evaluate - Evaluate expressions
  • crawl - Web crawling
  • scrape_page - Web scraping

Best Practices

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.
PRAISONAI_TOOL_SAFETY=off is a per-session bypass intended for one-off trusted runs. Putting it in ~/.bashrc or ~/.zshrc re-introduces every safety gap that the safe-by-default system closed — any agent running in that shell will execute dangerous tools unguarded.
When you’re actively monitoring the AI’s actions, --trust speeds up iteration by skipping prompts entirely.
Allow file operations but still require approval for shell commands:

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