pub struct AgentRegistry { /* private fields */ }Expand description
Tracks spawned agents and provides inter-agent messaging.
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
pub fn new() -> AgentRegistry
Sourcepub fn with_hooks(self, hooks: Arc<dyn RegistryHooks>) -> AgentRegistry
pub fn with_hooks(self, hooks: Arc<dyn RegistryHooks>) -> AgentRegistry
Attach lifecycle hooks to the registry.
Sourcepub fn with_send_context(self, enabled: bool) -> AgentRegistry
pub fn with_send_context(self, enabled: bool) -> AgentRegistry
Configure whether send() injects sender identity into messages.
Sourcepub async fn register(&self, agent: SpawnedAgent) -> Result<(), AgentError>
pub async fn register(&self, agent: SpawnedAgent) -> Result<(), AgentError>
Register a spawned agent. Returns error if the ID already exists.
Sourcepub fn get(&self, id: &str) -> Option<Arc<RuntimeAgent>>
pub fn get(&self, id: &str) -> Option<Arc<RuntimeAgent>>
Clone an Arc handle to a registered agent’s RuntimeAgent.
Sourcepub fn get_spawned(&self, id: &str) -> Option<Arc<SpawnedAgent>>
pub fn get_spawned(&self, id: &str) -> Option<Arc<SpawnedAgent>>
Get the full SpawnedAgent metadata (agent + spec + timestamp).
Sourcepub fn list(&self) -> Vec<SpawnedAgentInfo>
pub fn list(&self) -> Vec<SpawnedAgentInfo>
List metadata for all registered agents.
Sourcepub fn list_with_specs(&self) -> Vec<SpawnedAgentEntry>
pub fn list_with_specs(&self) -> Vec<SpawnedAgentEntry>
List all registered agents with their specs serialized as YAML for session persistence.
Sourcepub async fn remove(&self, id: &str) -> Option<Arc<SpawnedAgent>>
pub async fn remove(&self, id: &str) -> Option<Arc<SpawnedAgent>>
Remove an agent from the registry and return it.
Sourcepub async fn send(
&self,
from: &str,
to: &str,
message: &str,
) -> Result<AgentResponse, AgentError>
pub async fn send( &self, from: &str, to: &str, message: &str, ) -> Result<AgentResponse, AgentError>
Send a message from one agent to another and return the response.
Sourcepub async fn broadcast(
&self,
from: &str,
message: &str,
) -> Vec<(String, Result<AgentResponse, AgentError>)>
pub async fn broadcast( &self, from: &str, message: &str, ) -> Vec<(String, Result<AgentResponse, AgentError>)>
Broadcast a message to all agents except the sender.
Clones all target Arcs under a single brief read lock, then drives all chat() calls concurrently after releasing the lock.
Trait Implementations§
Source§impl Debug for AgentRegistry
impl Debug for AgentRegistry
Source§impl Default for AgentRegistry
impl Default for AgentRegistry
Source§fn default() -> AgentRegistry
fn default() -> AgentRegistry
Auto Trait Implementations§
impl !Freeze for AgentRegistry
impl !RefUnwindSafe for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnsafeUnpin 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
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>
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>
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