SDK
Install the MemoryLayer SDK and start building with memory-powered applications.
Installation
bun add @memorylayer/sdk
Quick Start
import { createClient } from '@memorylayer/sdk';
// Initialize the client
const client = createClient({
apiKey: process.env.MEMORYLAYER_API_KEY
});
// Create your first memory
const memory = await client.memories.create({
layerId: "REPLACE_THIS_LAYER_ID",
content: 'I prefer dark mode in my applications',
});
console.log('Memory created:', memory.id);
Configuration
Environment Variables
Set these environment variables for easier configuration:
MEMORYLAYER_API_KEY
: Your API key for authentication
Manual Configuration
const client = createClient({
apiKey: process.env.MEMORYLAYER_API_KEY,
});
Error Handling
Always wrap API calls in try-catch blocks:
try {
const memory = await client.memories.create({
content: 'My content',
layerId: "REPLACE_THIS_LAYER_ID"
});
} catch (error) {
console.error('Failed to create memory:', error.message);
}
Next Steps
API Reference
The SDK wraps the MemoryLayer REST API. For direct API usage, see the API Reference.
Introduction
Memory Layer is an AI-powered memory management platform that transforms your information into an intelligent, searchable knowledge base. Unlike traditional storage, we understand context, extract relationships, and connect the dots between your memories.
Get memory
Retrieve a specific memory by its ID.