Struct AgentFolder
pub struct AgentFolder {
pub root: PathBuf,
pub def: AgentDef,
pub warnings: Vec<Diagnostic>,
pub digest: Digest,
}Expand description
One agent, read from a folder at run time: the definition, what the load warned about, and the digest that names these exact files.
The folder is what build.rs embeds, read when the process starts instead of when it was
built, so a deployment can change an agent’s instructions, card, skills and mcp.json
without a build. It is read once; a change on disk is picked up by the next start.
use adam_assembly::AgentFolder;
use adam_llm_agent::ToolSet;
// `ADAM_AGENT_DIR=/etc/adam/agent`: the folder that holds `agent/`, or `agent/` itself.
let folder = AgentFolder::load(&root)?;
assert_eq!(folder.def.name(), "helper");
assert!(folder.warnings.is_empty());
println!("{}", folder.digest); // sha256:...
let bound = folder.def.bind(ToolSet::new())?;Fields§
§root: PathBufThe directory that holds agent/ (or agents/): what was read.
def: AgentDefThe agent. Nothing is bound yet: give it its vars and tools like any other
AgentDef.
warnings: Vec<Diagnostic>What the load found that does not stop it (an unknown key, a spec departure), in
discovery order. Errors are an Err instead.
digest: DigestThe digest of the manifest and the bytes of the files its skills bundle. The same files give the same digest wherever they were read from, so it can be compared with the embedded copy’s.
Implementations§
§impl AgentFolder
impl AgentFolder
pub fn load(path: impl Into<PathBuf>) -> Result<AgentFolder, Error>
pub fn load(path: impl Into<PathBuf>) -> Result<AgentFolder, Error>
Read the one agent path holds, with [Strictness::Lenient]: warnings are returned, an
error is an Err.
path is the directory that holds agent/ (or agents/), or that directory itself.
AGENT_DIR_ENV is not consulted here: agent_dir_from_env is how a caller reads it.
An agents/ folder is accepted when it holds exactly one agent.
§Errors
Error::Manifestwhen the folder cannot be read (it does not exist, or is a file), or has errors: itsInvalidcarries every diagnostic.Error::NotOneAgentwhen it holds no agent or more than one.
Trait Implementations§
§impl Clone for AgentFolder
impl Clone for AgentFolder
§fn clone(&self) -> AgentFolder
fn clone(&self) -> AgentFolder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AgentFolder
impl !UnwindSafe for AgentFolder
impl Freeze for AgentFolder
impl Send for AgentFolder
impl Sync for AgentFolder
impl Unpin for AgentFolder
impl UnsafeUnpin for AgentFolder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].