Quick Start
Pick a backend
Choose your approval channel. Each backend reads its token from an environment variable:
| Backend | Command | Required Env Vars |
|---|---|---|
| Slack | --approval slack | SLACK_BOT_TOKEN, SLACK_CHANNEL |
| Discord | --approval discord | DISCORD_BOT_TOKEN, DISCORD_CHANNEL_ID |
| Telegram | --approval telegram | TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID |
CLI Commands
The--approval flag works with all CLI commands:
All CLI Approval Flags
| Flag | Description | Example |
|---|---|---|
--approval <backend> | Route approvals to a platform | --approval slack |
--trust | Auto-approve all tools (skip prompts) | --trust |
--approve-level <level> | Auto-approve up to a risk level | --approve-level high |
--approve-all-tools | Require approval for all tools, not just dangerous ones | --approve-all-tools |
--approval-timeout <sec> | Override backend timeout | --approval-timeout 60 |
Available Backends
| Value | What Happens | Env Vars |
|---|---|---|
console | Interactive terminal prompt (default) | — |
slack | Slack Block Kit message → reply “yes”/“no” | SLACK_BOT_TOKEN, SLACK_CHANNEL |
telegram | Telegram inline keyboard buttons | TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID |
discord | Discord embed → text reply “yes”/“no” | DISCORD_BOT_TOKEN, DISCORD_CHANNEL_ID |
webhook | POST to HTTP endpoint → poll for decision | APPROVAL_WEBHOOK_URL |
http | Local web dashboard (browser) | — |
agent | Delegate to an AI reviewer agent | — |
auto | Auto-approve everything (same as --trust) | — |
none | Disable approval entirely | — |
Programmatic Usage
- Slack
- Discord
- Telegram
- Webhook
- HTTP Dashboard
- Agent
chat:write and channels:history (or im:history for DMs) scopes.| Parameter | Default | Description |
|---|---|---|
token | SLACK_BOT_TOKEN env | Slack bot token (xoxb-...) |
channel | SLACK_CHANNEL env, or bot’s own DM | Channel ID, #name, or user ID |
timeout | 300 (5 min) | Seconds to wait for response |
poll_interval | 3.0 | Seconds between reply polls |
Approval Keywords
All messaging backends (Slack, Discord, Telegram) understand these keywords:| Action | Keywords |
|---|---|
| Approve | yes, y, approve, approved, ok, allow, go, proceed, confirm |
| Deny | no, n, deny, denied, reject, block, stop, cancel, refuse |
How It Works
| Step | What Happens |
|---|---|
| Agent backend | approval=True or custom backend on the Agent is checked first |
| Required? | Only tools in the dangerous-tools set need approval |
| Env check | PRAISONAI_AUTO_APPROVE=true skips all prompts |
| YAML check | Tools listed in YAML approve field are auto-approved |
| Already approved | Once approved in a session, no re-prompt |
| Backend | ConsoleBackend (default), AutoApproveBackend, or your custom |
Configuration Options
Agent Parameter (Recommended)
| Value | Behavior |
|---|---|
approval=True | Auto-approve all dangerous tools for this agent |
approval=False / None | Use registry fallback (default: console prompt) |
approval=SlackApproval(...) | Route approvals to Slack |
approval=TelegramApproval(...) | Route approvals to Telegram |
approval=DiscordApproval(...) | Route approvals to Discord |
Other Methods
| Method | Scope | Use Case |
|---|---|---|
PRAISONAI_AUTO_APPROVE=true | All agents | CI/CD, testing |
get_approval_registry().set_backend(backend) | All agents | Global policy |
get_approval_registry().set_backend(backend, agent_name="x") | Single agent | Registry-level control |
YAML approve: [tool1, tool2] | Per-task | Declarative configs |
Multi-Agent Example
Different agents can have different approval policies:Dangerous Tools (Default)
These tools require approval by default:| Tool | Risk Level |
|---|---|
execute_command | critical |
kill_process | critical |
execute_code | critical |
write_file | high |
delete_file | high |
move_file | high |
execute_query | high |
crawl | medium |
scrape_page | medium |
Best Practices
Use approval=True for bot agents
Use approval=True for bot agents
Set
approval=True directly on agent constructors for unattended bots. This is the simplest, most agent-centric approach.Use --approval slack for team oversight
Use --approval slack for team oversight
Route dangerous tool approvals to a shared Slack channel so your team can review and approve in real time. Works across timezones — the agent waits up to 5 minutes by default.
Cross-platform: Telegram bot → Slack approval
Cross-platform: Telegram bot → Slack approval
Users can chat with your agent via Telegram while dangerous tool approvals are routed to a Slack admin channel. Just set
approval=SlackApproval(...) on the agent powering the Telegram bot.Use environment variable for CI/CD
Use environment variable for CI/CD
Set
PRAISONAI_AUTO_APPROVE=true in your CI environment to avoid blocking on prompts during automated testing.Use per-agent backends for multi-agent systems
Use per-agent backends for multi-agent systems
Different agents may need different approval policies. Pass different backends to each agent’s
approval= parameter.
