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.
Overview
PraisonAI automatically discovers tools from multiple sources. The show-sources command displays all configured tool sources and their resolution order.
Tools are resolved in the following order (highest priority first):
| Priority | Source | Description |
|---|
| 1 | Override files | Explicit --tools CLI flag |
| 2 | Override directories | Explicit --tools-dir CLI flag |
| 3 | Template tools_sources | From TEMPLATE.yaml |
| 4 | Template-local tools.py | In template directory |
| 5 | Current directory tools.py | ./tools.py in working directory |
| 6 | Default custom dirs | ~/.praisonai/tools, ~/.config/praison/tools |
| 7 | Package discovery | praisonai_tools if installed |
| 8 | Built-in tools | praisonaiagents.tools.TOOL_MAPPINGS |
Code Usage
from pathlib import Path
# Tool sources resolution order
sources = {
"built_in": "praisonaiagents.tools.TOOL_MAPPINGS",
"package_discovery": ["praisonai_tools"],
"default_dirs": [
"~/.praisonai/tools",
"~/.config/praison/tools",
],
"cwd_tools_py": "./tools.py", # Current working directory
}
# Check if tools.py exists in current directory
cwd_tools_py = Path.cwd() / "tools.py"
if cwd_tools_py.exists():
print(f"Found local tools.py: {cwd_tools_py}")
# Check template-specific sources
from praisonai.templates.loader import TemplateLoader
loader = TemplateLoader()
template = loader.load_template("ai-video-editor")
if template.requires:
tools_sources = template.requires.get("tools_sources", [])
print(f"Template tools_sources: {tools_sources}")
# Check for template-local tools.py
tools_py = Path(template.path) / "tools.py"
if tools_py.exists():
print(f"Template local tools.py: {tools_py}")
If a tools.py file exists in your current working directory, it will be automatically loaded when running templates or agents. This is useful for project-specific tools:
# tools.py (in your project directory)
def my_custom_tool(query: str) -> str:
"""My custom tool for this project."""
return f"Processing: {query}"
def another_tool(data: dict) -> dict:
"""Another project-specific tool."""
return {"result": data}
These tools will be available to your agents without any additional configuration.