pub struct Swarm { /* private fields */ }
Expand description
Swarm orchestrator
Implementations§
Source§impl Swarm
impl Swarm
Sourcepub fn new(config: SwarmConfig) -> Self
pub fn new(config: SwarmConfig) -> Self
Create a new swarm orchestrator
Sourcepub fn register_agent(&mut self, agent: DynamicAgent) -> Result<()>
pub fn register_agent(&mut self, agent: DynamicAgent) -> Result<()>
Register an agent with the swarm
Sourcepub fn unregister_agent(&mut self, agent_id: &AgentId) -> Result<()>
pub fn unregister_agent(&mut self, agent_id: &AgentId) -> Result<()>
Remove an agent from the swarm
Sourcepub fn submit_task(&mut self, task: Task) -> Result<()>
pub fn submit_task(&mut self, task: Task) -> Result<()>
Submit a task to the swarm
Sourcepub async fn distribute_tasks(&mut self) -> Result<Vec<(TaskId, AgentId)>>
pub async fn distribute_tasks(&mut self) -> Result<Vec<(TaskId, AgentId)>>
Assign tasks to agents based on distribution strategy
Sourcepub fn agent_statuses(&self) -> HashMap<AgentId, AgentStatus>
pub fn agent_statuses(&self) -> HashMap<AgentId, AgentStatus>
Get the status of all agents
Sourcepub fn task_queue_size(&self) -> usize
pub fn task_queue_size(&self) -> usize
Get the current task queue size
Sourcepub fn assigned_tasks_count(&self) -> usize
pub fn assigned_tasks_count(&self) -> usize
Get assigned tasks count
Sourcepub fn get_agent(&self, agent_id: &AgentId) -> Option<&DynamicAgent>
pub fn get_agent(&self, agent_id: &AgentId) -> Option<&DynamicAgent>
Get agent by ID
Sourcepub fn get_agent_mut(&mut self, agent_id: &AgentId) -> Option<&mut DynamicAgent>
pub fn get_agent_mut(&mut self, agent_id: &AgentId) -> Option<&mut DynamicAgent>
Get mutable agent by ID
Sourcepub async fn start_all_agents(&mut self) -> Result<()>
pub async fn start_all_agents(&mut self) -> Result<()>
Start all agents
Sourcepub async fn shutdown_all_agents(&mut self) -> Result<()>
pub async fn shutdown_all_agents(&mut self) -> Result<()>
Shutdown all agents
Sourcepub fn metrics(&self) -> SwarmMetrics
pub fn metrics(&self) -> SwarmMetrics
Get swarm metrics
Auto Trait Implementations§
impl Freeze for Swarm
impl !RefUnwindSafe for Swarm
impl Send for Swarm
impl Sync for Swarm
impl Unpin for Swarm
impl !UnwindSafe for Swarm
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