Skip to main content

Dispatcher

Trait Dispatcher 

Source
pub trait Dispatcher: Send + Sync {
    // Required methods
    fn dispatch(
        &self,
        calls: &[(&str, &str)],
    ) -> impl Future<Output = Vec<Result<String>>> + Send;
    fn tools(&self) -> Vec<Tool>;
}
Expand description

Generic tool dispatcher.

Passed as a method param to Agent::step(). Uses RPITIT for async without boxing — callers monomorphize over concrete dispatcher types.

Required Methods§

Source

fn dispatch( &self, calls: &[(&str, &str)], ) -> impl Future<Output = Vec<Result<String>>> + Send

Dispatch a batch of tool calls. Each entry is (method, params).

Returns one result per call in the same order.

Source

fn tools(&self) -> Vec<Tool>

Return the tool schemas this dispatcher can handle.

Agent uses this to populate Request.tools before calling the model.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§