pub struct AgentLoader;Expand description
Loads agent definitions from files and directories.
Supports both single-file and directory-per-agent layouts.
Accepted file names inside a directory: agent.yaml, agent.yml,
agent.json. A standalone file is also accepted directly.
Implementations§
Source§impl AgentLoader
impl AgentLoader
Sourcepub fn load_file(path: &Path) -> Result<AgentDefinition>
pub fn load_file(path: &Path) -> Result<AgentDefinition>
Load an agent definition from a single file.
Accepts .yaml, .yml, or .json extensions. The source_path
field on the returned definition is set to the resolved file path.
§Errors
Returns ClawftError::PluginLoadFailed on I/O or parse errors.
Sourcepub fn load(path: &Path) -> Result<AgentDefinition>
pub fn load(path: &Path) -> Result<AgentDefinition>
Load an agent from a file or directory.
If path is a file, it is parsed directly. If path is a
directory, the loader looks for agent.yaml, agent.yml, or
agent.json inside it.
§Errors
Returns ClawftError::PluginLoadFailed when no agent file is
found or the file cannot be parsed.
Sourcepub fn load_dir(dir: &Path) -> Result<Vec<AgentDefinition>>
pub fn load_dir(dir: &Path) -> Result<Vec<AgentDefinition>>
Load all agent definitions from a directory of agent subdirectories (or loose YAML/JSON files).
Each subdirectory should contain agent.yaml / agent.json.
Loose .yaml/.yml/.json files at the top level are also
loaded. Errors on individual agents are logged and skipped.
Auto Trait Implementations§
impl Freeze for AgentLoader
impl RefUnwindSafe for AgentLoader
impl Send for AgentLoader
impl Sync for AgentLoader
impl Unpin for AgentLoader
impl UnsafeUnpin for AgentLoader
impl UnwindSafe for AgentLoader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more