pub trait AsyncTool:
Send
+ Sync
+ Debug {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn parameter_schema(&self) -> Value;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, TypeError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn as_any(&self) -> Option<&dyn Any> { ... }
}Expand description
Async version of the Tool trait for use in the agentic loop. Implements async execute for non-blocking tool execution.
Required Methods§
fn name(&self) -> &str
fn description(&self) -> &str
fn parameter_schema(&self) -> Value
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, TypeError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".