pub struct LlmConditionalAgentBuilder { /* private fields */ }agents only.Expand description
Builder for constructing an LlmConditionalAgent.
Implementations§
Source§impl LlmConditionalAgentBuilder
impl LlmConditionalAgentBuilder
Sourcepub fn new(
name: impl Into<String>,
model: Arc<dyn Llm>,
) -> LlmConditionalAgentBuilder
pub fn new( name: impl Into<String>, model: Arc<dyn Llm>, ) -> LlmConditionalAgentBuilder
Create a new builder with the given name and model.
Sourcepub fn description(self, desc: impl Into<String>) -> LlmConditionalAgentBuilder
pub fn description(self, desc: impl Into<String>) -> LlmConditionalAgentBuilder
Set a description for the agent.
Sourcepub fn instruction(
self,
instruction: impl Into<String>,
) -> LlmConditionalAgentBuilder
pub fn instruction( self, instruction: impl Into<String>, ) -> LlmConditionalAgentBuilder
Set the classification instruction.
The instruction should tell the LLM to classify the user’s input and respond with ONLY the category name (matching a route key).
Sourcepub fn route(
self,
label: impl Into<String>,
agent: Arc<dyn Agent>,
) -> LlmConditionalAgentBuilder
pub fn route( self, label: impl Into<String>, agent: Arc<dyn Agent>, ) -> LlmConditionalAgentBuilder
Add a route mapping a classification label to an agent.
When the LLM’s response contains this label, execution transfers to the specified agent.
Sourcepub fn default_route(self, agent: Arc<dyn Agent>) -> LlmConditionalAgentBuilder
pub fn default_route(self, agent: Arc<dyn Agent>) -> LlmConditionalAgentBuilder
Set the default agent to use when no route matches.
Sourcepub fn with_skills(self, index: SkillIndex) -> LlmConditionalAgentBuilder
Available on crate feature skills only.
pub fn with_skills(self, index: SkillIndex) -> LlmConditionalAgentBuilder
skills only.Set a preloaded skills index for this agent.
Sourcepub fn with_auto_skills(self) -> Result<LlmConditionalAgentBuilder, AdkError>
Available on crate feature skills only.
pub fn with_auto_skills(self) -> Result<LlmConditionalAgentBuilder, AdkError>
skills only.Auto-load skills from .skills/ in the current working directory.
Sourcepub fn with_skills_from_root(
self,
root: impl AsRef<Path>,
) -> Result<LlmConditionalAgentBuilder, AdkError>
Available on crate feature skills only.
pub fn with_skills_from_root( self, root: impl AsRef<Path>, ) -> Result<LlmConditionalAgentBuilder, AdkError>
skills only.Auto-load skills from .skills/ under a custom root directory.
Sourcepub fn with_skill_policy(
self,
policy: SelectionPolicy,
) -> LlmConditionalAgentBuilder
Available on crate feature skills only.
pub fn with_skill_policy( self, policy: SelectionPolicy, ) -> LlmConditionalAgentBuilder
skills only.Customize skill selection behavior.
Sourcepub fn with_skill_budget(self, max_chars: usize) -> LlmConditionalAgentBuilder
Available on crate feature skills only.
pub fn with_skill_budget(self, max_chars: usize) -> LlmConditionalAgentBuilder
skills only.Limit injected skill content length.
Sourcepub fn before_callback(
self,
callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>,
) -> LlmConditionalAgentBuilder
pub fn before_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> LlmConditionalAgentBuilder
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>,
) -> LlmConditionalAgentBuilder
pub fn after_callback( self, callback: Box<dyn Fn(Arc<dyn CallbackContext>) -> Pin<Box<dyn Future<Output = Result<Option<Content>, AdkError>> + Send>> + Send + Sync>, ) -> LlmConditionalAgentBuilder
Add an after-agent callback.
Sourcepub fn build(self) -> Result<LlmConditionalAgent, AdkError>
pub fn build(self) -> Result<LlmConditionalAgent, AdkError>
Build the LlmConditionalAgent.