Skip to main content

AsyncTool

Trait AsyncTool 

Source
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§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

fn parameter_schema(&self) -> Value

Source

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§

Source

fn as_any(&self) -> Option<&dyn Any>

Optional downcast hook. Override in concrete types that need session-aware dispatch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§