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§
type Output: Serialize + DeserializeOwned + Send + Sync
type Error: Error + Send + Sync + 'static
Required Methods§
Sourcefn 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 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
Sourcefn 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,
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