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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@neo4j-labs/agent-memory

v0.3.0

Published

Neo4j Labs: TypeScript client for the Neo4j Agent Memory Service (NAMS)

Downloads

77

Readme

@neo4j-labs/agent-memory

Neo4j Labs Status: Beta Community Supported

New home: this package moved from neo4j-labs/agent-memory-tck to neo4j-labs/agent-memory, alongside the Python SDK. Install path, package name, and exports are unchanged — npm install @neo4j-labs/agent-memory.

TypeScript client for the Neo4j Agent Memory Service — short-term, long-term, and reasoning memory for AI agents, backed by Neo4j.

⚠️ Neo4j Labs Project

This project is part of Neo4j Labs and is actively maintained, but not officially supported. There are no SLAs or guarantees around backwards compatibility and deprecation. For questions and support, please use the Neo4j Community Forum.

✨ Features

  • Three memory subclients in one client: short-term (conversations, messages, three-tier context), long-term (entities, search, relationships, graph view), and reasoning (steps, traces, provenance, tool calls).
  • Zero-config construction — reads MEMORY_API_KEY from the environment and defaults to the hosted service.
  • Works in Node 20+, Bun, Deno, Cloudflare Workers, and Vercel Edge.
  • Five framework integrations: Vercel AI SDK middleware, MCP tools, LangChain JS, Mastra, and AWS Strands Agents.
  • Built-in request logging, request-id correlation, and edge-friendly fetch-only transports.
  • TCK Bronze conformance verified by the agent-memory-tck cross-language test suite.

📦 Installation

npm install @neo4j-labs/agent-memory

Requires Node.js 20+.

🚀 Quick start

Get an API key from memory.neo4jlabs.com, export it as 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);

On the edge

Edge runtimes (Cloudflare Workers, Vercel Edge) expose environment variables via the request handler scope, not process.env. Pass the key explicitly:

export default {
  async fetch(req: Request, env: { MEMORY_API_KEY: string }) {
    const client = new MemoryClient({ apiKey: env.MEMORY_API_KEY });
    // ...
  },
};

🧩 Integrations

All four ship as subpath exports. See each integration's example and how-to guide for a runnable walkthrough.

| Integration | Import | Example | |---|---|---| | Vercel AI SDK | @neo4j-labs/agent-memory/middleware/vercel-ai | examples/vercel-ai | | MCP tools | @neo4j-labs/agent-memory/mcp | examples/mcp | | LangChain JS | @neo4j-labs/agent-memory/integrations/langchain | examples/langchain | | Mastra | @neo4j-labs/agent-memory/integrations/mastra | examples/mastra | | AWS Strands | @neo4j-labs/agent-memory/integrations/strands | examples/strands |

📖 Documentation

Full API reference (TypeDoc) is published at neo4j-labs.github.io/agent-memory/typescript/.

🔧 Configuration

The client accepts a small options bag:

new MemoryClient({
  endpoint: "https://memory.neo4jlabs.com/v1",  // default
  apiKey: "nams_...",                            // falls back to MEMORY_API_KEY env
  timeout: 30_000,                               // ms; default 30s
  headers: { "X-My-Trace": "..." },              // additional request headers
  logger: (event) => console.log(event),         // request/response/error events
});

connect() is optional — the first request acts as the implicit auth check. Call it explicitly if you prefer fail-fast at startup.

🤝 Contributing

We welcome contributions. See the repo-root CONTRIBUTING.md for the development setup, test commands, and PR conventions — there is a dedicated "TypeScript contributions" section covering Node setup, vitest, linting, and the TCK bridge.

This package lives alongside the Python SDK (neo4j-agent-memory) in neo4j-labs/agent-memory. The two SDKs implement the same memory model and share the same backend (NAMS). The cross-language behavioral contract is defined and certified by the agent-memory-tck spec repo, which consumes this package from npm.

💬 Support

📝 License

Apache-2.0 — see LICENSE.