Skip to content

docs: Update messaging-bots for smart defaults + auto-approve behavioral changes#220

Open
MervinPraison wants to merge 1 commit intomainfrom
claude/issue-219-20260422-0813
Open

docs: Update messaging-bots for smart defaults + auto-approve behavioral changes#220
MervinPraison wants to merge 1 commit intomainfrom
claude/issue-219-20260422-0813

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

@MervinPraison MervinPraison commented Apr 22, 2026

Fixes #219

Updates the messaging-bots documentation to reflect the smart defaults and behavioral changes from PraisonAI PR #1498.

Changes Made

docs/features/messaging-bots.mdx

  • Edit 1: Updated Configuration Options table and code block
    • Changed auto_approve_tools default from False to True
    • Updated default_tools list to remove execute_command and show only safe tools
    • Updated descriptions to clarify chat bot behavior
  • Edit 2: Added new Smart Defaults section
    • Comprehensive section with Mermaid diagrams showing smart defaults behavior
    • Tables explaining when defaults are applied and how to opt out
    • Agent-centric code examples and CLI examples
    • Sequence diagram showing user interaction flow
  • Edit 3: Updated Multi-Channel Gateway YAML example
    • Added new channel-level auto_approve_tools and default_tools options
    • Added callout about gateway parity with Bot()
  • Edit 4: Added Best Practices accordion entries
    • Safe default tools only explaining safe vs destructive tools
    • Set approval flow for auto-approve disabled warning about CLI prompts
  • Edit 5: Updated Zero-Code Mode YAML example
    • Added tip about omitting tools to use smart defaults

docs/features/bot-gateway.mdx

  • Edit 7: Added parity note
    • Explained that gateway now applies same smart defaults as Bot()
    • Mentions resolution of zero tools in daemon mode issue

