Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
ToolResolver is the one place PraisonAI looks for tools.py — whether it ships callables or BaseTool classes.
Quick Start
Basic Usage
Drop a
tools.py next to your YAML/script, set the environment variable, and the resolver picks both kinds up automatically:How It Works
The resolver delegates to_safe_loader.load_user_module for consistent environment variable checking and CWD path-traversal guard. The loaded module is reflected to extract either plain functions or tool class instances, then cached as an immutable view for thread safety.
Two Flavours of tools.py
What’s in tools.py | Method | Returned shape |
|---|---|---|
| Plain Python functions | get_local_callables() | List[Callable] |
praisonai_tools.BaseTool / praisonai.tools.BaseTool / langchain_community.tools.* classes | get_local_tool_classes() | Dict[str, ToolInstance] (instantiated) |
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
tools_py_path | Optional[str] | "tools.py" | Path to tools.py file to load |
Common Patterns
- Loading from Custom Path
- Reloading After Edits
- Mixed Function and Class Tools
Security
Security enforcement is handled by_safe_loader.load_user_module:
- Environment gate: Requires
PRAISONAI_ALLOW_LOCAL_TOOLS=true - CWD constraint: Refuses paths outside current working directory
- Path traversal protection: Prevents
../style attacks
Caching Behaviour
- First call: Loads and caches tools.py content
- Subsequent calls: Returns cached immutable view (
MappingProxyType) - Thread safety: Uses locks for concurrent access
- Cache clearing:
clear_cache()resets for reloading
Best Practices
Keep tools.py in your CWD
Keep tools.py in your CWD
Place
tools.py in your current working directory. Paths outside CWD are refused even with the environment variable set. This prevents path traversal attacks from HTTP API callers.Prefer functions for praisonaiagents
Prefer functions for praisonaiagents
Use plain Python functions for
praisonaiagents agents. Reserve BaseTool classes for crewai-style flows or when you need complex tool state management.Import from the wrapper package
Import from the wrapper package
Don’t import
ToolResolver from praisonaiagents — it lives in the wrapper at praisonai.tool_resolver. The wrapper handles YAML-based tool resolution.Set environment variable only in trusted environments
Set environment variable only in trusted environments
Set
PRAISONAI_ALLOW_LOCAL_TOOLS=true only in development or trusted deployment environments. This prevents arbitrary code execution from untrusted working directories.Related
Security Environment Variables
Environment variable security controls
Tools
General tools documentation

