pub struct AgentFactory { /* private fields */ }Expand description
Agent factory for creating and managing agents
Implementations§
Source§impl AgentFactory
impl AgentFactory
pub fn new() -> Self
pub fn with_pool_config(self, config: PoolConfig) -> Self
pub fn with_default_model(self, model: impl Into<String>) -> Self
pub fn with_default_temperature(self, temp: f32) -> Self
Sourcepub fn register_template(&self, template: AgentTemplate) -> &Self
pub fn register_template(&self, template: AgentTemplate) -> &Self
Register a template
Sourcepub fn register_templates<I>(&self, templates: I) -> &Selfwhere
I: IntoIterator<Item = AgentTemplate>,
pub fn register_templates<I>(&self, templates: I) -> &Selfwhere
I: IntoIterator<Item = AgentTemplate>,
Register multiple templates
Sourcepub fn get_template(&self, name: &str) -> Option<AgentTemplate>
pub fn get_template(&self, name: &str) -> Option<AgentTemplate>
Get a template by name
Sourcepub fn list_templates(&self) -> Vec<String>
pub fn list_templates(&self) -> Vec<String>
List all template names
Sourcepub fn create(&self, template_name: &str) -> Result<AgentInstance, FactoryError>
pub fn create(&self, template_name: &str) -> Result<AgentInstance, FactoryError>
Create an agent instance from a template
Sourcepub fn create_with_config(
&self,
template_name: &str,
config: AgentConfig,
) -> Result<AgentInstance, FactoryError>
pub fn create_with_config( &self, template_name: &str, config: AgentConfig, ) -> Result<AgentInstance, FactoryError>
Create an agent instance with custom configuration
Sourcepub fn release(&self, instance: AgentInstance)
pub fn release(&self, instance: AgentInstance)
Return an instance to the pool for reuse
Sourcepub fn get_instance(&self, id: &str) -> Option<AgentInstance>
pub fn get_instance(&self, id: &str) -> Option<AgentInstance>
Get an instance by ID
Sourcepub fn remove_instance(&self, id: &str) -> bool
pub fn remove_instance(&self, id: &str) -> bool
Remove an instance
Sourcepub fn stats(&self) -> FactoryStats
pub fn stats(&self) -> FactoryStats
Get factory statistics
Sourcepub fn find_by_capability(&self, capability: &str) -> Vec<AgentTemplate>
pub fn find_by_capability(&self, capability: &str) -> Vec<AgentTemplate>
Find templates by capability
Sourcepub fn find_by_tool(&self, tool: &str) -> Vec<AgentTemplate>
pub fn find_by_tool(&self, tool: &str) -> Vec<AgentTemplate>
Find templates that have a specific tool
Sourcepub fn clear_pools(&self)
pub fn clear_pools(&self)
Clear all pools
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Cleanup expired instances from pools
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AgentFactory
impl !RefUnwindSafe for AgentFactory
impl Send for AgentFactory
impl Sync for AgentFactory
impl Unpin for AgentFactory
impl UnsafeUnpin for AgentFactory
impl UnwindSafe for AgentFactory
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> 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