// Agent coordination abstraction layer // Decouples agent orchestration from swarm implementation use async_trait::async_trait; /// Abstraction for agent coordination/load balancing. /// Decouples agent orchestration from swarm implementation details. #[async_trait] pub trait SwarmCoordination: Send + Sync { /// Register agent profiles with coordination layer. async fn register_profiles(&self, profiles: Vec) -> anyhow::Result<()>; /// Get best agent for task (load-balanced). async fn select_agent( &self, task_type: &str, required_expertise: Option<&str>, ) -> anyhow::Result; /// Report task completion (update load/metrics). async fn report_completion( &self, agent_id: &str, success: bool, duration_ms: u64, ) -> anyhow::Result<()>; /// Get current agent load (for monitoring). async fn agent_load(&self, agent_id: &str) -> anyhow::Result; } /// Profile used by coordination layer (internal to agents crate). /// Decouples from swarm's AgentProfile type. #[derive(Clone, Debug)] pub struct AgentProfile { pub id: String, pub role: String, pub max_concurrent_tasks: usize, pub success_rate: f64, } /// Assignment result. #[derive(Clone, Debug)] pub struct AgentAssignment { pub agent_id: String, pub agent_name: String, pub confidence: f64, } /// Agent load snapshot. #[derive(Clone, Debug)] pub struct AgentLoad { pub agent_id: String, pub current_tasks: usize, pub capacity: usize, }