pub struct CustomAgentBuilder { /* private fields */ }Expand description
Builder for constructing a CustomAgent.
Implementations§
Source§impl CustomAgentBuilder
impl CustomAgentBuilder
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the agent description.
Sourcepub fn sub_agents(self, agents: Vec<Arc<dyn Agent>>) -> Self
pub fn sub_agents(self, agents: Vec<Arc<dyn Agent>>) -> Self
Set all sub-agents, replacing any previously added.
Sourcepub fn before_callback(self, callback: BeforeAgentCallback) -> Self
pub fn before_callback(self, callback: BeforeAgentCallback) -> Self
Add a before-agent callback.
Sourcepub fn after_callback(self, callback: AfterAgentCallback) -> Self
pub fn after_callback(self, callback: AfterAgentCallback) -> Self
Add an after-agent callback.
Sourcepub fn handler<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(Arc<dyn InvocationContext>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<EventStream>> + Send + 'static,
pub fn handler<F, Fut>(self, handler: F) -> Selfwhere
F: Fn(Arc<dyn InvocationContext>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<EventStream>> + Send + 'static,
Set the async handler function that implements the agent’s logic.
Sourcepub fn build(self) -> Result<CustomAgent>
pub fn build(self) -> Result<CustomAgent>
Build the CustomAgent, returning an error if no handler was set.
Auto Trait Implementations§
impl Freeze for CustomAgentBuilder
impl !RefUnwindSafe for CustomAgentBuilder
impl Send for CustomAgentBuilder
impl Sync for CustomAgentBuilder
impl Unpin for CustomAgentBuilder
impl UnsafeUnpin for CustomAgentBuilder
impl !UnwindSafe for CustomAgentBuilder
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