Skip to main content

BasicToolExecutor

Struct BasicToolExecutor 

Source
pub struct BasicToolExecutor { /* private fields */ }
Expand description

The default ToolExecutor that looks up tools in a ToolRegistry, checks permissions via Tool::proposed_requests, and invokes the tool.

§Example

use agentkit_tools_core::{BasicToolExecutor, ToolRegistry};

let registry = ToolRegistry::new();
let executor = BasicToolExecutor::new(registry);
// Pass `executor` to the agent loop.

Implementations§

Source§

impl BasicToolExecutor

Source

pub fn new(registry: ToolRegistry) -> Self

Creates an executor backed by the given registry.

Source

pub fn specs(&self) -> Vec<ToolSpec>

Returns the ToolSpec for every tool in the underlying registry.

Trait Implementations§

Source§

impl ToolExecutor for BasicToolExecutor

Source§

fn specs(&self) -> Vec<ToolSpec>

Returns the current specification for every available tool.
Source§

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: ToolRequest, ctx: &'life1 mut ToolContext<'life2>, ) -> Pin<Box<dyn Future<Output = ToolExecutionOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Looks up the tool, evaluates permissions, and invokes it.
Source§

fn execute_approved<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, request: ToolRequest, approved_request: &'life1 ApprovalRequest, ctx: &'life2 mut ToolContext<'life3>, ) -> Pin<Box<dyn Future<Output = ToolExecutionOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Re-executes a tool call that was previously interrupted for approval. Read more
Source§

fn execute_owned<'life0, 'async_trait>( &'life0 self, request: ToolRequest, ctx: OwnedToolContext, ) -> Pin<Box<dyn Future<Output = ToolExecutionOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Looks up the tool, evaluates permissions, and invokes it using an owned execution context.
Source§

fn execute_approved_owned<'life0, 'life1, 'async_trait>( &'life0 self, request: ToolRequest, approved_request: &'life1 ApprovalRequest, ctx: OwnedToolContext, ) -> Pin<Box<dyn Future<Output = ToolExecutionOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Re-executes a tool call that was previously interrupted for approval using an owned execution context.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.