Java AI agent memory: every library, compared.

The definitive comparison of agent memory libraries on the JVM — from LangChain4j ChatMemory and Spring AI ChatMemory to Koog AgentMemory, Google ADK Memory Bank, Embabel, and the community Mem0 Java wrapper. What each one does, where each one stops, and what Java AI teams actually end up building when none of them fit.

Last updated May 12, 2026 · 9 libraries tracked · Edit on GitHub

"Memory" means three different things.

Before the comparison makes sense, we need to be precise. There are at least three things people mean when they say "agent memory," and most discussions conflate them:

1. Conversation history

The last N messages of the current session. Solved problem — every framework ships this. This is what LangChain4j ChatMemory and Spring AI ChatMemory do.

2. State checkpointing

Snapshots of agent execution state for resume and replay. Solved by LangGraph, Koog persistence, Temporal-style runtimes. A different problem from knowledge memory entirely.

3. Long-term knowledge memory

Facts about the user, their preferences, their projects — extracted from conversations, stored durably, retrievable across sessions, and de-conflicted when they change. This is what Mem0, Zep, and Letta do in Python. It is not solved on the JVM.

This site is about the third one.

Feature matrix

Every library on the JVM with any form of agent memory support, and what each actually does. Hover or tap the column headers to jump to the library details.

Feature LangChain4j Spring Google Koog Embabel Mem0 (wrap) Zep DIY Engram
Chat history
Fact extraction
Conflict detection
Vector search
Keyword search
Graph traversal
Hybrid retrieval
Temporal reasoning
Token-budgeted context
Decay & consolidation
MCP server
Zero infrastructure
Yes Partial No Not applicable

The libraries

One card per option. For each: what it is, what it does well, what it doesn't, the exact Maven coordinates when applicable, and a representative code example.

Message window persistence with a pluggable store

Chat History Active Java Apache 2.0 ★ 9,000

The most popular LLM library on the JVM. Ships a ChatMemory interface with MessageWindowChatMemory and TokenWindowChatMemory implementations. Persistence is bring-your-own via the ChatMemoryStore interface.

dev.langchain4j:langchain4j:1.0.0

What it does well

  • Mature, well-documented, widely adopted
  • Clean abstraction for message history
  • Pluggable storage via ChatMemoryStore
  • Token-aware window eviction

Where it stops

  • No fact extraction — it is a message container
  • No semantic search built in (RAG is a separate subsystem)
  • Every team implements their own knowledge layer on top
ChatMemory chatMemory = MessageWindowChatMemory.withMaxMessages(20);
chatMemory.add(UserMessage.from("I'm allergic to peanuts"));
chatMemory.add(AiMessage.from("Got it, I'll remember that."));
// Next session: chatMemory is empty unless ChatMemoryStore is implemented

Message history with the broadest backend coverage

Chat History Active Java Apache 2.0 ★ 6,000

Spring AI's ChatMemory shipped GA in 2025 with JDBC (Postgres, MySQL, Oracle, SQL Server), Cassandra, Mongo, Neo4j, and Cosmos DB backends. Three advisors plug it into ChatClient. The VectorStoreChatMemoryAdvisor indexes raw messages in a VectorStore but does not extract facts.

org.springframework.ai:spring-ai-core:1.0.5

What it does well

  • Broadest backend support of any JVM memory library
  • Cassandra support includes TTL
  • Tight Spring Boot integration
  • VectorStoreChatMemoryAdvisor enables RAG-style message recall

Where it stops

  • Indexes raw messages, not extracted facts
  • No entity model or relationship graph
  • No conflict detection
  • Community examples describe building fact extraction yourself with a "recorder advisor" pattern
ChatMemory chatMemory = MessageWindowChatMemory.builder()
    .chatMemoryRepository(new JdbcChatMemoryRepository(jdbcTemplate))
    .maxMessages(20)
    .build();

ChatClient client = ChatClient.builder(chatModel)
    .defaultAdvisors(MessageChatMemoryAdvisor.builder(chatMemory).build())
    .build();

Vertex AI Memory Bank or keyword matching

