Trait AgentExecutor

Source
pub trait AgentExecutor:
    Send
    + Sync
    + 'static {
    type Output: Serialize + DeserializeOwned + Clone + Send + Sync + Into<Value>;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn config(&self) -> ExecutorConfig;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        llm: Arc<dyn LLMProvider>,
        memory: Option<Arc<RwLock<Box<dyn MemoryProvider>>>>,
        tools: Vec<Box<dyn ToolT>>,
        agent_config: &'life1 AgentConfig,
        task: Task,
        state: Arc<RwLock<AgentState>>,
        tx_event: Sender<Event>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Base trait for agent execution strategies

Executors are responsible for implementing the specific execution logic for agents, such as ReAct loops, chain-of-thought, or custom patterns.

Required Associated Types§

Required Methods§

Source

fn config(&self) -> ExecutorConfig

Get the configuration for this executor

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, llm: Arc<dyn LLMProvider>, memory: Option<Arc<RwLock<Box<dyn MemoryProvider>>>>, tools: Vec<Box<dyn ToolT>>, agent_config: &'life1 AgentConfig, task: Task, state: Arc<RwLock<AgentState>>, tx_event: Sender<Event>, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the agent with the given task

Implementors§