Skip to main content
The @atomicmemory/sdk package is the typed TypeScript interface for building AI applications on top of AtomicMemory. It gives you a single, consistent API for storing and retrieving agent memories regardless of which backend you run — AtomicMemory Core on your own infrastructure, or a hosted Mem0 instance. Beyond the memory surface, the SDK also ships local embedding generation via Transformers.js, cosine-similarity search primitives, and KV/cache storage adapters, so you can assemble a complete memory pipeline without pulling in extra libraries.

Installation

The SDK requires Node.js 22 or later.
npm install @atomicmemory/sdk
# or
pnpm add @atomicmemory/sdk
# or
yarn add @atomicmemory/sdk

Main Exports

The root @atomicmemory/sdk entry point exports everything you need for most use cases:
ExportDescription
MemoryClientPrimary surface for memory operations — ingest, search, get, delete, package, and list.
AtomicMemoryProviderHTTP adapter that connects MemoryClient to an AtomicMemory Core backend.
Mem0ProviderHTTP adapter that connects MemoryClient to a Mem0 backend (OSS or hosted).
StorageManagerKV and cache adapters for artifact storage operations.
EmbeddingGeneratorLocal embedding generation via Transformers.js — no external API call required.
SemanticSearchCosine-similarity search primitives for building custom retrieval pipelines.

Subpath Exports

The SDK is split into focused subpath exports so you can import only what you need and keep bundle sizes in check:
Import pathContents
@atomicmemory/sdkMain entry — includes MemoryClient, providers, and all top-level exports.
@atomicmemory/sdk/browserBrowser-safe subset: MemoryClient and memory types without storage, embedding, or search surface.
@atomicmemory/sdk/storageStorage artifact client and types (ConcreteStorageClient, StoredArtifact, error classes).
@atomicmemory/sdk/kv-cacheKV and cache adapters (IndexedDB, in-memory) used internally by the embedding cache.
@atomicmemory/sdk/embeddingEmbeddingGenerator for local embedding inference.
@atomicmemory/sdk/searchSemanticSearch cosine-similarity primitives.
@atomicmemory/sdk/utilsShared utility helpers.
@atomicmemory/sdk/coreError types and event primitives.
@atomicmemory/sdk/memoryMemory types, the MemoryProvider interface, and provider adapters only.

Quick Example

import { MemoryClient } from '@atomicmemory/sdk';

const memory = new MemoryClient({
  providers: {
    atomicmemory: {
      apiUrl: process.env.ATOMICMEMORY_URL!,
      apiKey: process.env.ATOMICMEMORY_KEY!,
    },
  },
});
await memory.initialize();

await memory.ingest({
  mode: 'messages',
  messages: [{ role: 'user', content: 'I prefer dark mode and TypeScript.' }],
  scope: { user: 'alice' },
});

const result = await memory.search({
  query: 'editor preferences',
  scope: { user: 'alice' },
});

console.log(result.results[0].memory.content);
MemoryClient must only be instantiated inside a trusted server-side process — a Node.js server, an edge function, or server-side framework routes. In v1, browser bundles must not instantiate MemoryClient directly because it uses a shared bearer credential. For browser use, call your own server endpoint that wraps the SDK, or import from @atomicmemory/sdk/browser for the restricted browser-safe subset.

Explore the SDK

MemoryClient

Full API reference for ingest, search, get, delete, package, and list operations.

Scope

How to route and isolate memories with user, agent, namespace, and thread fields.

Providers

Configure AtomicMemory Core or Mem0 as the memory backend.