@memnexus-ai/sdk
v1.60.6
Published
Official Node.js SDK for the MemNexus API
Maintainers
Readme
@memnexus-ai/sdk
Official Node.js / TypeScript SDK for the MemNexus API — persistent AI memory management.
Version: 1.53.28 Node.js: >= 18.0.0 Dependencies: none (uses native fetch)
Installation
npm install @memnexus-ai/sdkQuick Start
import { MemNexus } from '@memnexus-ai/sdk';
const client = new MemNexus({ apiKey: 'your-api-key' });
// Save a memory
await client.remember('I deployed the new feature to production');
// Search memories
const results = await client.search('deployment history');
console.log(results.data);
// Build context briefing
const briefing = await client.brief('working on auth module');
console.log(briefing.data);
// Recall a digest
const digest = await client.recall('authentication decisions');
console.log(digest.data);
// Delete a memory
await client.forget('mem_abc123');Authentication
Pass the API key directly or via the MEMNEXUS_API_KEY environment variable:
// Direct
const client = new MemNexus({ apiKey: 'your-api-key' });
// Environment variable
process.env.MEMNEXUS_API_KEY = 'your-api-key';
const client = new MemNexus();Services
The client exposes a service for each API resource group:
const client = new MemNexus({ apiKey: 'your-api-key' });
// User management and profile endpoints
client.users
// Topic detection, clustering, and management endpoints
client.topics
// System health, monitoring, and configuration endpoints
client.system
// Pattern detection and behavioral analysis endpoints
client.patterns
// Behavioral pattern tracking and state management endpoints
client.behavior
// Behavioral recommendation management endpoints (v2)
client.recommendations
// Narrative thread management endpoints
client.narratives
// Observability and metrics endpoints for production monitoring
client.monitoring
// Memory management and retrieval endpoints
client.memories
// Invite code validation and gate status endpoints
client.invites
// Health check endpoints
client.health
// Graph-based retrieval augmented generation endpoints
client.graphrag
// Fact extraction and management endpoints
client.facts
// Entity extraction and discovery endpoints
client.entities
// Conversation tracking and analysis endpoints
client.conversations
// Subscription billing and payment management endpoints
client.billing
// Artifact storage and retrieval endpoints
client.artifacts
// API key management endpoints
client.apiKeys
// System alerts banner endpoints (customer portal)
client.alerts
// Admin management endpoints for invite codes and platform configuration
client.admin
// Admin endpoints for managing system alerts
client.adminAlerts
// Admin Pipeline
client.adminPipelineError Handling
import { MemNexus, SdkError } from '@memnexus-ai/sdk';
const client = new MemNexus({ apiKey: 'your-api-key' });
try {
await client.remember('my memory');
} catch (err) {
if (err instanceof SdkError) {
console.error(`API error ${err.status}: ${err.statusText}`);
console.error('Response body:', err.data);
}
}Configuration
const client = new MemNexus({
apiKey: 'your-api-key',
baseUrl: 'https://api.memnexus.ai', // default
timeoutMs: 30_000, // default: 30 seconds
});Retry Behaviour
The client automatically retries failed requests with exponential backoff:
- Max attempts: 5
- Base delay: 500 ms
- Max delay: 10 000 ms
- Backoff factor: 2×
- Retried status codes: 408, 429, 500, 502, 503, 504
License
Proprietary — Copyright © MemNexus Team
