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
ToolOverrideLoader
Context Manager Pattern
Use the context manager for temporary tool overrides:Creating Tool Registry with Overrides
Default Custom Tool Directories
PraisonAI loads custom tools from two distinct groups. Autoload-gated files load only whenPRAISONAI_ALLOW_TEMPLATE_TOOLS=1:
Default custom dirs are always scanned when
include_defaults=True:
What the wrapper does not own
create_tool_registry_with_overrides() used to re-implement praisonai-tools package discovery and a praisonaiagents built-ins hook of its own. As of PraisonAI#3122 those are handled only by the canonical ToolResolver, so:
- You do not need to install
praisonai-toolsdifferently —resolve_tools()still finds it via the canonical resolver. - A tool that resolved through the wrapper’s old package-discovery block still resolves — just one implementation away, in the resolver instead.
- The template/CWD
tools.pyautoload stays in the wrapper on purpose. It carries thePRAISONAI_ALLOW_TEMPLATE_TOOLSgate (with a skip-on-error contract and explicit-template-dir-outside-CWD support) that the resolver’sPRAISONAI_ALLOW_LOCAL_TOOLS+ CWD-boundary gate does not provide.
Discovering Tools Without Execution
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.pyautoload from CWD or template directories is disabled by default — opt in withPRAISONAI_ALLOW_TEMPLATE_TOOLS=1 - Discovery uses AST parsing (no execution)
- Context manager ensures cleanup
Opting in to implicit tools.py autoload
For legacy workflows that depend on automatic tools.py loading:
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.

