pub struct AgentRegistry { /* private fields */ }Expand description
Registry for managing agent profiles and tracking the active agent
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
Sourcepub fn new(
agents: HashMap<String, AgentProfile>,
persistence: Persistence,
) -> AgentRegistry
pub fn new( agents: HashMap<String, AgentProfile>, persistence: Persistence, ) -> AgentRegistry
Create a new AgentRegistry with the given agents and persistence
Sourcepub fn init(&self) -> Result<(), Error>
pub fn init(&self) -> Result<(), Error>
Initialize the registry by loading the active agent from persistence
Sourcepub fn active(&self) -> Result<Option<(String, AgentProfile)>, Error>
pub fn active(&self) -> Result<Option<(String, AgentProfile)>, Error>
Get the currently active agent profile
Sourcepub fn active_name(&self) -> Option<String>
pub fn active_name(&self) -> Option<String>
Get the name of the currently active agent (if any)
Sourcepub fn get(&self, name: &str) -> Option<AgentProfile>
pub fn get(&self, name: &str) -> Option<AgentProfile>
Get a specific agent profile by name
Sourcepub fn upsert(&self, name: String, profile: AgentProfile) -> Result<(), Error>
pub fn upsert(&self, name: String, profile: AgentProfile) -> Result<(), Error>
Add or update an agent profile
Sourcepub fn persistence(&self) -> &Persistence
pub fn persistence(&self) -> &Persistence
Get the shared persistence layer
Trait Implementations§
Source§impl Clone for AgentRegistry
impl Clone for AgentRegistry
Source§fn clone(&self) -> AgentRegistry
fn clone(&self) -> AgentRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentRegistry
impl RefUnwindSafe for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnwindSafe for AgentRegistry
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