Crate ruv_swarm_core

Source
Expand description

Core orchestration and agent traits for RUV Swarm

This crate provides the foundational building blocks for creating distributed AI agent swarms with cognitive diversity patterns.

§Features

  • Agent Trait: Core abstraction for all swarm agents
  • Task Management: Distributed task queue with priority scheduling
  • Swarm Orchestration: Multiple topology and distribution strategies
  • Cognitive Patterns: Support for diverse thinking patterns
  • No-std Support: Can run in embedded environments

§Example

use ruv_swarm_core::{Agent, Swarm, SwarmConfig, Task, Priority};
use async_trait::async_trait;

// Define a simple agent
struct ComputeAgent {
    id: String,
    capabilities: Vec<String>,
}

#[async_trait]
impl Agent for ComputeAgent {
    type Input = f64;
    type Output = f64;
    type Error = std::io::Error;

    async fn process(&mut self, input: Self::Input) -> Result<Self::Output, Self::Error> {
        Ok(input * 2.0)
    }

    fn capabilities(&self) -> &[String] {
        &self.capabilities
    }

    fn id(&self) -> &str {
        &self.id
    }
}

Re-exports§

pub use agent::Agent;
pub use agent::AgentMessage;
pub use agent::AgentMetadata;
pub use agent::AgentMetrics;
pub use agent::BoxedAgent;
pub use agent::CognitivePattern;
pub use agent::ErasedAgent;
pub use agent::HealthStatus;
pub use agent::MessageType;
pub use agent::ResourceRequirements;
pub use error::Result;
pub use error::SwarmError;
pub use swarm::Swarm;
pub use swarm::SwarmConfig;
pub use swarm::SwarmMetrics;
pub use topology::Topology;
pub use topology::TopologyType;
pub use task::DistributionStrategy;
pub use task::Task;
pub use task::TaskId;
pub use task::TaskPriority as Priority;
pub use task::TaskResult;
pub use task::TaskStatus;

Modules§

agent
Core agent trait and related types
error
Error types for the swarm orchestration system
prelude
Prelude module for convenient imports
swarm
Swarm orchestrator implementation
task
Task definitions and task distribution logic
topology
Swarm topology definitions

Structs§

Metadata
Library metadata

Constants§

VERSION
Version information