TypeScript SDK — @neo4j-labs/agent-memory

The TypeScript SDK is a thin HTTP client over the NAMS hosted service. It runs on Node 20+, Bun, Deno, Cloudflare Workers, and Vercel Edge.

Install

npm install @neo4j-labs/agent-memory
# or
pnpm add @neo4j-labs/agent-memory
bun add @neo4j-labs/agent-memory

Requires Node.js 20+.

Quick start

Get an API key from memory.neo4jlabs.com, set MEMORY_API_KEY, then:

import { MemoryClient } from "@neo4j-labs/agent-memory";

const client = new MemoryClient();

const conv = await client.shortTerm.createConversation({ userId: "alice" });
await client.shortTerm.addMessage(conv.id, "user", "Hello!");

const entity = await client.longTerm.addEntity("Alice Johnson", "person", {
  description: "Software engineer working on graph memory.",
});

const ctx = await client.shortTerm.getContext(conv.id);
console.log(ctx.recentMessages, ctx.observations, ctx.reflections);

For edge runtimes (Cloudflare Workers, Vercel Edge), pass the API key explicitly — see Edge Runtime.

Framework integrations

All five ship as subpath exports.

Integration Import Guide

Vercel AI SDK

@neo4j-labs/agent-memory/middleware/vercel-ai

Vercel AI SDK

MCP tools

@neo4j-labs/agent-memory/mcp

MCP Tools

LangChain JS

@neo4j-labs/agent-memory/integrations/langchain

LangChain JS

Mastra

@neo4j-labs/agent-memory/integrations/mastra

Mastra

AWS Strands

@neo4j-labs/agent-memory/integrations/strands

Strands

Source and releases

Looking for the Python SDK?

See Python SDK. The two SDKs share the same memory model and back onto the same NAMS service. Mixed Python + TypeScript agents can read and write the same memory.