Skip to main content

AppToolsExt

Trait AppToolsExt 

Source
pub trait AppToolsExt {
    // Required methods
    fn add_tool_with<T: Tool + 'static>(
        &mut self,
        tool: T,
        options: ToolOptions,
    ) -> &mut Self;
    fn add_open_tool<A, M>(
        &mut self,
        name: &str,
        description: &str,
        options: ToolOptions,
        observer: impl IntoObserverSystem<ToolCalled<A>, M>,
    ) -> &mut Self
       where A: DeserializeOwned + JsonSchema + Send + Sync + 'static;

    // Provided method
    fn add_tool<T: Tool + 'static>(&mut self, tool: T) -> &mut Self { ... }
}
Expand description

Registers tools on an App.

Required Methods§

Source

fn add_tool_with<T: Tool + 'static>( &mut self, tool: T, options: ToolOptions, ) -> &mut Self

add_tool, with what its calls touch.

Source

fn add_open_tool<A, M>( &mut self, name: &str, description: &str, options: ToolOptions, observer: impl IntoObserverSystem<ToolCalled<A>, M>, ) -> &mut Self
where A: DeserializeOwned + JsonSchema + Send + Sync + 'static,

Make the open tool name available, its parameters derived from A (args_schema): each call whose arguments parse into A triggers ToolCalled<A> on the tool’s entity, where observer watches, and ends when the call’s Decision is decided, at once or much later; any other is refused. Its calls are recorded like any other.

Provided Methods§

Source

fn add_tool<T: Tool + 'static>(&mut self, tool: T) -> &mut Self

Makes tool available to every agent whose ToolAccess allows its name. A name already registered is refused with a warning; to replace another plugin’s tool, insert Bevy’s Disabled on its entity first, in Plugin::finish.

Tool futures run on Bevy’s async compute pool, a few threads every agent’s calls share, so a tool that blocks (std::fs, std::process::Command, a long computation) runs that work on a thread of its own, such as with rig-tools’ blocking.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§