pub struct BasicAgent<T: AgentDeriveT> { /* private fields */ }Expand description
Wrapper type for Basic executor
Implementations§
Source§impl<T: AgentDeriveT> BasicAgent<T>
impl<T: AgentDeriveT> BasicAgent<T>
Trait Implementations§
Source§impl<T: AgentDeriveT> AgentDeriveT for BasicAgent<T>
Implement AgentDeriveT for the wrapper by delegating to the inner type
impl<T: AgentDeriveT> AgentDeriveT for BasicAgent<T>
Implement AgentDeriveT for the wrapper by delegating to the inner type
Source§type Output = <T as AgentDeriveT>::Output
type Output = <T as AgentDeriveT>::Output
The output type this agent produces
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Get the agent’s description
fn output_schema(&self) -> Option<Value>
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
type Output = BasicAgentOutput
type Error = BasicExecutorError
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,
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,
Source§impl<T> AgentHooks for BasicAgent<T>
impl<T> AgentHooks for BasicAgent<T>
Source§fn on_agent_create<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_agent_create<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Hook called when builder creates a new instance of BaseAgent
Source§fn on_run_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 Task,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_run_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task: &'life1 Task,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when the Agent Execution is Triggered, Ability to Abort is Given for users
Source§fn on_run_complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
task: &'life1 Task,
result: &'life2 Self::Output,
ctx: &'life3 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_run_complete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
task: &'life1 Task,
result: &'life2 Self::Output,
ctx: &'life3 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called when the Agent Execution is Completed
Source§fn on_turn_start<'life0, 'life1, 'async_trait>(
&'life0 self,
turn_index: usize,
ctx: &'life1 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_turn_start<'life0, 'life1, 'async_trait>(
&'life0 self,
turn_index: usize,
ctx: &'life1 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when an executor turn is started, useful for multi-turn Executors like ReAct
Source§fn on_turn_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
turn_index: usize,
ctx: &'life1 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_turn_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
turn_index: usize,
ctx: &'life1 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when an executor turn is completed, useful for multi-turn Executors like ReAct
fn on_tool_call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = HookOutcome> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn on_tool_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_tool_start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before executing the tool
Source§fn on_tool_result<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
result: &'life2 ToolCallResult,
ctx: &'life3 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_tool_result<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
result: &'life2 ToolCallResult,
ctx: &'life3 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called post execution of tool with results
Source§fn on_tool_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
err: Value,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_tool_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tool_call: &'life1 ToolCall,
err: Value,
ctx: &'life2 Context,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called if the execution of the tool failed
Source§impl<T: AgentDeriveT> Clone for BasicAgent<T>
impl<T: AgentDeriveT> Clone for BasicAgent<T>
Source§impl<T: Debug + AgentDeriveT> Debug for BasicAgent<T>
impl<T: Debug + AgentDeriveT> Debug for BasicAgent<T>
Auto Trait Implementations§
impl<T> Freeze for BasicAgent<T>
impl<T> RefUnwindSafe for BasicAgent<T>where
T: RefUnwindSafe,
impl<T> Send for BasicAgent<T>
impl<T> Sync for BasicAgent<T>
impl<T> Unpin for BasicAgent<T>
impl<T> UnwindSafe for BasicAgent<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage