Skip to main content

AgentTool

Trait AgentTool 

Source
pub trait AgentTool: Send + Sync {
    // Required methods
    fn tool(&self) -> &Tool;
    fn execute<'a>(
        &'a self,
        tool_call_id: &'a str,
        args: Value,
        signal: &'a AbortSignal,
        on_update: &'a ToolUpdate<'a>,
    ) -> BoxFuture<'a, Result<AgentToolResult, String>>;
}
Expand description

An executable tool. Err is a thrown error: it becomes an error result with the message as text.

Required Methods§

Source

fn tool(&self) -> &Tool

The declaration the model sees.

Source

fn execute<'a>( &'a self, tool_call_id: &'a str, args: Value, signal: &'a AbortSignal, on_update: &'a ToolUpdate<'a>, ) -> BoxFuture<'a, Result<AgentToolResult, String>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§