pub struct Agent {
pub name: String,
pub path: PathBuf,
pub definition: AgentDefinition,
pub tools: Vec<Tool>,
pub shared_tools: Vec<String>,
pub variables: HashMap<String, String>,
}
Expand description
Represents an AI agent, including its definition, tools, and configuration.
An agent is a fundamental concept in this framework, encapsulating the logic and capabilities needed to perform tasks.
Fields§
§name: String
A unique name for the agent.
path: PathBuf
The file system path to the agent’s directory.
definition: AgentDefinition
The agent’s definition, loaded from its index.yaml
file.
tools: Vec<Tool>
A list of tools that are specific to this agent.
A list of names of shared tools that this agent can use.
variables: HashMap<String, String>
A map of variables and their values for this agent.
Implementations§
Source§impl Agent
impl Agent
Sourcepub async fn from_directory<P: AsRef<Path>>(path: P) -> Result<Self>
pub async fn from_directory<P: AsRef<Path>>(path: P) -> Result<Self>
Loads an agent from a specified directory.
This function reads the agent’s definition from index.yaml
, loads its
agent-specific tools from a tools
subdirectory, and reads the list of
shared tools from tools.txt
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Agent
impl RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnwindSafe for Agent
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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