Implementation Notes

  • All changes follow AGENTS.md standards:

    • Uses standard Mermaid color scheme (#8B0000, #189AB4, #10B981, etc.)
    • Agent-centric code examples with proper imports
    • Concise explanations and active voice
    • Proper use of Mintlify components (Warning, Info, AccordionGroup)
  • Based on issue description of merged PR #1498 behavioral changes:

    • auto_approve_tools now defaults to True
    • default_tools excludes destructive tools like execute_command
    • Gateway applies same smart defaults as Bot()
    • YAML tools: [] is honored as explicit opt-out

Generated with Claude Code

Summary by CodeRabbit

Documentation

  • Updated bot gateway documentation to describe smart default behavior and verify consistency with the primary bot entry point
  • Added comprehensive "Smart Defaults" section explaining automatic safe tool injection, session history defaults, and auto-approval behavior when tools are not configured
  • Clarified default settings for tool auto-approval and safe default tool configuration options
  • Provided enhanced guidance for users to customize default tools or opt out of automatic defaults

…ral changes (fixes #219)

- Update auto_approve_tools default from False to True in config table and code
- Update default_tools list to remove execute_command, show only safe tools
- Add comprehensive Smart Defaults section with Mermaid diagrams
- Update Multi-Channel Gateway example with new channel-level options
- Add Best Practices entries for safe tools and approval flow requirements
- Add tip about omitting tools in Zero-Code Mode YAML
- Update bot-gateway.mdx with parity note between gateway and Bot() modes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

📝 Walkthrough

Walkthrough

This pull request updates documentation to describe smart defaults behavior in bot and gateway configurations. The changes document automatic safe tool injection, auto-approval defaults, and opt-out mechanisms that prevent the zero-tools daemon issue.

Changes

Cohort / File(s) Summary
Gateway Documentation
docs/features/bot-gateway.mdx
Added brief note confirming praisonai gateway start now uses identical smart-default behavior as praisonai bot start, auto-injecting safe tools and enabling auto-approval by default.
Messaging Bots Smart Defaults
docs/features/messaging-bots.mdx
Added comprehensive "Smart Defaults" section describing automatic safe tool injection when no tools are configured, auto-approval defaults (changed to True), session history behavior, and explicit opt-out instructions. Updated BotConfig documentation with revised default values and safe tool lists. Added best practices, accordion content, and YAML examples demonstrating omission of tools and channel-level overrides.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~20 minutes

Poem

🐰 A tale of tools both safe and sound,
Smart defaults now abound!
No more darkness, zero void—
Safe injection, auto-approved, enjoyed!
Gateway and bot, now hand in hand,
A harmonious, well-documented land.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: documentation updates to messaging-bots reflecting smart defaults and auto-approve behavioral changes, which aligns with the changeset.
Linked Issues check ✅ Passed The PR addresses issue #219 requirements: updates messaging-bots.mdx with Smart Defaults section, changed auto_approve_tools default to True, updated default_tools to exclude destructive tools, revised Configuration Options, updated Multi-Channel Gateway example, added Best Practices entries, updated Zero-Code Mode example, and updated bot-gateway.mdx with parity note.
Out of Scope Changes check ✅ Passed All changes in the PR are documentation updates directly addressing issue #219 objectives. No code changes, unrelated edits, or out-of-scope modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-219-20260422-0813

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation for PraisonAI bots and the Gateway Server to reflect new "Smart Defaults," including auto-injected safe tools, session history, and auto-approval. However, several critical inconsistencies were identified between the documentation and the current codebase. Specifically, the gateway server lacks the smart default logic, the default value for auto_approve_tools remains False in the code, and the mechanism to opt-out of tools using an empty list is currently non-functional. Additionally, the documentation should clarify that these defaults do not apply to AgentTeam or AgentFlow.


Run all your bots from one command. The Gateway Server manages multiple bot connections and routes messages to the right AI agent.

**Parity with Bot()**: `praisonai gateway start` now applies the same smart defaults as `praisonai bot start`, resolving the previous "zero tools in daemon mode" issue. Both entry points produce identical behavior with safe tools auto-injected and auto-approval enabled by default.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The claim that praisonai gateway start now applies the same smart defaults as Bot() is not reflected in the implementation of praisonai/gateway/server.py. The gateway server instantiates bots using platform-specific adapters (e.g., TelegramBot) directly and does not appear to invoke the _apply_smart_defaults logic found in the Bot wrapper class. This means features like auto-injected safe tools and session history might be missing when running via the gateway.

| `default_tools` | `list` | `["execute_command", ...]` | Default tools enabled for all bots |
| `auto_approve_tools` | `bool` | `False` | Skip tool execution confirmation (for trusted environments) |
| `default_tools` | `list[str]` | `["search_web", "web_crawl", "schedule_add", "schedule_list", "schedule_remove", "store_memory", "search_memory", "store_learning", "search_learning"]` | Safe tools auto-injected when the agent has no tools configured. Destructive tools (`execute_command`, `delete_file`, `write_file`, `shell_command`) are excluded from auto-injection even if listed. |
| `auto_approve_tools` | `bool` | `True` | Skip confirmation for safe tool execution. Chat bots can't show CLI approval prompts, so this defaults to `True`. Set `False` to require approval (only useful if you wire a chat-level approval flow). |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The documentation states that auto_approve_tools defaults to True. However, the BotConfig dataclass in praisonaiagents/bots/config.py (line 60) still defaults to False. Furthermore, the logic in praisonai/bots/bot.py (line 155) only enables auto-approval if a configuration is explicitly provided and has this flag set to True. This inconsistency could lead to tool calls hanging silently while waiting for a CLI prompt that the user cannot see.

Comment on lines +320 to +324
| Default | Applied when | What you get |
|---------|--------------|--------------|
| Safe tools | Agent has no `tools` configured | `search_web`, `web_crawl`, `schedule_*`, `store_memory`/`search_memory`, `store_learning`/`search_learning` |
| Auto-approval | `auto_approve_tools=True` (default) | Tool calls run without CLI prompts — chat bots can't show them anyway |
| Session history | Agent has no `memory` configured | Last 20 messages remembered per user, zero-dep |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It should be noted that these smart defaults currently only apply to individual Agent instances. The implementation in praisonai/bots/bot.py (lines 150-152) explicitly excludes AgentTeam and AgentFlow from receiving these automatic configurations.


| Goal | How |
|------|-----|
| Run with **zero** tools | Set `tools: []` explicitly in YAML, or pass `tools=[]` to `Agent` |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The documentation suggests that passing tools=[] allows running with zero tools. However, the implementation in praisonai/bots/bot.py (lines 181-182) uses getattr(agent, 'tools', None) or [] and then checks if not current_tools:. This logic treats an empty list the same as None, triggering the automatic injection of default tools. As a result, there is currently no way to explicitly opt out of default tools using an empty list.

| `group_policy` | `str` | `"mention_only"` | Group chat behavior: `respond_all`, `mention_only`, or `command_only` |
| `default_tools` | `list` | `["execute_command", ...]` | Default tools enabled for all bots |
| `auto_approve_tools` | `bool` | `False` | Skip tool execution confirmation (for trusted environments) |
| `default_tools` | `list[str]` | `["search_web", "web_crawl", "schedule_add", "schedule_list", "schedule_remove", "store_memory", "search_memory", "store_learning", "search_learning"]` | Safe tools auto-injected when the agent has no tools configured. Destructive tools (`execute_command`, `delete_file`, `write_file`, `shell_command`) are excluded from auto-injection even if listed. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a discrepancy between the default_tools listed here and the implementation in praisonaiagents/bots/config.py (line 52), which still includes "execute_command". Additionally, the smart default injection logic in praisonai/bots/bot.py (lines 186-191) uses hardcoded profiles and does not seem to respect the default_tools attribute from the configuration.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/features/bot-gateway.mdx`:
- Line 29: Update the documentation sentence that claims parity with Bot():
remove or correct the statement that "praisonai gateway start applies the same
smart defaults as praisionai bot start" and instead state that the gateway does
not call Bot._apply_smart_defaults() and only uses tools passed as
tools=agent_tools if agent_tools else None (so agents with zero configured tools
remain tool-less), and that the gateway does not wire auto_approve_tools to an
AutoApproveBackend; alternatively, if you prefer to keep the parity claim
implement the missing behavior by invoking Bot._apply_smart_defaults() and
wiring auto_approve_tools to an AutoApproveBackend in the gateway code paths
referenced, but for this change simply edit the doc sentence to accurately
reflect the gateway’s actual behavior.

In `@docs/features/messaging-bots.mdx`:
- Around line 318-323: The gateway's start_channels() currently builds a
BotConfig from channel YAML but only extracts token, allowed_users,
allowed_channels, and mention_required, so channel-level auto_approve_tools and
default_tools are ignored; update start_channels() to parse auto_approve_tools
and default_tools from the channel YAML and pass them into the BotConfig
constructor (the same fields used by Bot()), ensure BotConfig accepts these
fields if not already, and add a small unit/integration test that a channel YAML
with auto_approve_tools/default_tools results in a BotConfig with those values.
- Around line 322-335: Update the docs to reflect the actual behavior: state
that BotConfig.auto_approve_tools (auto_approve_tools) defaults to False, not
True; remove the claim that setting default_tools at the channel level overrides
injected tools (BotConfig.default_tools is not used by _apply_smart_defaults);
and clarify that tools: [] does not opt out of smart defaults because
Bot._apply_smart_defaults treats empty lists the same as None, so to disable
smart-default injection you must pre-configure the agent (set tools explicitly
on the Agent before passing it to Bot) or change the code to treat None vs []
differently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8913c854-7907-4b64-b212-d58dca83092d

📥 Commits

Reviewing files that changed from the base of the PR and between 927c44c and f408aea.

📒 Files selected for processing (2)
  • docs/features/bot-gateway.mdx
  • docs/features/messaging-bots.mdx


Run all your bots from one command. The Gateway Server manages multiple bot connections and routes messages to the right AI agent.

**Parity with Bot()**: `praisonai gateway start` now applies the same smart defaults as `praisonai bot start`, resolving the previous "zero tools in daemon mode" issue. Both entry points produce identical behavior with safe tools auto-injected and auto-approval enabled by default.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether gateway startup applies Bot smart defaults or channel-level defaults.
# Expected: the gateway agent initialization should call an equivalent of _apply_smart_defaults,
# or explicitly inject safe default tools and auto_approve_tools before registering agents.
rg -n -C10 'Agent\(|tools=agent_def\.get|auto_approve_tools|default_tools|_apply_smart_defaults' --iglob 'server.py'

Repository: MervinPraison/PraisonAIDocs

Length of output: 8570


🏁 Script executed:

# First, check the actual content of line 29 in bot-gateway.mdx
head -n 40 docs/features/bot-gateway.mdx | tail -n 15

Repository: MervinPraison/PraisonAIDocs

Length of output: 641


🏁 Script executed:

# Check full context of agent initialization in gateway server.py around line 1230-1290
sed -n '1230,1290p' praisonai/gateway/server.py

Repository: MervinPraison/PraisonAIDocs

Length of output: 2927


🏁 Script executed:

# Search for _apply_smart_defaults usage in gateway-related files
rg -n '_apply_smart_defaults' --glob '*gateway*' -A 3 -B 3

Repository: MervinPraison/PraisonAIDocs

Length of output: 53


🏁 Script executed:

# Search for auto_approve_tools in gateway files
rg -n 'auto_approve_tools' --glob '*gateway*' -A 2 -B 2

Repository: MervinPraison/PraisonAIDocs

Length of output: 53


🏁 Script executed:

# Check where agent_tools comes from in the agent creation context
sed -n '1200,1280p' praisonai/gateway/server.py | head -n 100

Repository: MervinPraison/PraisonAIDocs

Length of output: 4030


🏁 Script executed:

# Search for Bot class and _apply_smart_defaults in the codebase
rg -n 'class Bot|def _apply_smart_defaults' -A 5 --glob '*.py'

Repository: MervinPraison/PraisonAIDocs

Length of output: 7560


🏁 Script executed:

# Check what Bot() does for tools and auto_approve_tools
rg -n 'auto_approve_tools|safe.*tools|default.*tools' --glob 'bot.py' -A 2 -B 2

Repository: MervinPraison/PraisonAIDocs

Length of output: 3006


Remove or correct the smart defaults claim on line 29.

Line 29 claims praisonai gateway start applies the same smart defaults as praisonai bot start, but the gateway implementation (praisonai/gateway/server.py:1271-1280) does not call Bot._apply_smart_defaults(). The gateway only uses tools explicitly configured in YAML via tools=agent_tools if agent_tools else None, which means agents with zero configured tools still get zero tools—the "zero tools in daemon mode" issue is not resolved. Additionally, the gateway does not wire auto_approve_tools to an AutoApproveBackend as Bot does. Either implement these smart defaults in the gateway or correct the documentation to accurately describe the gateway's actual behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/features/bot-gateway.mdx` at line 29, Update the documentation sentence
that claims parity with Bot(): remove or correct the statement that "praisonai
gateway start applies the same smart defaults as praisionai bot start" and
instead state that the gateway does not call Bot._apply_smart_defaults() and
only uses tools passed as tools=agent_tools if agent_tools else None (so agents
with zero configured tools remain tool-less), and that the gateway does not wire
auto_approve_tools to an AutoApproveBackend; alternatively, if you prefer to
keep the parity claim implement the missing behavior by invoking
Bot._apply_smart_defaults() and wiring auto_approve_tools to an
AutoApproveBackend in the gateway code paths referenced, but for this change
simply edit the doc sentence to accurately reflect the gateway’s actual
behavior.

Comment on lines +318 to +323
Both `praisonai bot start` and `praisonai gateway start` apply the same defaults:

| Default | Applied when | What you get |
|---------|--------------|--------------|
| Safe tools | Agent has no `tools` configured | `search_web`, `web_crawl`, `schedule_*`, `store_memory`/`search_memory`, `store_learning`/`search_learning` |
| Auto-approval | `auto_approve_tools=True` (default) | Tool calls run without CLI prompts — chat bots can't show them anyway |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify whether channel-level gateway config is parsed and applied to agent defaults.
# Expected: channel config fields auto_approve_tools/default_tools are read and passed into
# smart-default application before agent registration or bot/channel startup.
rg -n -C10 'auto_approve_tools|default_tools|channels|routes|routing|tools=agent_def\.get|_apply_smart_defaults' --iglob 'server.py' --iglob '*.py'

Repository: MervinPraison/PraisonAIDocs

Length of output: 50384


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# First, find the gateway/server.py file
fd -type f -name "server.py" | grep gateway

# Then examine the specific line ranges mentioned (1230-1280, 1279-1308)
if [ -f "praisonai/gateway/server.py" ]; then
  echo "=== Lines 1230-1280 ===" 
  sed -n '1230,1280p' praisonai/gateway/server.py | cat -n
  echo ""
  echo "=== Lines 1279-1310 ===" 
  sed -n '1279,1310p' praisonai/gateway/server.py | cat -n
fi

Repository: MervinPraison/PraisonAIDocs

Length of output: 241


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Search for where agents are created in gateway and how config is applied
# Look for agent instantiation patterns and config handling
rg -n "agent_defs|channel.*config|auto_approve|default_tools|_apply_smart_defaults" praisonai/gateway/server.py | head -100

Repository: MervinPraison/PraisonAIDocs

Length of output: 320


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check file size first
wc -l praisonai/gateway/server.py || echo "File not found"

Repository: MervinPraison/PraisonAIDocs

Length of output: 103


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the specific lines mentioned in the review
echo "=== Lines 1230-1280 ===" 
sed -n '1230,1280p' praisonai/gateway/server.py

echo ""
echo "=== Lines 1279-1320 ===" 
sed -n '1279,1320p' praisonai/gateway/server.py

Repository: MervinPraison/PraisonAIDocs

Length of output: 4079


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the _create_bot method to understand how agents are instantiated
rg -n "_create_bot" praisonai/gateway/server.py -A 30 | head -80

Repository: MervinPraison/PraisonAIDocs

Length of output: 2445


🏁 Script executed:

#!/bin/bash
set -euo pivefail

# Search for Bot() instantiation to see what parameters are passed
rg -n "Bot\(" praisonai/gateway/server.py -B 3 -A 5 | head -100

Repository: MervinPraison/PraisonAIDocs

Length of output: 124


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for Bot() instantiation in bots module to see what parameters it accepts
rg -n "class.*Bot|def __init__" praisonai/bots/ -A 15 | grep -A 15 "auto_approve\|default_tools" | head -50

Repository: MervinPraison/PraisonAIDocs

Length of output: 53


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check what the config object passed to Bot() contains
# Search for how gateway config is structured and passed to bots
rg -n "self.config|config\.get|_apply_smart_defaults|auto_approve_tools|default_tools" praisonai/gateway/server.py

Repository: MervinPraison/PraisonAIDocs

Length of output: 1475


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look at the Bot class initialization to see what parameters it accepts
rg -n "class Bot" praisonai/bots/__init__.py -A 30 | head -60

Repository: MervinPraison/PraisonAIDocs

Length of output: 53


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find if there's any smart defaults application in the gateway initialization
rg -n "smart.*default|_apply_smart_defaults" praisonai/ -r 2>/dev/null | head -20

Repository: MervinPraison/PraisonAIDocs

Length of output: 53


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the Bot class definition to understand what parameters it accepts
find praisonai -name "*.py" -type f | xargs grep -l "^class Bot" | head -5

Repository: MervinPraison/PraisonAIDocs

Length of output: 204


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the bots module structure
ls -la praisonai/bots/ 2>/dev/null || echo "Directory not found"

# Look for where auto_approve_tools might be defined
rg -n "auto_approve_tools|default_tools" praisonai/ --type py | head -30

Repository: MervinPraison/PraisonAIDocs

Length of output: 4615


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check if channel config in gateway.yaml gets passed to agent or bot
# Look at _create_bot signature and how ch_cfg (channel config) is used
sed -n '1413,1470p' praisonai/gateway/server.py

Repository: MervinPraison/PraisonAIDocs

Length of output: 2723


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the Bot class __init__ to see what it does with config parameter
sed -n '1,250p' praisonai/bots/bot.py | cat -n

Repository: MervinPraison/PraisonAIDocs

Length of output: 10852


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check how gateway config is constructed and whether channel config is merged in
# Look at the initialization of gateway config and how it's passed down
rg -n "GatewayConfig|self.config.*=" praisonai/gateway/server.py | head -40

Repository: MervinPraison/PraisonAIDocs

Length of output: 406


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check if channel config (ch_cfg) is ever merged with gateway config before Bot creation
sed -n '1300,1430p' praisonai/gateway/server.py | cat -n

Repository: MervinPraison/PraisonAIDocs

Length of output: 6704


Don't advertise gateway/channel-level smart defaults unless gateway config consumes them.

The documentation claims that channel-level auto_approve_tools / default_tools settings work in gateway with feature parity to Bot(). However, praisonai/gateway/server.py:1330-1390 shows gateway's start_channels() method creates a BotConfig from channel YAML (lines 1382-1387) that only extracts: token, allowed_users, allowed_channels, and mention_required. The channel config does not read or pass auto_approve_tools or default_tools fields to BotConfig. Users adding these fields to their channel config will find them silently ignored—the smart defaults never get applied because the configuration is never parsed from the YAML.

Also applies to: 1279-1308

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/features/messaging-bots.mdx` around lines 318 - 323, The gateway's
start_channels() currently builds a BotConfig from channel YAML but only
extracts token, allowed_users, allowed_channels, and mention_required, so
channel-level auto_approve_tools and default_tools are ignored; update
start_channels() to parse auto_approve_tools and default_tools from the channel
YAML and pass them into the BotConfig constructor (the same fields used by
Bot()), ensure BotConfig accepts these fields if not already, and add a small
unit/integration test that a channel YAML with auto_approve_tools/default_tools
results in a BotConfig with those values.

Comment on lines +322 to +335
| Safe tools | Agent has no `tools` configured | `search_web`, `web_crawl`, `schedule_*`, `store_memory`/`search_memory`, `store_learning`/`search_learning` |
| Auto-approval | `auto_approve_tools=True` (default) | Tool calls run without CLI prompts — chat bots can't show them anyway |
| Session history | Agent has no `memory` configured | Last 20 messages remembered per user, zero-dep |

### Opting out

| Goal | How |
|------|-----|
| Run with **zero** tools | Set `tools: []` explicitly in YAML, or pass `tools=[]` to `Agent` |
| Require manual approval | Set `auto_approve_tools: false` in the channel config |
| Override the tool list | Set `default_tools: [...]` under the channel — destructive tools are still filtered |

<Warning>
Destructive tools (`execute_command`, `delete_file`, `write_file`, `shell_command`) are **never auto-injected**, even if you add them to `default_tools`. Wire them explicitly on the agent and add a chat-level approval flow.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify BotConfig defaults and smart-default semantics.
# Expected for these docs to be accurate:
# - auto_approve_tools defaults to True
# - default_tools excludes execute_command and other dangerous tools
# - _apply_smart_defaults distinguishes missing tools from explicit tools=[]
# - dangerous tools are filtered before auto-injection
rg -n -C4 'default_tools|auto_approve_tools' --iglob 'config.py'
rg -n -C8 'def _apply_smart_defaults|if not agent\.tools|agent\.tools\.extend|auto_approve_tools|DEFAULT_DANGEROUS_TOOLS' --iglob 'bot.py' --iglob 'registry.py'

Repository: MervinPraison/PraisonAIDocs

Length of output: 9242


🏁 Script executed:

# See full _apply_smart_defaults method and related tool injection/filtering logic
rg -n -A30 'def _apply_smart_defaults' praisonai/bots/bot.py

# Check if tools are extended or filtered during smart defaults
rg -n -A20 'agent\.tools\s*=' praisonai/bots/bot.py

# Look for dangerous tool filtering logic
rg -n 'DANGEROUS_TOOLS|dangerous.*tool|filter.*tool' --iglob 'bot.py'

Repository: MervinPraison/PraisonAIDocs

Length of output: 3418


🏁 Script executed:

sed -n '136,210p' praisonai/bots/bot.py

Repository: MervinPraison/PraisonAIDocs

Length of output: 3833


🏁 Script executed:

# Find tool profiles definition
rg -n -A20 'resolve_profiles|def resolve_profiles' --iglob 'profiles.py'

# Check all references to default_tools from BotConfig
rg -n 'default_tools' --iglob 'bot.py' --iglob 'adapter' --iglob 'gateway'

# Verify if BotConfig.default_tools is used in the channel config
rg -n -B5 -A5 'default_tools.*:' docs/features/messaging-bots.mdx

Repository: MervinPraison/PraisonAIDocs

Length of output: 6018


🏁 Script executed:

# Find BUILTIN_PROFILES definition
rg -n -A100 'BUILTIN_PROFILES' praisonaiagents/tools/profiles.py | head -150

Repository: MervinPraison/PraisonAIDocs

Length of output: 5306


Update documented defaults and correct tool opt-out semantics.

These lines document auto_approve_tools=True as the default and tools: [] as an explicit opt-out, but the implementation contradicts both:

  • auto_approve_tools default is False: praisonaiagents/bots/config.py:60 sets auto_approve_tools: bool = False, not True. Docs line 1279 incorrectly claim true is the default for chat bots.
  • tools: [] does NOT opt out: praisonai/bots/bot.py:177–178 treats tools=None and tools=[] identically via if not current_tools:, so setting tools: [] still triggers smart defaults injection, not prevention.
  • default_tools in config is unused: BotConfig.default_tools (which includes execute_command) is never referenced in _apply_smart_defaults. The code instead uses resolve_profiles("web", "schedule", "memory", "learning") which only includes safe tools (search_web, schedule_*, store_memory, search_learning). The promise that destructive tools are never auto-injected is correct but misleading—it's by design (safe profiles only), not by filtering.

Channel-level default_tools overrides (docs line 332) have no effect. Remove the claim about setting default_tools under the channel, and clarify that disabling smart defaults entirely requires pre-configuring the agent before passing it to Bot().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/features/messaging-bots.mdx` around lines 322 - 335, Update the docs to
reflect the actual behavior: state that BotConfig.auto_approve_tools
(auto_approve_tools) defaults to False, not True; remove the claim that setting
default_tools at the channel level overrides injected tools
(BotConfig.default_tools is not used by _apply_smart_defaults); and clarify that
tools: [] does not opt out of smart defaults because Bot._apply_smart_defaults
treats empty lists the same as None, so to disable smart-default injection you
must pre-configure the agent (set tools explicitly on the Agent before passing
it to Bot) or change the code to treat None vs [] differently.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Update messaging-bots for smart defaults + auto-approve behavioral changes (PraisonAI PR #1498)

2 participants