Overview
The Tool Override system allows loading custom tools from Python files, modules, and directories at runtime. This enables extending PraisonAI with custom functionality without modifying the core package.
Python API
Context Manager Pattern
Use the context manager for temporary tool overrides:
PraisonAI checks these locations for custom tools:
Implicit tools.py autoload from the current working directory is disabled by default. To enable this legacy behavior, set PRAISONAI_ALLOW_TEMPLATE_TOOLS=1. For new projects, prefer explicit override_files or override_dirs configuration.
Discover tool names without importing/executing code:
Security
Local Paths Only
Remote URLs are rejected by default:
Safe Defaults
- Only local file paths are allowed
- Implicit
tools.py autoload from CWD or template directories is disabled by default — opt in with PRAISONAI_ALLOW_TEMPLATE_TOOLS=1
- Discovery uses AST parsing (no execution)
- Context manager ensures cleanup
For legacy workflows that depend on automatic tools.py loading:
Accepted truthy values: 1, true, yes, on (case-insensitive, whitespace-stripped)
Recommended approach: Use explicit override_files, override_dirs, or tools_sources configuration instead of relying on implicit autoload. See Security Environment Variables for more details.
Create a Python file with functions: