pub struct CustomAgentBuilder { /* private fields */ }Available on crate feature
agents only.Expand description
Builder for constructing a CustomAgent.
Implementations§
Source§impl CustomAgentBuilder
impl CustomAgentBuilder
Sourcepub fn new(name: impl Into<String>) -> CustomAgentBuilder
pub fn new(name: impl Into<String>) -> CustomAgentBuilder
Create a new builder with the given agent name.
Sourcepub fn description(self, description: impl Into<String>) -> CustomAgentBuilder
pub fn description(self, description: impl Into<String>) -> CustomAgentBuilder
Set the agent description.
Sourcepub fn sub_agent(self, agent: Arc<dyn Agent>) -> CustomAgentBuilder
pub fn sub_agent(self, agent: Arc<dyn Agent>) -> CustomAgentBuilder
Add a sub-agent.
Sourcepub fn sub_agents(self, agents: Vec<Arc<dyn Agent>>) -> CustomAgentBuilder
pub fn sub_agents(self, agents: Vec<Arc<dyn Agent>>) -> CustomAgentBuilder
Set all sub-agents, replacing any previously added.
Sourcepub fn before_callback(
self,
callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>,
) -> CustomAgentBuilder
pub fn before_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> CustomAgentBuilder
Add a before-agent callback.
Sourcepub fn after_callback(
self,
callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>,
) -> CustomAgentBuilder
pub fn after_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> CustomAgentBuilder
Add an after-agent callback.
Sourcepub fn handler<F, Fut>(self, handler: F) -> CustomAgentBuilder
pub fn handler<F, Fut>(self, handler: F) -> CustomAgentBuilder
Set the async handler function that implements the agent’s logic.
Sourcepub fn build(self) -> Result<CustomAgent, AdkError>
pub fn build(self) -> Result<CustomAgent, AdkError>
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