AgentDB Performance Optimization

Optimize AgentDB vector databases using quantization, HNSW indexing, caching, and batch operations.

1|1|Updated Nov 28, 2025
One-click install
npx skills add https://github.com/33may/robotics --skill agentdb-performance-optimization-33may
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: AgentDB Performance Optimization
Source: https://github.com/33may/robotics/tree/main/humanoid/.claude/skills/agentdb-optimization
Command: npx skills add https://github.com/33may/robotics --skill agentdb-performance-optimization-33may

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires agentdb, agentic-flow.

What problem does it solve? Vector databases consume excessive memory and deliver slow search at scale. This Skill provides concrete configuration recipes to reduce AgentDB memory usage by 4-32x and accelerate vector search from seconds to microseconds. ## Core Features & Use Cases - Quantization Strategies: Apply binary (32x), scalar (4x), or product (8-16x) quantization to shrink vector storage with documented accuracy trade-offs. - HNSW Index Tuning: Configure M, efConstruction, and efSearch parameters for O(log n) search across datasets from 10K to 1M+ vectors. - Caching & Batch Operations: Use in-memory LRU pattern caches and batch inserts to cut retrieval latency below 1ms and insert 100 vectors in 2ms. - Use Case: A production app storing 1M embeddings uses 3GB of RAM and 100s query times; applying binary quantization with HNSW reduces this to 96MB and 8ms searches. ## Quick Start Ask the AI to configure an AgentDB adapter with binary quantization, a 1000-entry cache, and HNSW indexing, then run npx agentdb@latest benchmark to verify the performance gains.

Frequently Asked Questions about AgentDB Performance Optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce AgentDB memory usage for large vector datasets?

Enable binary quantization by setting quantizationType to 'binary' in createAgentDBAdapter, which reduces memory 32x (e.g., 1M vectors from 3GB to 96MB) with roughly 2-5% accuracy loss. Scalar quantization offers a 4x reduction with higher accuracy.

How do I speed up vector search in AgentDB?

AgentDB automatically builds HNSW indices, delivering searches around 100µs versus 15ms for linear scans. You can tune hnswM, hnswEfConstruction, and hnswEfSearch parameters, and add an in-memory cache to bring repeated retrievals under 1ms.

What is the difference between binary, scalar, and product quantization?

Binary quantization gives 32x memory reduction with 95-98% accuracy, scalar gives 4x reduction with 98-99% accuracy, and product quantization gives 8-16x reduction with 93-97% accuracy. Choose based on dataset size and accuracy requirements.

Does AgentDB optimization work for mobile or edge deployments?

Yes. Combine binary quantization with a small cache (around 100 entries) and low HNSW connections (M=8) to run roughly 100K vectors in about 10MB of memory while keeping search under 100µs.

Why is my AgentDB search accuracy low after optimization?

Aggressive quantization or low HNSW search quality reduces recall. Switch from binary to scalar quantization, or raise hnswEfSearch to 200, to recover accuracy at the cost of some speed and memory.

How do I insert many vectors into AgentDB quickly?

Use batch inserts instead of individual insertPattern calls. Batching 100 vectors takes about 2ms versus roughly 1 second for sequential inserts, a 500x improvement according to the documented benchmarks.