cerebro 1.1.3

A high-performance semantic memory engine for AI Agents, now featuring SwarmForge for built-in multi-agent orchestration.
Documentation
cerebro-1.1.3 has been yanked.

Cerebro 🧠

A blazing-fast, storage-agnostic Memory Layer for AI Agents, written in pure Rust.

Crates.io docs.rs License: MIT

Cerebro functions as the Hippocampus for autonomous AI. It natively understands Agentic Memory structures (Working, Episodic, and Semantic memory) with pluggable storage backends.

With SwarmForge, it provides a built-in multi-agent orchestration engine — enabling teams of specialized AI agents to collaborate through its three-tier memory system.

Quick Start

[dependencies]
cerebro = "1.1.2"

Memory Engine + Hybrid Search

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.")).await.unwrap();

    let results = engine.query("memory safety", 1).await.unwrap();
    println!("Match: {}", results[0].0.chunk.text);
}

SwarmForge — Multi-Agent Orchestration

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

#[tokio::main]
async fn main() {
    // 1. Initialize Memory Bus
    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())));
    
    // 2. Run Swarm
    let mut swarm = SwarmOrchestrator::new(memory);

    swarm.register_agent(AgentConfig {
        id: "analyst".into(),
        name: "Security Analyst".into(),
        system_prompt: "Analyze code for 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 this code snippet",
    ).await.unwrap();
}

Features

  • Three-tier memory: Working (KV), Episodic (Conversation), Semantic (Vector).
  • SwarmForge: Sequential, parallel, and hierarchical multi-agent pipelines.
  • Universal LLM: Support for Ollama, OpenAI, Gemini, Anthropic, and any OpenAI-compatible API (Groq, etc).
  • Hybrid Search: Reciprocal Rank Fusion (RRF) combining keyword and vector retrieval.
  • MCP Server: Native Model Context Protocol support (cerebro-mcp).

License

MIT