Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn id(&self) -> &PluginId;
    fn manifest(&self) -> &PluginManifest;
    fn state(&self) -> PluginState;
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 PluginContext,
    ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unload<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn tools(&self) -> &[Box<dyn PluginTool>];
}
Expand description

A loaded plugin that can provide tools to the runtime.

Implementors handle the plugin lifecycle (load/unload) and expose tools that the agent can invoke.

Required Methods§

Source

fn id(&self) -> &PluginId

The unique identifier for this plugin.

Source

fn manifest(&self) -> &PluginManifest

The manifest that describes this plugin.

Source

fn state(&self) -> PluginState

Current lifecycle state.

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load the plugin, initializing any resources it needs.

Called once when the plugin is first activated. The plugin should transition from UnloadedLoadingReady (or Failed).

Source

fn unload<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unload the plugin, releasing resources.

Called when the plugin is being deactivated or the runtime is shutting down.

Source

fn tools(&self) -> &[Box<dyn PluginTool>]

The tools this plugin provides.

Returns an empty slice if the plugin has no tools or is not loaded.

Trait Implementations§

Source§

impl Debug for dyn Plugin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§