Framework Active Java Apache 2.0 ★ 2,000

Google's Agent Development Kit shipped 1.0.0 for Java in 2025 with a BaseMemoryService interface. Two implementations: InMemoryMemoryService (keyword matching only, for development) and VertexAiMemoryBankService (fully managed, Vertex AI only). Memory Bank does real fact extraction but is Google Cloud-locked.

com.google.adk:google-adk:1.0.0

What it does well

  • Memory Bank is a real managed memory service with fact extraction
  • Session services with Firestore and Vertex backends
  • Native Gemini integration
  • LangChain4j integration for other model providers

Where it stops

  • Semantic memory requires Vertex AI (vendor lock-in)
  • OSS path (InMemoryMemoryService) is keyword matching over a HashMap
  • No self-hosted option for real memory
  • Pricing is per-API-call
Memory Bank is genuinely good, but you pay for it in cloud lock-in.

JetBrains fact store, now with native Java API

Framework Active Kotlin/Java Apache 2.0 ★ 1,500

JetBrains' JVM agent framework. As of Koog 0.7, memory splits into ChatMemory (conversation history), LongTermMemory (vector-based fact retrieval, organised by Concept/Subject/Scope), and Persistence (state checkpoints), with a separate History Compression feature for token budgeting. The nodeSaveToMemoryAutoDetectFacts node uses an LLM to extract facts automatically from chat history. Koog 0.7 also shipped a native Java API at JavaOne. Closest competitor to Mem0/Zep on the JVM.

What it does well

  • LongTermMemory with Concept/Subject/Scope model
  • LLM-based fact extraction out of the box (nodeSaveToMemoryAutoDetectFacts)
  • Native Java API as of Koog 0.7 (JavaOne 2026)
  • History Compression for token-budgeted prompts
  • Persistence providers for in-memory, file, and Postgres
  • Active JetBrains maintenance

Where it stops

  • No supersession layer for facts that contradict earlier ones
  • No cross-session consolidation (merging, deduplication, decay)
  • No temporal validity windows on facts
  • No published recall benchmarks (e.g. LongMemEval)
