Single-File Plugins
PraisonAI supports a simplified plugin format inspired by WordPress - just a single Python file with metadata in a docstring header.Single-file plugins are the easiest way to extend PraisonAI with custom tools and hooks. No package structure, no configuration files - just one
.py file.Quick Start
1
Simple Usage
1. Create a Plugin
Create a plugin file under~/.praisonai/plugins/ — see the steps below.2
With Configuration
Load plugins via
PluginManager or drop a .py file in your project .praison/plugins/ directory.1. Create a Plugin
Create a file in~/.praisonai/plugins/ or ./.praison/plugins/:
2. Use in Your Agent
Tools from plugins are automatically discovered:Plugin Header Format
The plugin header is a docstring at the top of the file with WordPress-style metadata:Required Fields
Optional Fields
Plugin Directories
Plugins are discovered from these directories (in order):- Project-level:
./.praison/plugins/- Plugins specific to your project - User-level:
~/.praisonai/plugins/- Plugins available to all your projects
Adding Tools
Use the@tool decorator to create tools:
Adding Hooks
Use theadd_hook decorator to intercept agent lifecycle events:
Available Hooks
CLI Commands
- Create Plugin
- List & Scan
- Load & Discover
- Template
Programmatic Usage
Load Plugins Manually
Use with PluginManager
Best Practices
Keep It Simple
Keep It Simple
One plugin = one purpose. Don’t cram unrelated tools into one file.
Document Tools
Document Tools
Use clear docstrings — they become the tool descriptions for the LLM.
Handle Errors
Handle Errors
Return meaningful error messages instead of raising exceptions.
Type Hints
Type Hints
Always use type hints — they help generate accurate tool schemas.
Good Plugin Example
Troubleshooting
Plugin not discovered
Plugin not discovered
- Check the file is in
.praison/plugins/or~/.praisonai/plugins/ - Ensure the file has a
.pyextension - Verify the docstring header has
Plugin Name:field - Files starting with
_are skipped
Tools not registered
Tools not registered
- Make sure you’re using the
@tooldecorator - Check for import errors in your plugin
- Run with verbose logging to see errors
Hooks not firing
Hooks not firing
- Verify the hook name is correct (e.g.,
before_tool) - Check that the hook function signature matches expected parameters
- Ensure the plugin is loaded before the agent runs
Next Steps
Tools Guide
Learn more about creating tools
Hooks System
Deep dive into the hooks system
Agent Configuration
Configure agents to use your plugins
Examples
See more plugin examples
Related
Custom Tools
Build your own agent tools
Tools Overview
Browse PraisonAI tool documentation

