Plugin Manager • Rust AI Agent SDK

PluginManager: Manages plugin registration and execution.

PluginManager

Defined in the plugins module.

Rust AI Agent SDK

Manages plugin registration and execution.

Fields

NameTypeDescription
pluginsHashMap<StringRegistered plugins
enabledHashMap<StringEnabled plugins
hook_mapHashMap<PluginHookHook to plugin mapping

Methods

new

rust
fn new() -> Self

Create a new plugin manager

register

rust
fn register(&mut self, plugin: impl Plugin + 'static) -> ()

Register a plugin

Parameters:

NameType
pluginimpl Plugin + 'static

enable

rust
fn enable(&mut self, name: &str) -> bool

Enable a plugin

Parameters:

NameType
name&str

disable

rust
fn disable(&mut self, name: &str) -> bool

Disable a plugin

Parameters:

NameType
name&str

is_enabled

rust
fn is_enabled(&self, name: &str) -> bool

Check if a plugin is enabled

Parameters:

NameType
name&str

list_plugins

rust
fn list_plugins(&self) -> Vec<PluginInfo>

List all plugins

get

rust
fn get(&self, name: &str) -> Option<Arc<RwLock<Box<dyn Plugin>>>>

Get plugin by name

Parameters:

NameType
name&str

execute_hook

rust
fn execute_hook(
        &self,
        hook: PluginHook,
        data: serde_json::Value,
    ) -> Result<serde_json::Value>

Execute hooks for a specific hook type

Parameters:

NameType
hookPluginHook
dataserde_json::Value

get_hook_plugins

rust
fn get_hook_plugins(&self, hook: PluginHook) -> Vec<String>

Get plugins that handle a specific hook

Parameters:

NameType
hookPluginHook

len

rust
fn len(&self) -> usize

Count registered plugins

is_empty

rust
fn is_empty(&self) -> bool

Check if empty

enabled_count

rust
fn enabled_count(&self) -> usize

Count enabled plugins

Source

View on GitHub

praisonai/src/plugins/mod.rs at line 258


Related Documentation