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§
Sourcefn manifest(&self) -> &PluginManifest
fn manifest(&self) -> &PluginManifest
The manifest that describes this plugin.
Sourcefn state(&self) -> PluginState
fn state(&self) -> PluginState
Current lifecycle state.
Sourcefn 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 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 Unloaded → Loading → Ready (or Failed).
Sourcefn unload<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = PluginResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
Unload the plugin, releasing resources.
Called when the plugin is being deactivated or the runtime is shutting down.
Sourcefn tools(&self) -> &[Box<dyn PluginTool>]
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.