pub struct BasicToolExecutor { /* private fields */ }Expand description
The default ToolExecutor that walks one or more ToolSources,
checks permissions via Tool::proposed_requests, and invokes the tool.
Compose static native tools (a frozen ToolRegistry) alongside
dynamic sources (a CatalogReader minted by dynamic_catalog and
owned by an MCP manager, skill watcher, plugin loader, etc.) without
merging into a single mutable registry.
§Example
use std::sync::Arc;
use agentkit_tools_core::{BasicToolExecutor, ToolRegistry, ToolSource};
let static_registry: Arc<dyn ToolSource> = Arc::new(ToolRegistry::new());
let executor = BasicToolExecutor::new([static_registry]);
// Pass `executor` to the agent loop.Implementations§
Source§impl BasicToolExecutor
impl BasicToolExecutor
Sourcepub fn new(sources: impl IntoIterator<Item = Arc<dyn ToolSource>>) -> Self
pub fn new(sources: impl IntoIterator<Item = Arc<dyn ToolSource>>) -> Self
Creates an executor that walks sources in order on every lookup.
Sourcepub fn from_registry(registry: ToolRegistry) -> Self
pub fn from_registry(registry: ToolRegistry) -> Self
Back-compat shorthand: wrap a single ToolRegistry as the only source.
Sourcepub fn with_collision_policy(self, policy: CollisionPolicy) -> Self
pub fn with_collision_policy(self, policy: CollisionPolicy) -> Self
Sets the collision policy applied when the same tool name appears in multiple sources.
Sourcepub fn with_output_truncation_strategy(
self,
strategy: impl ToolOutputTruncationStrategy + 'static,
) -> Self
pub fn with_output_truncation_strategy( self, strategy: impl ToolOutputTruncationStrategy + 'static, ) -> Self
Installs a central tool-output truncation strategy. The strategy runs after every successful tool invocation and before the result is returned to the agent loop.
Sourcepub fn with_output_truncation_strategy_arc(
self,
strategy: Arc<dyn ToolOutputTruncationStrategy>,
) -> Self
pub fn with_output_truncation_strategy_arc( self, strategy: Arc<dyn ToolOutputTruncationStrategy>, ) -> Self
Installs a pre-wrapped central tool-output truncation strategy.