Skip to main content

AgentRegistry

Struct AgentRegistry 

Source
pub struct AgentRegistry { /* private fields */ }
Expand description

Tracks active sub-agents and enforces spawn limits.

§Lifecycle

register() → status=Idle
  → set_status(Running) on followup_task
    → set_status(Done) on completion
      → close() removes from registry

Done agents still count toward the quota until explicitly close()d. There is no automatic garbage collection in v1.

Implementations§

Source§

impl AgentRegistry

Source

pub fn new(config: MultiAgentConfig) -> Self

Create a new registry with the given configuration.

Source

pub fn can_spawn(&self, depth: i32) -> Result<(), SpawnError>

Check whether a new agent can be spawned at the given depth.

Returns Ok(()) if spawning is allowed, or a SpawnError describing which limit was exceeded.

Source

pub fn register( &mut self, path: &AgentPath, depth: i32, tool_count: usize, ) -> Result<(), SpawnError>

Register a new agent.

Returns Ok(()) on success, or a SpawnError if limits are exceeded or the path already exists.

Source

pub fn close(&mut self, path: &AgentPath) -> Option<AgentEntry>

Close (remove) an agent from the registry.

Returns the removed entry, or None if the agent was not registered. This releases the agent’s quota slot.

Source

pub fn set_status(&mut self, path: &AgentPath, status: AgentStatus) -> bool

Update the lifecycle status of an agent.

Returns true if the agent was found and updated.

Source

pub fn get(&self, path: &AgentPath) -> Option<&AgentEntry>

Get an agent entry by path.

Source

pub fn list(&self) -> Vec<&AgentEntry>

List all registered agents (all statuses).

Source

pub fn count(&self) -> usize

Return the total number of registered agents.

Source

pub fn count_by_status(&self, status: &AgentStatus) -> usize

Return the number of agents with a specific status.

Source

pub fn is_empty(&self) -> bool

Return whether the registry is empty.

Source

pub fn contains(&self, path: &AgentPath) -> bool

Check if an agent path is registered.

Source

pub fn config(&self) -> &MultiAgentConfig

Get a reference to the configuration.

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: Sized + 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: Sized + 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