pub trait AgentExecutor:
Send
+ Sync
+ 'static {
type Output: Serialize + DeserializeOwned + Clone + Send + Sync + Debug;
type Error: Error + Send + Sync + 'static;
// Required methods
fn config(&self) -> ExecutorConfig;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
context: Arc<Context>,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn execute_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
context: Arc<Context>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::Output, Self::Error>> + Send>>, 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§
type Output: Serialize + DeserializeOwned + Clone + Send + Sync + Debug
type Error: Error + Send + Sync + 'static
Required Methods§
fn config(&self) -> ExecutorConfig
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
context: Arc<Context>,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn execute_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 Task,
context: Arc<Context>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::Output, Self::Error>> + Send>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Implementors§
Source§impl<T: AgentDeriveT + AgentHooks> AgentExecutor for ReActAgent<T>
Implementation of AgentExecutor for the ReActExecutorWrapper
impl<T: AgentDeriveT + AgentHooks> AgentExecutor for ReActAgent<T>
Implementation of AgentExecutor for the ReActExecutorWrapper
type Output = ReActAgentOutput
type Error = ReActExecutorError
Source§impl<T: AgentDeriveT> AgentExecutor for BasicAgent<T>
Implementation of AgentExecutor for the BasicExecutorWrapper
impl<T: AgentDeriveT> AgentExecutor for BasicAgent<T>
Implementation of AgentExecutor for the BasicExecutorWrapper