Skip to main content
Agents can require human approval before executing dangerous tools. Set approval=True on any agent to auto-approve, or pass a custom backend for console, webhook, Slack, or any approval channel.

Quick Start

1

Auto-Approve (Bots / Trusted Envs)

from praisonaiagents import Agent

agent = Agent(
    name="bot",
    instructions="You are a helpful assistant.",
    approval=True
)
agent.start("List files in current directory")
2

Custom Approval Backend

from praisonaiagents import Agent
from praisonaiagents.approval import ApprovalRequest, ApprovalDecision

class WebhookBackend:
    async def request_approval(self, request: ApprovalRequest) -> ApprovalDecision:
        # POST to your approval service
        return ApprovalDecision(approved=True, approver="webhook")

    def request_approval_sync(self, request: ApprovalRequest) -> ApprovalDecision:
        return ApprovalDecision(approved=True, approver="webhook")

agent = Agent(
    name="bot",
    instructions="You are a helpful assistant.",
    approval=WebhookBackend()
)
agent.start("List files in current directory")
3

Default (Console Prompt)

from praisonaiagents import Agent

# No approval= param → dangerous tools prompt in terminal
agent = Agent(
    name="interactive",
    instructions="You are a helpful assistant.",
)
agent.start("Delete temporary files")

How It Works

StepWhat Happens
Agent backendapproval=True or custom backend on the Agent is checked first
Required?Only tools in the dangerous-tools set need approval
Env checkPRAISONAI_AUTO_APPROVE=true skips all prompts
YAML checkTools listed in YAML approve field are auto-approved
Already approvedOnce approved in a session, no re-prompt
BackendConsoleBackend (default), AutoApproveBackend, or your custom

Configuration Options

ValueBehavior
approval=TrueAuto-approve all dangerous tools for this agent
approval=False / NoneUse registry fallback (default: console prompt)
approval=MyBackend()Use a custom approval backend for this agent

Other Methods

MethodScopeUse Case
PRAISONAI_AUTO_APPROVE=trueAll agentsCI/CD, testing
get_approval_registry().set_backend(backend)All agentsGlobal policy
get_approval_registry().set_backend(backend, agent_name="x")Single agentRegistry-level per-agent control
YAML approve: [tool1, tool2]Per-taskDeclarative configs

Built-in Backends

BackendImportBehavior
AutoApproveBackendfrom praisonaiagents import AutoApproveBackendAlways approves
ConsoleBackendfrom praisonaiagents.approval import ConsoleBackendRich terminal prompt (default)
AgentApprovalfrom praisonaiagents.approval import AgentApprovalDelegates to another AI agent
SlackApprovalfrom praisonai.bots import SlackApprovalSlack Block Kit + polling
TelegramApprovalfrom praisonai.bots import TelegramApprovalTelegram inline keyboard + polling
DiscordApprovalfrom praisonai.bots import DiscordApprovalDiscord embed + text reply polling
WebhookApprovalfrom praisonai.bots import WebhookApprovalPOST to webhook + poll status
HTTPApprovalfrom praisonai.bots import HTTPApprovalLocal web dashboard
CallbackBackendfrom praisonaiagents.approval import CallbackBackendWraps a legacy callback function

Custom Backend

Implement request_approval (async) and optionally request_approval_sync to create any approval channel:
from praisonaiagents import Agent
from praisonaiagents.approval import ApprovalRequest, ApprovalDecision

class SlackBackend:
    async def request_approval(self, request: ApprovalRequest) -> ApprovalDecision:
        approved = await self._ask_slack(
            f"Approve {request.tool_name} for {request.agent_name}?"
        )
        return ApprovalDecision(
            approved=approved,
            approver="slack",
            metadata={"channel": "#approvals"},
        )

    def request_approval_sync(self, request: ApprovalRequest) -> ApprovalDecision:
        # Sync fallback for non-async tool execution
        return ApprovalDecision(approved=True, approver="slack")

agent = Agent(
    name="slack-bot",
    instructions="You are a helpful assistant.",
    approval=SlackBackend()
)

Slack Approval

Route tool approvals to Slack — get a rich message with tool details and reply yes or no to approve or deny.
1

Install

pip install praisonai
2

Set Token

export SLACK_BOT_TOKEN=xoxb-your-token
3

Use It

from praisonaiagents import Agent
from praisonai.bots import SlackApproval

agent = Agent(
    name="assistant",
    instructions="You are a helpful assistant.",
    tools=[execute_command],
    approval=SlackApproval(channel="#approvals")
)
agent.start("Delete old log files")
The Slack bot token needs chat:write and channels:history (or im:history for DMs) scopes.

Configuration

ParameterDefaultDescription
tokenSLACK_BOT_TOKEN envSlack bot token (xoxb-...)
channelBot’s own DMChannel ID, name, or user ID
timeout300 (5 min)Seconds to wait for response
poll_interval3.0Seconds between polls

Approval Keywords

ActionKeywords
Approveyes, y, approve, approved, ok, allow, go, proceed, confirm
Denyno, n, deny, denied, reject, block, stop, cancel, refuse
You can use any bot platform for user interaction while routing approvals to Slack:
from praisonaiagents import Agent
from praisonai.bots import Bot, SlackApproval

agent = Agent(
    name="assistant",
    instructions="You are a helpful assistant.",
    approval=SlackApproval(channel="U0ABPEV1HK8")  # DM to admin
)

# Users talk via Telegram; dangerous tools approved in Slack
bot = Bot("telegram", agent=agent)
bot.run()

Telegram Approval

