omega-agentdb
SIMD-optimized vector database with HNSW indexing for agent storage, skill management, and semantic search.
Overview
omega-agentdb is a high-performance, in-memory vector database optimized for AI agent systems. It provides four specialized subsystems: vector storage with HNSW approximate nearest neighbor search, reflexion episode tracking for agent learning, causal graph analysis for action-outcome relationships, and semantic skill management.
Built with SimSIMD for hardware-accelerated vector operations, AgentDB achieves 13-41x speedup over standard implementations on modern CPUs with AVX-512 support.
Features
- SIMD-Accelerated Vector Search: SimSIMD optimization for 13-41x faster cosine similarity
- HNSW Index: Hierarchical Navigable Small World graphs for sub-linear search
- Reflexion System: Store and analyze agent learning episodes
- Causal Graphs: Track cause-effect relationships with confidence scores
- Skill Management: Semantic search for learned skills with usage tracking
- High Performance: Optimized for 4096-dimensional embeddings (configurable)
- Async-First: Full Tokio integration for concurrent operations
- Type-Safe API: Strongly typed with comprehensive error handling
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
async
Core Concepts
Vector Storage
AgentDB uses a two-layer approach:
- HNSW Index: Approximate nearest neighbor search for fast retrieval
- SimSIMD: Hardware-accelerated distance computations
The HNSW index provides O(log n) search complexity with high recall, while SimSIMD leverages AVX-512, AVX2, NEON, and other SIMD instruction sets for massive speedups.
Reflexion Episodes
Reflexion captures agent learning experiences:
Causal Edges
Model cause-effect relationships:
Skills
Semantic skill storage with embeddings:
Use Cases
1. Semantic Agent Memory
use ;
let db = new.await?;
// Store agent memories with embeddings
let memory_embedding = get_embedding;
let id = db.vector_store.await?;
// Later, retrieve relevant memories
let query_embedding = get_embedding;
let relevant = db.vector_search.await?;
2. Agent Learning with Reflexion
use ;
use Utc;
let db = new.await?;
// Store a learning episode
let episode = ReflexionEpisode ;
db.reflexion_store.await?;
// Analyze learning progress
let stats = db.reflexion_analyze.await?;
println!;
println!;
3. Causal Discovery
use ;
use Utc;
let db = new.await?;
// Record causal relationship
let edge = CausalEdge ;
db.causal_add_edge.await?;
// Query what causes improved latency
let causes = db.causal_query_causes.await?;
for cause in causes
// Find causal paths
let paths = db.causal_find_path.await?;
4. Skill Library
use ;
use Utc;
let db = new.await?;
// Add skills to library
let skill = Skill ;
let skill_id = db.skill_create.await?;
// Find relevant skills by embedding
let query = get_skill_embedding;
let skills = db.skill_search_by_embedding.await?;
for in skills
// Update skill statistics after use
db.skill_update_stats.await?; // success = true
5. Multi-Session Agent Coordination
use ;
let db = new.await?;
// Multiple agents share knowledge through vector database
for agent_id in
// Any agent can query collective knowledge
let query = get_embedding;
let collective_knowledge = db.vector_search.await?;
// Track which agent contributed most relevant knowledge
for result in collective_knowledge
Examples
HNSW Performance Benchmarking
use ;
use Instant;
let db = new.await?;
// Insert 10,000 vectors
let start = now;
for i in 0..10_000
println!;
// Search benchmark
let query: = vec!;
let start = now;
let results = db.vector_search.await?;
println!;
println!;
Database Statistics
let stats = db.stats.await;
println!;
println!;
println!;
println!;
println!;
Architecture
AgentDB integrates seamlessly with the Omega ecosystem:
┌────────────────────────────────────────┐
│ omega-runtime / Applications │
└──────────────┬─────────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ omega-agentdb │
│ ┌──────────────┬──────────────────┐ │
│ │ Vector Store │ Reflexion │ │
│ │ (HNSW) │ Episodes │ │
│ ├──────────────┼──────────────────┤ │
│ │ Causal Graph │ Skill Library │ │
│ └──────────────┴──────────────────┘ │
└──────────────┬─────────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ SimSIMD (SIMD-optimized similarity) │
│ instant-distance (HNSW index) │
└────────────────────────────────────────┘
Performance
AgentDB is optimized for modern hardware:
SIMD Acceleration (SimSIMD)
- AVX-512: 41x speedup for 4096-dim vectors
- AVX2: 28x speedup for 4096-dim vectors
- NEON (ARM): 13x speedup for 4096-dim vectors
- Fallback: Optimized scalar implementation
HNSW Index Performance
- Build time: O(n log n) for n vectors
- Search time: O(log n) with >95% recall
- Memory: ~32 bytes per vector for M=16
Real-World Benchmarks
For 100K vectors (4096-dim, M=32, ef=100):
- Insert: ~2.5ms per vector
- Search (k=10): ~0.8ms per query
- Recall@10: 97.5%
Related Crates
- omega-core - Core types and traits
- omega-memory - Uses AgentDB for semantic memory
- omega-persistence - SQLite storage layer
- omega-loops - Temporal loop orchestration
- omega-meta-sona - Architecture search
- omega-runtime - Production runtime
License
Licensed under the MIT License. See LICENSE for details.