Skip to main content

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 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.

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.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

Opting in to implicit tools.py autoload

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.

Custom Tool File Format

Create a Python file with functions: