Skip to main content

AgentOptimizer

Trait AgentOptimizer 

Source
pub trait AgentOptimizer: Send + Sync {
    // Required method
    fn optimize<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        initial_instruction: &'life1 str,
        model_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<OptimizerResult, OptimizerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for agent optimizers that iteratively improve agent instructions.

Mirrors ADK-Python’s AgentOptimizer abstract class.

Required Methods§

Source

fn optimize<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, initial_instruction: &'life1 str, model_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OptimizerResult, OptimizerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run the optimization process.

§Arguments
  • initial_instruction — The starting agent instruction to optimize.
  • model_id — The model to use for the agent being optimized.
§Returns

An OptimizerResult with the best instruction and scores.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§