Route tool approvals to Telegram — get a message with inline keyboard buttons.
from praisonaiagents import Agent
from praisonai.bots import TelegramApproval

agent = Agent(
    name="assistant",
    tools=[execute_command],
    approval=TelegramApproval(chat_id="YOUR_CHAT_ID")  # token from TELEGRAM_BOT_TOKEN env
)
ParameterDefaultDescription
tokenTELEGRAM_BOT_TOKEN envTelegram bot token
chat_id(required)Chat ID to send approvals to
timeout300 (5 min)Seconds to wait for response
poll_interval2.0Seconds between polls

Discord Approval

Route tool approvals to Discord — get a rich embed and reply yes or no.
from praisonaiagents import Agent
from praisonai.bots import DiscordApproval

agent = Agent(
    name="assistant",
    tools=[execute_command],
    approval=DiscordApproval(channel_id="YOUR_CHANNEL_ID")  # token from DISCORD_BOT_TOKEN env
)
ParameterDefaultDescription
tokenDISCORD_BOT_TOKEN envDiscord bot token
channel_id(required)Channel ID to send approvals to
timeout300 (5 min)Seconds to wait for response
poll_interval3.0Seconds between polls

Webhook Approval

POST approval requests to any HTTP endpoint and poll for decisions. Ideal for enterprise dashboards, CI/CD, and custom integrations.
from praisonaiagents import Agent
from praisonai.bots import WebhookApproval

agent = Agent(
    name="assistant",
    tools=[execute_command],
    approval=WebhookApproval(
        webhook_url="https://your-app.com/api/approvals",
        headers={"Authorization": "Bearer sk-xxx"},
    ),
)
ParameterDefaultDescription
webhook_urlAPPROVAL_WEBHOOK_URL envURL to POST requests to
status_urlwebhook_url/{request_id}URL template for polling
headers{}Extra HTTP headers (e.g. auth)
timeout300 (5 min)Seconds to wait
poll_interval5.0Seconds between polls
If the webhook returns {"approved": true} in the POST response, the decision is immediate — no polling needed.

Agent Approval

Delegate approval decisions to another AI agent. The approver agent evaluates the tool call and responds with APPROVE or DENY.
from praisonaiagents import Agent
from praisonaiagents.approval import AgentApproval

# Security reviewer agent
reviewer = Agent(
    name="security-reviewer",
    instructions="Only approve low-risk read operations. Deny anything destructive.",
)

worker = Agent(
    name="assistant",
    tools=[execute_command],
    approval=AgentApproval(approver_agent=reviewer),
)
ParameterDefaultDescription
approver_agentAuto-createdAgent instance to evaluate requests
llmgpt-4o-miniLLM for default approver agent
AgentApproval lives in the core SDK (praisonaiagents.approval) — no extra dependencies needed.

HTTP Approval

Serve a local web dashboard for approvals. Open the URL in your browser and click Approve or Deny.
from praisonaiagents import Agent
from praisonai.bots import HTTPApproval

agent = Agent(
    name="assistant",
    tools=[execute_command],
    approval=HTTPApproval(host="127.0.0.1", port=8899),
)
# When a tool needs approval, open http://127.0.0.1:8899/approve/<request_id>
ParameterDefaultDescription
host127.0.0.1Bind address
port8899Port to listen on
timeout300 (5 min)Seconds to wait for response

Multi-Agent Example

Different agents can have different approval policies:
from praisonaiagents import Agent
from praisonaiagents.approval import AgentApproval
from praisonai.bots import SlackApproval, TelegramApproval, HTTPApproval

# Bot agent: auto-approve everything
bot = Agent(name="bot", approval=True)

# Interactive agent: console prompt (default)
interactive = Agent(name="interactive")

# Slack-approved agent
slack_agent = Agent(name="slack-approved", approval=SlackApproval(channel="#approvals"))

# Telegram-approved agent
telegram_agent = Agent(name="tg-approved", approval=TelegramApproval(chat_id="123456"))

# AI-reviewed agent (no human needed)
reviewer = Agent(name="reviewer", instructions="Only approve safe read operations")
ai_agent = Agent(name="ai-reviewed", approval=AgentApproval(approver_agent=reviewer))

# Local dashboard agent
http_agent = Agent(name="dashboard", approval=HTTPApproval(port=8899))

Registry (Advanced)

For global or centralized approval control, use the registry directly:
from praisonaiagents import Agent, AutoApproveBackend
from praisonaiagents.approval import get_approval_registry

registry = get_approval_registry()

# Global auto-approve
registry.set_backend(AutoApproveBackend())

# Per-agent override via registry
registry.set_backend(AutoApproveBackend(), agent_name="trusted-bot")
The approval= parameter on Agent takes priority over the global registry. If an agent has approval=True, it will auto-approve regardless of registry settings.

Dangerous Tools (Default)

These tools require approval by default:
ToolRisk Level
execute_commandcritical
kill_processcritical
execute_codecritical
write_filehigh
delete_filehigh
move_filehigh
execute_queryhigh
crawlmedium
scrape_pagemedium
Add or remove requirements:
from praisonaiagents.approval import get_approval_registry

registry = get_approval_registry()
registry.add_requirement("my_dangerous_tool", risk_level="high")
registry.remove_requirement("crawl")

Best Practices

Set approval=True directly on agent constructors for unattended bots. This is the simplest, most agent-centric approach.
Set PRAISONAI_AUTO_APPROVE=true in your CI environment to avoid blocking on prompts during automated testing.
Build webhook or messaging backends that route approvals to the right team. The async protocol supports long-running approval flows.
Different agents may need different approval policies. Pass different backends to each agent’s approval= parameter.