pub struct AgentRegistry { /* private fields */ }Expand description
Registry for discovering and managing agents
The AgentRegistry maintains a registry of all available agents and provides
methods to discover agents by ID or task type. It also manages agent metadata
and configuration.
§Examples
use ricecoder_agents::{AgentRegistry, Agent, TaskType};
use std::sync::Arc;
let mut registry = AgentRegistry::new();
// Register agents...
// Find agents by task type
let agents = registry.find_agents_by_task_type(TaskType::CodeReview);Implementations§
Source§impl AgentRegistry
impl AgentRegistry
Sourcepub fn register(&mut self, agent: Arc<dyn Agent>)
pub fn register(&mut self, agent: Arc<dyn Agent>)
Register an agent
Registers an agent with the registry, making it available for task execution. The agent is indexed by ID and by each task type it supports.
§Arguments
agent- The agent to register
Sourcepub fn all_agents(&self) -> Vec<Arc<dyn Agent>>
pub fn all_agents(&self) -> Vec<Arc<dyn Agent>>
Sourcepub fn agent_count(&self) -> usize
pub fn agent_count(&self) -> usize
Sourcepub fn get_agent_metadata(&self, agent_id: &str) -> Option<AgentMetadataInfo>
pub fn get_agent_metadata(&self, agent_id: &str) -> Option<AgentMetadataInfo>
Sourcepub fn all_agent_metadata(&self) -> Vec<AgentMetadataInfo>
pub fn all_agent_metadata(&self) -> Vec<AgentMetadataInfo>
Sourcepub fn agents_for_task_type(
&self,
task_type: TaskType,
) -> Vec<AgentMetadataInfo>
pub fn agents_for_task_type( &self, task_type: TaskType, ) -> Vec<AgentMetadataInfo>
Sourcepub fn discover_builtin_agents(&mut self) -> Result<()>
pub fn discover_builtin_agents(&mut self) -> Result<()>
Discover built-in agents at startup
This method initializes the registry with built-in agents. In the current implementation, this is a placeholder for future agent discovery mechanisms.
Sourcepub fn load_configuration(
&mut self,
config: HashMap<String, Value>,
) -> Result<()>
pub fn load_configuration( &mut self, config: HashMap<String, Value>, ) -> Result<()>
Load agent configuration from project settings
This method loads agent configuration from a configuration source. The configuration can be used to enable/disable agents or customize their behavior.
Sourcepub fn supported_task_types(&self) -> Vec<TaskType>
pub fn supported_task_types(&self) -> Vec<TaskType>
Get all task types that have registered agents
§Returns
A vector of all task types that have at least one registered agent