TypeScript framework integrations

See also the Python framework integrations index for the equivalent guides in the Python SDK.

Find the right TypeScript integration for your agent framework, each backed by the same MemoryClient.

Prerequisites: a configured MemoryClient — see the TypeScript SDK page — and, for the hosted backend, NAMS credentials.

Pick a guide

Framework What it gives you

Vercel AI SDK

agentMemoryMiddleware injects three-tier context into each model call and persists both the user’s input and the assistant’s response — streamed or not.

NAMS AI provider

A separate package (@neo4j-labs/nams-ai-provider) with four selectable modes — provider, middleware, tools and hooks — all on the same NAMS backend. Cross-session search and graph expansion are retrieval settings (crossSessionLimit, graphExpansionLimit) that the provider, middleware and tools modes share.

LangChain JS

Neo4jChatMessageHistory and Neo4jEntityRetriever supply framework-neutral history and retrieval objects that you adapt to LangChain’s APIs.

Mastra

Neo4jMastraMemory is a thin thread-and-message-history adapter in Mastra’s vocabulary, driven alongside your agent rather than passed as its memory.

Strands Agents

Neo4jMemoryStore is a Strands MemoryStore, and connectMemoryToAgent wires session state and three-tier context injection into a Strands Agent in one call.

Other languages

Agent Memory also ships clients for languages besides TypeScript. The hosted Python, C# and R clients below live in the clients/ directory of the agent-memory-tck repository and are not published to PyPI, NuGet or CRAN, so install them from a checkout of that repository.

  • Python — the neo4j-agent-memory package connects to Neo4j over Bolt or to hosted NAMS over HTTP and ships its own framework integrations; see Agent framework integrations and backend capabilities for what each backend supports. LangGraph (MemoryCheckpointSaver) and PydanticAI (MemoryToolset, inject_memory_context) integrations are also available through the separate hosted client neo4j_agent_memory_client (pip install ./clients/python):

    from neo4j_agent_memory_client import MemoryClient
    from neo4j_agent_memory_client.integrations.langgraph import MemoryCheckpointSaver
    
    client = MemoryClient(endpoint="https://memory.neo4jlabs.com/v1", api_key=...)
    saver = MemoryCheckpointSaver(client)
    
    graph = StateGraph(MyState)
    graph.compile(checkpointer=saver)
  • C# — in the Neo4j.AgentMemory project (clients/csharp/src/Neo4j.AgentMemory, added as a project reference), MemoryConnector provides save/search and a GetContextPrefixAsync helper for Semantic Kernel functions:

    using Neo4j.AgentMemory.Integrations.SemanticKernel;
    
    var client = new MemoryClient(...);
    var connector = new MemoryConnector(client);
    
    await connector.SaveAsync(collection: "concept", id: "ddd", text: "Domain-Driven Design");
    var hits = await connector.SearchAsync("microservice patterns", limit: 5);
    var contextPrefix = await connector.GetContextPrefixAsync(conversationId);
  • R — in the neo4j.memory package (install.packages("clients/rlang/neo4j.memory", repos = NULL, type = "source")), register_memory_tools(client) returns a list of ellmer tool() definitions wrapping all 12 memory tools:

    library(neo4j.memory)
    library(ellmer)
    
    client <- MemoryClient$new(endpoint = "...", api_key = ...)
    tools <- register_memory_tools(client)
    
    chat <- chat_openai(model = "gpt-4o")
    for (t in tools) chat$register_tool(t$name, t$description, t$handler)