pub struct Executor { /* private fields */ }Expand description
Tool execution engine.
Manages enrichers and dispatches tool calls to providers.
Stateless per call — provider is created from AdditionalContext each time.
Implementations§
Source§impl Executor
impl Executor
pub fn new() -> Executor
Sourcepub fn with_asset_manager(self, mgr: AssetManager) -> Executor
pub fn with_asset_manager(self, mgr: AssetManager) -> Executor
Configure an optional local asset cache for download/delete operations.
Sourcepub fn add_enricher(&mut self, enricher: Box<dyn ToolEnricher>)
pub fn add_enricher(&mut self, enricher: Box<dyn ToolEnricher>)
Register an enricher (provider, pipeline, or custom). Enrichers are applied in registration order.
Sourcepub fn list_tools(&self) -> Vec<ToolDefinition>
pub fn list_tools(&self) -> Vec<ToolDefinition>
List available tools with enriched schemas.
- Starts with base tool definitions
- Keeps only tools whose category is supported by at least one enricher
- Applies schema enrichment from enrichers that support each tool’s category
Sourcepub async fn execute(
&self,
tool: &str,
args: Value,
ctx: &AdditionalContext,
) -> Result<ToolOutput, Error>
pub async fn execute( &self, tool: &str, args: Value, ctx: &AdditionalContext, ) -> Result<ToolOutput, Error>
Execute a tool with the given arguments and context.
Flow:
- Pre-execute: enrichers transform args
- Create provider from context (cheap, stack-allocated)
- Dispatch tool call to provider method
- Post-execute: enrichers transform output
- Return typed ToolOutput
Sourcepub async fn execute_direct(
&self,
tool: &str,
args: Value,
provider: &dyn Provider,
) -> Result<ToolOutput, Error>
pub async fn execute_direct( &self, tool: &str, args: Value, provider: &dyn Provider, ) -> Result<ToolOutput, Error>
Execute a tool with a pre-created Provider (for MCP server). Enrichers are applied if configured.
Sourcepub async fn execute_direct_meeting(
&self,
tool: &str,
args: Value,
provider: &dyn MeetingNotesProvider,
) -> Result<ToolOutput, Error>
pub async fn execute_direct_meeting( &self, tool: &str, args: Value, provider: &dyn MeetingNotesProvider, ) -> Result<ToolOutput, Error>
Execute a meeting tool with a pre-created MeetingNotesProvider.
Sourcepub async fn execute_direct_knowledge_base(
&self,
tool: &str,
args: Value,
provider: &dyn KnowledgeBaseProvider,
) -> Result<ToolOutput, Error>
pub async fn execute_direct_knowledge_base( &self, tool: &str, args: Value, provider: &dyn KnowledgeBaseProvider, ) -> Result<ToolOutput, Error>
Execute a knowledge base tool with a pre-created KnowledgeBaseProvider.
Sourcepub async fn execute_direct_messenger(
&self,
tool: &str,
args: Value,
provider: &dyn MessengerProvider,
) -> Result<ToolOutput, Error>
pub async fn execute_direct_messenger( &self, tool: &str, args: Value, provider: &dyn MessengerProvider, ) -> Result<ToolOutput, Error>
Execute a messenger tool with a pre-created MessengerProvider.
Sourcepub fn tool_category(tool: &str) -> Option<ToolCategory>
pub fn tool_category(tool: &str) -> Option<ToolCategory>
Get the tool category for a tool name, if known.