agent {
    memory {
        scope = MemoryScope.User("user_123")
    }
    nodeSaveToMemoryAutoDetectFacts {
        subjects = listOf(Subject.User, Subject.Product)
    }
}
AgentMemory (the earlier API tracked in JetBrains/koog#1001) is being deprecated in favour of the ChatMemory / LongTermMemory / Persistence split plus History Compression. Entry updated 2026-05-12 following correspondence with the Koog team at JetBrains.

Blackboard pattern, long-term memory is a non-goal

Framework Active Kotlin / Java Apache 2.0 ★ 3,000

Rod Johnson's (Spring creator) JVM agent framework. Uses Goal-Oriented Action Planning with a blackboard state container for domain objects passed between actions during an agent run. Per the maintainers, long-term conversational memory is explicitly out of scope.

com.embabel.agent:embabel-agent-starter

What it does well

  • Strong agent orchestration with goal-oriented planning
  • Clean blackboard pattern for domain objects within a run
  • Full Java interop from Kotlin core
  • Spring-integrated

Where it stops

  • Per-run blackboard, not persistent across sessions
  • Long-term memory is an explicit non-goal
  • Use Embabel for orchestration, bring memory separately
Per maintainers: "in Embabel it's not about conversational memory so much as domain objects that are stored in the blackboard during the flow."

Thin REST client, requires Python Mem0 server

Framework Community (unmaintained) Java MIT ★ 9

The top Google result for "Mem0 Java SDK" is me.pgthinker:mem0-client-java, a community REST wrapper. It is not an SDK in the meaningful sense — it requires running a Python Mem0 server alongside your JVM application, with its own Qdrant and graph database dependencies.

me.pgthinker:mem0-client-java:0.1.3

What it does well

  • Wraps a real memory engine (Mem0) via HTTP
  • Inherits Mem0 Python features through the sidecar

Where it stops

  • 9 GitHub stars, 13 total commits, last updated ~9 months ago
  • Not an official SDK — Mem0 ships Python and Node.js only
  • Requires running Python Mem0 server alongside your JVM application
  • Inherits Mem0 infrastructure dependencies (Qdrant + graph DB typically)
  • No SLAs, no roadmap, unmaintained
Not a serious production option for JVM teams. If you want Mem0, either pay for Mem0 Cloud or accept the Python sidecar.

Zep Java SDK

Does not exist

Does Not Exist Does not exist

Zep's official clients are Python, TypeScript, and Go. There is no Java SDK at any state of completeness. Java teams who want Zep's temporal knowledge graph must either consume Zep Cloud over HTTP or hand-roll a REST client.

Where it stops

  • No Java SDK exists
  • Python, TypeScript, and Go only
  • JVM teams must hand-roll HTTP clients
Graphiti (Zep's engine) scored 63.8% on LongMemEval-S in published results. Zep's earlier 84% LoCoMo claim was re-evaluated to 58.44% by independent testing (getzep/zep-papers#5). Neither number is reachable from Java without a sidecar.

DIY (pgvector + custom)

The most common Java AI memory stack in production today

DIY Active Java N/A

Most Java teams that need real memory assemble their own: PostgreSQL with pgvector (or Qdrant) for embeddings, JdbcChatMemoryRepository for raw messages, a custom advisor that calls an LLM to extract facts, and a cron job for decay. Roughly 1,500–3,000 lines of bespoke Java per team.

What it does well

  • Full control over every layer
  • Uses well-known components (Postgres, pgvector, Jackson)
  • No new vendor dependency
  • Can be shaped to exact requirements

Where it stops

  • 1,500–3,000 lines of custom code to maintain
  • Quietly diverges between teams and projects
  • Rarely gets temporal reasoning right
  • Almost never gets consolidation right
  • No common benchmark to validate against

Fact extraction, hybrid retrieval, explicit supersession, benchmarked

Memory Layer Active Python core, JVM via Spring Boot starter or MCP HTTP Apache 2.0 ★ 0

A durable memory system for AI agents from the JamJet team. Ships LLM-driven fact extraction, hybrid retrieval (vector + FTS keyword + temporal scoring, with optional cross-encoder rerank), explicit fact supersession (supersede(old_id, new_id) with recall filtering by default), per-tenant scope isolation (user_id + org_id), and mode-aware reading (recall vs synthesis). Benchmarked at 71% overall on LongMemEval-S (500q, gpt-4o-mini judge) with per-category numbers and ablation history published. JVM access via engram-spring-boot-starter on Maven Central with Spring AI ChatMemoryRepository auto-configuration, or via MCP server (memory_record, memory_recall, memory_context) reachable from any HTTP client. Zero infrastructure by default (SQLite + hnswlib); PostgreSQL optional.

dev.jamjet:engram-spring-boot-starter:0.2.0 (engram-spring-boot-starter); jamjet-engram 0.2.0 on PyPI

What it does well

  • Explicit fact supersession primitive (supersede) — newer facts override older ones, recall filters by default
  • Hybrid retrieval: vector (HNSW) + FTS keyword + temporal scoring + optional cross-encoder rerank
  • Mode-aware reading: Reader(mode=recall) (verifier-gated) vs Reader(mode=synthesis) (recommendation-grounded); routing preference questions to synthesis lifted single-session-preference from 29% to 71% on LongMemEval-S
  • Per-tenant Scope (user_id + org_id) partitioned at SQL and HNSW levels — no cross-tenant leakage by construction
  • Benchmarked at 71% overall on LongMemEval-S (500q, gpt-4o-mini judge) with per-category numbers and negative-result ablations published
  • JVM-native via engram-spring-boot-starter (auto-configures Spring AI ChatMemoryRepository)
  • Also exposes an MCP server reachable from any HTTP client via engram-server (ghcr.io/jamjet-labs/engram-py-server)
  • Apache 2.0, published on Maven Central + PyPI + crates.io + GHCR + Official MCP Registry

Where it stops

  • Brand-new project with no community traction yet (0 stars on jamjet-labs/engram at time of writing) — you will be an early adopter
  • True cross-session consolidation (merging, deduplication, decay) is on the roadmap; only supersession + scope isolation ship today
  • 25pp gap to the AgentMemory frontier (96.2%) on LongMemEval-S — published as a public roadmap item, not hidden
  • Synthesis-mode reader is calibrated against gpt-4o-mini; Sonnet/Haiku currently regress on tool-protocol parsing
// JVM path: engram-spring-boot-starter wires Spring AI ChatMemoryRepository
@Autowired ChatMemoryRepository memory;

memory.saveAll("alice", List.of(
    new UserMessage("I'm allergic to peanuts."),
    new AssistantMessage("Got it.")
));

List<Message> recent = memory.findByConversationId("alice");

// Or run the MCP server and call it from any agent:
//   docker run -p 7080:7080 ghcr.io/jamjet-labs/engram-py-server:latest
This site is maintained by the JamJet team. Engram is their project. We have tried to present it with the same honesty we apply to every other library here, including the gaps. Pull requests correcting any inaccuracy are welcome. Entry refreshed 2026-05-12 to reflect engram-spring-boot-starter 0.2.0 (Maven Central), jamjet-engram 0.2.0 (PyPI), and the published LongMemEval-S 71% benchmark.

FAQ

Does Mem0 have an official Java SDK?

No. Mem0's first-party SDKs are Python and Node.js. The top Google result for "Mem0 Java SDK" is a 9-star community REST wrapper that requires running a Python Mem0 server alongside your JVM application. It is not a serious production option for most JVM teams.

Does Zep have a Java SDK?

No. Zep's official clients are Python, TypeScript, and Go. There is no Java SDK at any state of completeness. Java teams who want Zep's temporal knowledge graph must either consume Zep Cloud over HTTP or hand-roll a REST client.

Which library should I use if I'm already on Spring Boot?

For chat history persistence, Spring AI ChatMemory with JDBC or Cassandra backends is the obvious choice — it's tightly integrated, well-documented, and has broad database support.

For real knowledge memory (facts, conflict detection, temporal reasoning), Engram now ships a Spring Boot starter with auto-configuration, properties binding, and an optional Actuator health indicator:

<dependency>
  <groupId>dev.jamjet</groupId>
  <artifactId>engram-spring-boot-starter</artifactId>
  <version>0.2.0</version>
</dependency>

Configure via engram.base-url in application.yml. The starter auto-configures both EngramContextAdvisor (knowledge injection) and ChatMemoryRepository (message persistence) for Spring AI.

Which library should I use if I want zero infrastructure?

Engram runs against SQLite by default with no external infrastructure, and also supports PostgreSQL for teams that need a shared database. That said, Engram is a new project (v0.5.0) with a small community. If you need production maturity today, accept the infrastructure cost of building something on Spring AI + pgvector, or pay for a managed service.

What about LangGraph4j and Koog persistence?

LangGraph4j and Koog's PersistenceStorageProvider solve a different problem — they checkpoint agent execution state for resume and replay. This is useful but it's not knowledge memory. You can pair a state checkpointer with a memory layer; they don't compete.

How is this page maintained?

The site is maintained by the JamJet team (authors of Engram). We have tried to present every library with equal honesty — including the gaps in Engram itself. If you find an inaccuracy, please open a PR or an issue on the source repository. We will treat corrections from competitors' maintainers as a priority.

Methodology & bias

This site was built because several of us hit the same wall looking for a Java equivalent of Mem0 or Zep and kept ending up on GitHub issues asking the same question. We wrote down what we found and turned it into a comparison.

Who maintains it: The JamJet team (jamjet.dev). Engram, the last library on the list, is our project. We are not a neutral third party. What we are is honest about it — this page exists, Engram gets the same feature matrix treatment as every other library, and we disclose gaps in Engram (no published benchmarks yet, small community) with the same candor we apply to Koog, Mem0, and the rest.

How features are scored:

Corrections welcome: If you maintain one of these libraries and disagree with a rating, or if we've missed a library that belongs on this list, open an issue or a PR on github.com/jamjet-labs/java-ai-memory. We will update the site on accepted changes, not just our own releases.