Skip to main content

LoopMutator

Trait LoopMutator 

Source
pub trait LoopMutator: Send + Sync {
    // Provided method
    fn mutate<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        cursor: &'life1 mut TranscriptCursor<'life2>,
        ctx: LoopCtx<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Async transcript mutator. Registered via AgentBuilder::mutator and invoked at each MutationPoint. Mutators own their derived state (e.g. running token totals via interior mutability) and decide for themselves whether and how to modify the transcript.

The default implementation is a no-op so trait users override only mutate.

Provided Methods§

Source

fn mutate<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, cursor: &'life1 mut TranscriptCursor<'life2>, ctx: LoopCtx<'life3>, ) -> Pin<Box<dyn Future<Output = Result<(), LoopError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Run this mutator. Returning without writing to cursor is a no-op. Errors abort the loop; protocol-violating mutations (orphaned tool uses or results) are detected by validation and turned into LoopError::Mutator.

Implementors§