Skip to main content

AgentMiddleware

Trait AgentMiddleware 

Source
pub trait AgentMiddleware:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn before_agent<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _agent_id: &'life1 AgentId,
        _user: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn before_model_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _batch: &'life1 mut ExecuteBatch,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn after_model_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _result: &'life1 mut TurnResult,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_tool_call<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _name: &'life1 str,
        _args: &'life2 mut Value,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _name: &'life1 str,
        _result: &'life2 mut Result<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn after_agent<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _result: &'life1 mut TurnResult,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn dynamic_prompt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _agent_id: &'life1 AgentId,
        _user: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}

Provided Methods§

Source

fn before_agent<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _agent_id: &'life1 AgentId, _user: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn before_model_call<'life0, 'life1, 'async_trait>( &'life0 self, _batch: &'life1 mut ExecuteBatch, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn after_model_call<'life0, 'life1, 'async_trait>( &'life0 self, _result: &'life1 mut TurnResult, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn before_tool_call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _name: &'life1 str, _args: &'life2 mut Value, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn after_tool_call<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _name: &'life1 str, _result: &'life2 mut Result<Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn after_agent<'life0, 'life1, 'async_trait>( &'life0 self, _result: &'life1 mut TurnResult, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn dynamic_prompt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _agent_id: &'life1 AgentId, _user: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

If Some, replaces the rendered system prompt for this turn.

Implementors§