pub struct AgentBuilder { /* private fields */ }Expand description
Fluent builder for constructing AgentDefinition instances.
Implementations§
Source§impl AgentBuilder
impl AgentBuilder
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Sets the agent version string used for versioned transport routes.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the agent description.
Sourcepub fn with_dispatcher_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_dispatcher_prompt(self, prompt: impl Into<String>) -> Self
Sets the dispatcher prompt used by the runtime negotiator.
Sourcepub fn with_skill<T>(self, skill: T) -> Selfwhere
T: RegisteredSkill + 'static,
pub fn with_skill<T>(self, skill: T) -> Selfwhere
T: RegisteredSkill + 'static,
Registers a programmatic Rust skill with the agent.
The skill must implement RegisteredSkill, typically derived by the
#[skill] macro.
Sourcepub fn with_skill_def(self, def: AgentSkillDef) -> Self
pub fn with_skill_def(self, def: AgentSkillDef) -> Self
Registers an AgentSkill from an AgentSkillDef.
Use [include_skill!] to create one at compile time (SKILL.md embedded
into the binary), or AgentSkillDef::from_dir for runtime loading.
The LLM handler is injected when [Runtime::builder] calls build().
§Examples
// Compile-time — skill embedded in binary, no I/O at startup
Agent::builder()
.with_skill_def(include_skill!("./skills/pdf-processing"))
.build()Sourcepub fn with_skill_dir(self, path: impl AsRef<Path>) -> Result<Self, AgentError>
pub fn with_skill_dir(self, path: impl AsRef<Path>) -> Result<Self, AgentError>
Load and register an AgentSkill from a directory at runtime.
Reads SKILL.md from the given directory, validates it against the
AgentSkills specification, and queues it for handler injection when
Runtime::builder(...).build() is called.
§Errors
Returns an error if the directory cannot be read, SKILL.md is missing,
the frontmatter is invalid, or the name field doesn’t match the
directory name.
§Examples
Agent::builder()
.with_skill_dir("./skills/translate")?
.build()Sourcepub fn build(self) -> AgentDefinition
pub fn build(self) -> AgentDefinition
Finalizes and returns the agent definition.
Note: if you have registered AgentSkills via [with_skill_def] or
[with_skill_dir], pass this builder to [Runtime::builder] rather
than calling build() directly — the runtime injects the LLM into
AgentSkill handlers during its own build().
Trait Implementations§
Source§impl From<AgentDefinition> for AgentBuilder
impl From<AgentDefinition> for AgentBuilder
Source§fn from(def: AgentDefinition) -> Self
fn from(def: AgentDefinition) -> Self
Wraps a pre-built AgentDefinition in an AgentBuilder.