pub struct LlmConditionalAgentBuilder { /* private fields */ }Expand description
Builder for constructing an LlmConditionalAgent.
Implementations§
Source§impl LlmConditionalAgentBuilder
impl LlmConditionalAgentBuilder
Sourcepub fn new(name: impl Into<String>, model: Arc<dyn Llm>) -> Self
pub fn new(name: impl Into<String>, model: Arc<dyn Llm>) -> Self
Create a new builder with the given name and model.
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set a description for the agent.
Sourcepub fn instruction(self, instruction: impl Into<String>) -> Self
pub fn instruction(self, instruction: impl Into<String>) -> Self
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>) -> Self
pub fn route(self, label: impl Into<String>, agent: Arc<dyn Agent>) -> Self
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>) -> Self
pub fn default_route(self, agent: Arc<dyn Agent>) -> Self
Set the default agent to use when no route matches.
Sourcepub fn with_skills(self, index: SkillIndex) -> Self
pub fn with_skills(self, index: SkillIndex) -> Self
Set a preloaded skills index for this agent.
Sourcepub fn with_auto_skills(self) -> Result<Self>
pub fn with_auto_skills(self) -> Result<Self>
Auto-load skills from .skills/ in the current working directory.
Sourcepub fn with_skills_from_root(self, root: impl AsRef<Path>) -> Result<Self>
pub fn with_skills_from_root(self, root: impl AsRef<Path>) -> Result<Self>
Auto-load skills from .skills/ under a custom root directory.
Sourcepub fn with_skill_policy(self, policy: SelectionPolicy) -> Self
pub fn with_skill_policy(self, policy: SelectionPolicy) -> Self
Customize skill selection behavior.
Sourcepub fn with_skill_budget(self, max_chars: usize) -> Self
pub fn with_skill_budget(self, max_chars: usize) -> Self
Limit injected skill content length.
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 build(self) -> Result<LlmConditionalAgent>
pub fn build(self) -> Result<LlmConditionalAgent>
Build the LlmConditionalAgent.