Trait AgentExecutor

Source
pub trait AgentExecutor:
    Send
    + Sync
    + 'static {
    type Output: Serialize + DeserializeOwned + Send + Sync;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        llm: Arc<dyn LLMProvider>,
        task: Task,
        state: Arc<Mutex<AgentState>>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn process_turn<'life0, 'life1, 'async_trait>(
        &'life0 self,
        llm: Arc<dyn LLMProvider>,
        messages: &'life1 mut Vec<ChatMessage>,
        state: Arc<Mutex<AgentState>>,
    ) -> Pin<Box<dyn Future<Output = Result<TurnResult<Self::Output>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn max_turns(&self) -> usize { ... }
}
Expand description

Base trait for agent execution strategies

Required Associated Types§

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, llm: Arc<dyn LLMProvider>, task: Task, state: Arc<Mutex<AgentState>>, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the agent with the given session

Source

fn process_turn<'life0, 'life1, 'async_trait>( &'life0 self, llm: Arc<dyn LLMProvider>, messages: &'life1 mut Vec<ChatMessage>, state: Arc<Mutex<AgentState>>, ) -> Pin<Box<dyn Future<Output = Result<TurnResult<Self::Output>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process a single turn of conversation

Provided Methods§

Source

fn max_turns(&self) -> usize

Get the maximum number of turns allowed

Implementors§