npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

memofai

v2.1.1

Published

Official JavaScript/TypeScript SDK for Memory-of-Agents (MOA) - AI memory infrastructure for intelligent applications

Readme

memofai

npm version License: MIT TypeScript

Official JavaScript/TypeScript SDK for Memory-of-Agents (MOA). Build intelligent applications with persistent AI memory.

Features

Clean Namespace API - Intuitive methods organized by resource type
🔒 Type-Safe - Full TypeScript support with comprehensive types
🧠 Memory Management - Store, search, and retrieve AI agent memories
🤖 Bot Operations - Create and manage AI bots with ease
🏢 Workspace Control - Organize your AI infrastructure
Auto-Retry - Built-in retry logic for resilient API calls
🎯 Natural Language Search - Query memories conversationally

Installation

npm install memofai

Quick Start

Get Your API Token

  1. Visit dashboard.memof.ai/dashboard/tokens
  2. Click "Create New Token"
  3. Copy your token (format: moa_...)

Basic Example

import { createMoaClient } from 'memofai';

const client = createMoaClient({
  apiToken: 'moa_your_token_here',
  environment: 'production'
});

// Create a workspace
const workspace = await client.workspaces.create({
  name: "My AI Workspace",
  description: "Workspace for my AI agents"
});

// Create a bot
const bot = await client.bots.create({
  name: "Assistant",
  description: "Helpful AI assistant",
  moa_workspace: workspace.id,
  type: "conversational",
  status: "active"
});

// Store a memory
const memory = await client.memories.store({
  bot_id: bot.id,
  content_text: "User prefers concise responses",
  memory_type: "preference"
});

// Search memories
const results = await client.memories.search({
  bot_id: bot.id,
  query: "How should I communicate with the user?",
  top_k: 5
});

API Reference

Configuration

const client = createMoaClient({
  apiToken: 'moa_your_token',
  environment: 'production', // 'dev' | 'alpha' | 'beta' | 'sandbox' | 'production'
  timeout: 30000,            // Optional: request timeout (ms)
  retries: 3,                // Optional: retry attempts
  retryDelay: 1000          // Optional: retry delay (ms)
});

Workspaces

// List all workspaces
const workspaces = await client.workspaces.list();

// Create workspace
const workspace = await client.workspaces.create({
  name: "My Workspace",
  description: "Optional description"
});

// Get workspace
const workspace = await client.workspaces.retrieve(workspaceId);

// Update workspace
const updated = await client.workspaces.update(workspaceId, {
  name: "New Name"
});

// Delete workspace
await client.workspaces.delete(workspaceId);

Bots

// List all bots
const bots = await client.bots.list();

// Create bot
const bot = await client.bots.create({
  name: "My Bot",
  description: "AI assistant",
  moa_workspace: workspaceId,
  type: "conversational",
  status: "active"
});

// Get bot
const bot = await client.bots.retrieve(botId);

// Update bot
const updated = await client.bots.update(botId, {
  name: "Updated Name"
});

// Delete bot
await client.bots.delete(botId);

Memories

// Store memory
const memory = await client.memories.store({
  bot_id: botId,
  content_text: "User prefers dark mode",
  memory_type: "preference"
});

// List memories
const result = await client.memories.list(botId, {
  memory_type: "preference",
  limit: 20
});

// Search memories
const results = await client.memories.search({
  bot_id: botId,
  query: "What are user preferences?",
  top_k: 5,
  generate_answer: true
});

// Reprocess memory
const result = await client.memories.reprocess(memoryId, {
  bot_id: botId
});

// Delete memory
await client.memories.delete(memoryId, {
  bot_id: botId
});

Error Handling

import { ValidationError, NotFoundError, AuthenticationError } from 'memofai';

try {
  const bot = await client.bots.retrieve(botId);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error('Validation errors:', error.validationErrors);
  } else if (error instanceof NotFoundError) {
    console.error('Bot not found');
  } else if (error instanceof AuthenticationError) {
    console.error('Invalid API token');
  }
}

TypeScript Support

Full TypeScript support with comprehensive types:

import type {
  Workspace,
  Bot,
  Memory,
  CreateWorkspaceBody,
  CreateBotBody,
  StoreMemoryBody,
  SearchMemoriesResponse
} from 'memofai';

Environments

| Environment | Description | |------------|-------------| | dev | Local development | | alpha | Early testing | | beta | Pre-production | | sandbox | Testing & development | | production | Production (default) |

Links

Support

License

MIT License - see LICENSE file for details.


Built with ❤️ by the Memory-of-Agents Team

Store Memory