Quick Start
1
Create a Plugin
2
Register with Manager
Plugin Types
Tool Plugin
Hook Plugin
Agent Plugin
LLM Plugin
Plugin Hooks
Plugin Manager
Discovery & Loading
PluginManager loads plugin files from disk and reports how many it loaded.
loadFromDirectory(path: string): number
- Synchronous
require(); supports.js,.cjs, and.ts(under ts-node / ts-jest). - Skips
.mjs,.d.ts, and files whose name starts with_. - Broken files log a warning and do NOT abort the scan.
autoDiscoverPlugins(): number
- Scans
<cwd>/.praisonai/plugins/(project) and~/.praisonai/plugins/(user). PRAISONAI_ALLOW_PLUGIN_DISCOVERYmust be'true','1', or'yes'(case-insensitive) for the scan to run; otherwise it returns0.- Returns
0in non-Node runtimes.
Plugin file convention (CommonJS)
createPlugin() factory, a Plugin subclass constructor, or an existing Plugin instance — exported as createPlugin, plugin, or default.
autoDiscoverPlugins() and loadFromDirectory() now return a count (they used to return void). Existing callers that ignored the return value keep working; callers that want to know whether anything loaded can now read the number.Function Plugin
Create simple function-based plugins:API Reference
PluginManager
Plugin manager class
Plugin
Plugin base class
Best Practices
Use appropriate plugin types
Use appropriate plugin types
Choose
ToolPlugin for adding capabilities, HookPlugin for intercepting events, AgentPlugin for modifying behavior.Handle errors gracefully
Handle errors gracefully
Always wrap plugin logic in try-catch blocks to prevent breaking the agent pipeline.
Keep plugins lightweight
Keep plugins lightweight
Plugins run in the hot path - avoid heavy computations or blocking operations.
Version your plugins
Version your plugins
Use semantic versioning to track plugin compatibility with SDK versions.
Related
Hooks
Hook system for event handling
Tools
Create custom tools

