본문으로 건너뛰기
cccskills
무료GitHub에 공개

AgentDB Performance Optimization

Optimize AgentDB with quantization, HNSW tuning, caching, batch ops, and pruning.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md4.4 KB
  • CONCOMITANT_SKILLS.md607 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

AgentDB Performance Optimization

Quick Start

# Run benchmarks
npx agentdb@latest benchmark
import { createAgentDBAdapter } from 'agentic-flow/reasoningbank';

const adapter = await createAgentDBAdapter({
  dbPath: '.agentdb/optimized.db',
  quantizationType: 'binary',   // 32x memory reduction
  cacheSize: 1000,
  enableLearning: true,
  enableReasoning: true,
});

Quantization Types

TypeMemory ReductionSpeed GainAccuracy RetainedBest For
binary32x10x95-98%1M+ vectors, edge/mobile
scalar4x3x98-99%10K-1M, production
product8-16x5x93-97%High-dim (>512d) embeddings
none1x1x100%<10K vectors, max accuracy
const adapter = await createAgentDBAdapter({
  quantizationType: 'binary',  // or 'scalar', 'product', 'none'
});

HNSW Tuning

const adapter = await createAgentDBAdapter({
  dbPath: '.agentdb/vectors.db',
  hnswM: 16,              // Connections per layer
  hnswEfConstruction: 200, // Build quality
  hnswEfSearch: 100,       // Search quality
});

Parameter guide by dataset size:

DatasethnswMhnswEfConstructionhnswEfSearch
<10K810050
10K-100K16200100
100K-1M32200100
>1M48400200

Higher M = better recall, more memory. Higher efSearch = better recall, slower search.


Caching

const adapter = await createAgentDBAdapter({
  cacheSize: 1000,  // LRU cache for most-used patterns
});

// Monitor hit rate
const stats = await adapter.getStats();
console.log('Cache Hit Rate:', stats.cacheHitRate);  // Target >80%

Sizing: small apps 100-500, medium 500-2000, large 2000-5000.


Batch Operations

Batch Insert

// Use insertPattern in a loop -- AgentDB batches internally per transaction
const patterns = documents.map(doc => ({
  id: '',
  type: 'document',
  domain: 'knowledge',
  pattern_data: JSON.stringify({ embedding: doc.embedding, text: doc.text }),
  confidence: 1.0,
  usage_count: 0,
  success_count: 0,
  created_at: Date.now(),
  last_used: Date.now(),
}));

for (const pattern of patterns) {
  await adapter.insertPattern(pattern);
}

Batch Retrieval

const results = await Promise.all(
  queries.map(q => adapter.retrieveWithReasoning(q, { k: 5 }))
);

Memory Optimization

Automatic Consolidation

const result = await adapter.retrieveWithReasoning(queryEmbedding, {
  domain: 'documents',
  optimizeMemory: true,  // Merges similar patterns, prunes low-quality
  k: 10,
});
// result.optimizations: { consolidated, pruned, improved_quality }

Manual Optimization

await adapter.optimize();

Pruning

await adapter.prune({
  minConfidence: 0.5,
  minUsageCount: 2,
  maxAge: 30 * 24 * 3600,  // 30 days
});

Monitoring

npx agentdb@latest stats .agentdb/vectors.db
const stats = await adapter.getStats();
// stats: { totalPatterns, dbSize, avgConfidence, cacheHitRate, avgSearchLatency, avgInsertLatency }

Optimization Recipes

Maximum Speed

const adapter = await createAgentDBAdapter({
  quantizationType: 'binary',
  cacheSize: 5000,
  hnswM: 8,
  hnswEfSearch: 50,
});
// <50us search, 90-95% accuracy

Balanced

const adapter = await createAgentDBAdapter({
  quantizationType: 'scalar',
  cacheSize: 1000,
  hnswM: 16,
  hnswEfSearch: 100,
});
// <100us search, 98-99% accuracy

Maximum Accuracy

const adapter = await createAgentDBAdapter({
  quantizationType: 'none',
  cacheSize: 2000,
  hnswM: 32,
  hnswEfSearch: 200,
});
// <200us search, 100% accuracy

Edge/Mobile

const adapter = await createAgentDBAdapter({
  quantizationType: 'binary',
  cacheSize: 100,
  hnswM: 8,
});
// ~10MB for 100K vectors

Troubleshooting

High memory: Check npx agentdb@latest stats, switch to binary quantization.

Slow search: Increase cacheSize, reduce k, lower hnswEfSearch.

Low accuracy: Use scalar instead of binary, increase hnswEfSearch.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

13c0e3

무료

Gay MCP skill at invocation 26

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

19d57d

무료

Gay MCP skill at invocation 5

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1ea91a

무료

Gay MCP skill at invocation 27

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1eab21

무료

Gay MCP skill at invocation 3

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

plurigrid의 스킬 모두 보기

이 스킬의 문제 신고