pub struct Agent {
pub config: AgentConfig,
pub registered_tools: Vec<Arc<Tool>>,
pub sub_agents: Vec<Arc<Agent>>,
/* private fields */
}Expand description
An AI Agent that can process messages and use tools
Fields§
§config: AgentConfigAgent configuration
registered_tools: Vec<Arc<Tool>>Registered tools (Arc for sharing across threads)
sub_agents: Vec<Arc<Agent>>Sub-agents for hierarchical execution
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn new(config: AgentConfig) -> Self
pub fn new(config: AgentConfig) -> Self
Create a new agent with the given configuration
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Get agent description
Sourcepub fn instruction(&self) -> &str
pub fn instruction(&self) -> &str
Get system instruction
Sourcepub fn model(&self) -> &ModelConfig
pub fn model(&self) -> &ModelConfig
Get model configuration
Sourcepub fn has_sub_agents(&self) -> bool
pub fn has_sub_agents(&self) -> bool
Check if agent has sub-agents
Sourcepub fn status(&self) -> AgentStatus
pub fn status(&self) -> AgentStatus
Get current status
Sourcepub fn set_status(&self, status: AgentStatus)
pub fn set_status(&self, status: AgentStatus)
Update status (thread-safe)
Sourcepub fn tool_definitions(&self) -> Vec<Value>
pub fn tool_definitions(&self) -> Vec<Value>
Generate tool definitions for model API
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