cerebro 1.1.0

A high-performance semantic memory engine + multi-agent swarm orchestrator for AI, written in pure Rust.
Documentation
cerebro-1.1.0 has been yanked.

Cerebro 🧠

A high-performance semantic memory engine + multi-agent swarm orchestrator for AI, written in pure Rust.

Crates.io docs.rs License: MIT

Cerebro provides a three-tier cognitive memory system (Working, Episodic, Semantic) with pluggable storage backends and a built-in multi-agent swarming engine. Agents don't just store vectors — they remember, reason, and collaborate.

Quick Start

[dependencies]
cerebro = "1.0.1"

Memory Engine

use cerebro::prelude::*;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let engine = MemoryEngine::new(
        Arc::new(RecursiveCharacterChunker::new(512, 50)),
        Arc::new(MockEmbedder::new(1536)),
        Arc::new(MemoryVectorStore::new()),
    );

    engine.ingest_document(Document::new("Rust ensures memory safety at compile time.")).await.unwrap();

    let results = engine.query("memory safety", 5).await.unwrap();
    for (node, score) in results {
        println!("[{:.3}] {}", score, node.chunk.text);
    }
}

Multi-Agent Swarming

use cerebro::prelude::*;
use cerebro::swarm::prelude::*;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let engine = Arc::new(MemoryEngine::new(
        Arc::new(RecursiveCharacterChunker::new(512, 50)),
        Arc::new(MockEmbedder::new(8)),
        Arc::new(MemoryVectorStore::new()),
    ));
    let memory = Arc::new(CerebroMemoryBus::new(engine, Arc::new(MemoryKVStore::new())));
    let mut swarm = SwarmOrchestrator::new(memory);

    swarm.register_agent(AgentConfig {
        id: "analyst".into(),
        name: "Security Analyst".into(),
        system_prompt: "Analyze code for security vulnerabilities.".into(),
        model: LlmProvider::Ollama { model: "llama3".into(), base_url: "http://localhost:11434".into() },
        tools: vec![], handoff_targets: vec![], max_steps: 10,
    });

    let result = swarm.execute(
        SwarmPattern::Sequential { agent_order: vec!["analyst".into()] },
        "Review: fn process(data: &[u8]) { unsafe { ... } }",
    ).await.unwrap();

    println!("{}", result.final_output);
}

Features

Feature Description
Three-tier memory Working (KV), Episodic (conversation), Semantic (vector search)
SwarmForge Sequential, parallel, and hierarchical multi-agent orchestration
Universal LLM Ollama, OpenAI, Gemini, Anthropic, any OpenAI-compatible API
Hybrid search RRF combining keyword + vector retrieval (PgVector)
Consolidation Background worker for autonomous memory pruning
MCP server cerebro-mcp binary for AI desktop apps

Feature Flags

Flag Enables
local_models Local embeddings via HuggingFace Candle
qdrant Qdrant distributed vector storage
pdf PDF text extraction
graph Neo4j knowledge graph persistence
python PyO3 bindings
wasm Browser/Edge worker support

License

MIT


Author: Suraj Kumar Nanda | surajkumarnanda.com