Skip to main content
Extend your agents with powerful plugins that add tools, hooks, and custom functionality.

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_DISCOVERY must be 'true', '1', or 'yes' (case-insensitive) for the scan to run; otherwise it returns 0.
  • Returns 0 in non-Node runtimes.

Plugin file convention (CommonJS)

Recognised shapes on the loaded module: a 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

Choose ToolPlugin for adding capabilities, HookPlugin for intercepting events, AgentPlugin for modifying behavior.
Always wrap plugin logic in try-catch blocks to prevent breaking the agent pipeline.
Plugins run in the hot path - avoid heavy computations or blocking operations.
Use semantic versioning to track plugin compatibility with SDK versions.

Hooks

Hook system for event handling

Tools

Create custom tools