AgentRegistry

Struct AgentRegistry 

Source
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

Source

pub fn new() -> Self

Create a new agent registry

§Returns

A new empty AgentRegistry

Source

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
Source

pub fn find_agent(&self, agent_id: &str) -> Result<Arc<dyn Agent>>

Find an agent by ID

§Arguments
  • agent_id - The ID of the agent to find
§Returns

A Result containing the agent or an error if not found

Source

pub fn find_agents_by_task_type( &self, task_type: TaskType, ) -> Vec<Arc<dyn Agent>>

Find agents by task type

§Arguments
  • task_type - The task type to find agents for
§Returns

A vector of agents that support the given task type

Source

pub fn all_agents(&self) -> Vec<Arc<dyn Agent>>

Get all registered agents

§Returns

A vector of all registered agents

Source

pub fn agent_count(&self) -> usize

Get the number of registered agents

§Returns

The total number of registered agents

Source

pub fn get_agent_metadata(&self, agent_id: &str) -> Option<AgentMetadataInfo>

Get metadata for a specific agent

§Arguments
  • agent_id - The ID of the agent
§Returns

An Option containing the agent metadata if found

Source

pub fn all_agent_metadata(&self) -> Vec<AgentMetadataInfo>

Get metadata for all registered agents

§Returns

A vector of metadata for all registered agents

Source

pub fn has_agent(&self, agent_id: &str) -> bool

Check if an agent is registered

§Arguments
  • agent_id - The ID of the agent to check
§Returns

true if the agent is registered, false otherwise

Source

pub fn agents_for_task_type( &self, task_type: TaskType, ) -> Vec<AgentMetadataInfo>

Get agents that support a specific task type

§Arguments
  • task_type - The task type to find agents for
§Returns

A vector of metadata for agents that support the given task type

Source

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.

Source

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.

Source

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

Trait Implementations§

Source§

impl Default for AgentRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more