TypeScript SDK
v0.11.75 · Node 20+ · TypeScript 5.0+npm install @dakera-ai/dakera
# yarn add @dakera-ai/dakera | pnpm add @dakera-ai/dakera | bun add @dakera-ai/dakera
Client setup
import { DakeraClient } from '@dakera-ai/dakera';
// Recommended: set via env vars
// DAKERA_URL=http://<YOUR_SERVER_IP>:3300
// DAKERA_API_KEY=your-api-key
const client = new DakeraClient({
baseUrl: process.env.DAKERA_URL ?? 'http://localhost:3300',
apiKey: process.env.DAKERA_API_KEY,
});
Memory operations
await client.memories.store({ agentId: 'my-agent', content: 'User is learning Rust', importance: 0.8, tags: ['learning'] });
const memories = await client.memories.recall({ agentId: 'my-agent', query: 'programming languages', topK: 10 });
const filtered = await client.memories.batchRecall({ agentId: 'my-agent', tags: ['learning'], minImportance: 0.6 });
await client.memories.forget({ memoryId: 'mem-abc123' });
Sessions
const session = await client.sessions.start({ agentId: 'my-agent', metadata: { task: 'review' } });
await client.memories.store({ agentId: 'my-agent', content: 'Found issues', sessionId: session.id });
await client.sessions.end({ sessionId: session.id, summary: 'Review complete' });
const sessions = await client.sessions.list({ agentId: 'my-agent' });
TypeScript types
import type {
MemoryRecord, // { id, agentId, content, importance, tags, createdAt, sessionId? }
RecallResult, // extends MemoryRecord with score: number
StoreMemoryRequest, // { agentId, content, importance?, tags?, sessionId? }
RecallRequest, // { agentId, query, topK? }
Session, // { id, agentId, startedAt, endedAt?, memoryCount, summary? }
DakeraClient,
} from '@dakera-ai/dakera';
Vector operations
// Auto-embed and upsert text
await client.vectors.upsertText('docs', [
{ id: 'doc-001', text: 'Quarterly revenue report', metadata: { source: 'finance' } }
]);
// Query by text
const results = await client.vectors.queryText('docs', 'revenue trends', { topK: 5 });
// Hybrid search (vector + BM25)
const hybrid = await client.vectors.hybridSearch('docs', { text: 'revenue', vectorWeight: 0.7 });
Knowledge graph
// Build graph from seed memory
const graph = await client.knowledge.graph('my-agent', 'mem-abc', { depth: 2 });
// Cross-agent network
const network = await client.knowledge.crossAgentNetwork(['agent-a', 'agent-b']);
// Deduplicate (preview)
const dupes = await client.knowledge.deduplicate('my-agent', { dryRun: true });
Namespace management
await client.namespaces.create('production', { dimension: 1024, distance: 'cosine' });
const key = await client.namespaces.createKey('production', { name: 'reader', scope: 'read' });
await client.namespaces.setMemoryPolicy('production', { episodicTtlSeconds: 604800 });
Entity extraction & feedback
// Extract entities
const entities = await client.extractEntities('Alice met Bob at Google HQ');
// Feedback loop
await client.memories.feedback('mem-abc', 'upvote');
const summary = await client.agents.feedbackSummary('my-agent');
Batch operations
// Batch forget — remove memories matching filters
const resp = await client.batchForget({
agentId: 'my-agent', tags: ['obsolete'], maxImportance: 0.3
});
console.log(`Deleted ${resp.deletedCount} memories`);
// Batch query text — multi-query in one call
const results = await client.batchQueryText('docs', [
{ text: 'revenue report', topK: 5 },
{ text: 'product roadmap', topK: 3 },
]);
Autopilot & decay (admin)
// AutoPilot status
const status = await client.autopilotStatus();
// Update AutoPilot config
await client.autopilotUpdateConfig({ enabled: true, dedupThreshold: 0.93 });
// Trigger dedup or consolidation
await client.autopilotTrigger('dedup');
// Decay engine config
const decay = await client.decayConfig();
await client.decayUpdateConfig({ halfLifeDays: 30, minImportance: 0.01 });
Health probes
// Readiness probe (dependencies healthy)
const ready = await client.healthReady();
// Liveness probe (process alive)
const live = await client.healthLive();
Vector bulk operations
// Bulk update vectors by ID
await client.vectors.bulkUpdate('docs', [
{ id: 'doc-001', metadata: { reviewed: true } },
{ id: 'doc-002', metadata: { reviewed: true } },
]);
// Bulk delete vectors by ID
await client.vectors.bulkDelete('docs', ['doc-003', 'doc-004']);
// Count vectors in a namespace
const count = await client.vectors.count('docs');
Full-text index management
// Get full-text index stats
const stats = await client.vectors.fulltextStats('docs');
console.log(`Documents: ${stats.documentCount}, Terms: ${stats.termCount}`);
// Delete a full-text document
await client.vectors.fulltextDelete('docs', 'doc-001');
TTL & storage
// TTL engine stats
const ttl = await client.ttlStats();
// Storage tier overview
const tiers = await client.storageTierOverview();
// Memory type stats (episodic, semantic, procedural, working)
const typeStats = await client.memoryTypeStats();
Agent consolidation
// Trigger consolidation for an agent
await client.agents.consolidate('my-agent');
// Get consolidation log
const log = await client.agents.consolidationLog('my-agent');
// Patch consolidation config
await client.agents.patchConsolidationConfig('my-agent', { threshold: 0.9, maxBatch: 100 });
Namespace config
// Get entity extraction config
const config = await client.namespaces.getEntityConfig('production');
// Get namespace extractor settings
const extractor = await client.namespaces.getExtractor('production');
// Migrate namespace dimensions (e.g. 768 → 1024)
await client.namespaces.migrateDimensions('production', { targetDimension: 1024 });
Admin & ops
// Cluster status
const cluster = await client.clusterStatus();
// Maintenance mode
await client.adminEnableMaintenance({ reason: 'scheduled upgrade' });
await client.adminDisableMaintenance();
// Quota management
const quotas = await client.getQuotas();
await client.updateQuotas({ maxMemoriesPerAgent: 100000 });
// Slow query log
const slow = await client.slowQueries({ limit: 20 });
// Backups
const backup = await client.createBackup({ includeData: true });
const backups = await client.listBackups();
// Ops diagnostics
const diag = await client.opsDiagnostics();
// List background jobs
const jobs = await client.opsListJobs();
// Trigger compaction
await client.opsCompact('production');
// Graceful shutdown
await client.opsShutdown();
Import & export
const data = await client.exportMemories('my-agent', 'jsonl');
await client.importMemories('my-agent', mem0Data, 'mem0');
Error handling
import { DakeraError, NotFoundError, RateLimitError } from '@dakera-ai/dakera';
try {
const mem = await client.memories.get('mem-abc');
} catch (e) {
if (e instanceof NotFoundError) console.log('Not found');
else if (e instanceof RateLimitError) console.log(`Retry after ${e.retryAfter}s`);
else if (e instanceof DakeraError) console.log(`${e.errorCode}: ${e.message}`);
}
Error types: DakeraError, ConnectionError, NotFoundError, ValidationError, RateLimitError, ServerError, AuthenticationError, AuthorizationError, TimeoutError. Branded types: VectorId, AgentId, MemoryId, SessionId for compile-time safety.