GoodMemGoodMem
IntegrationsAgent Frameworks

LangChain4j

Expose GoodMem memory operations as LangChain4j tools that any Java agent can call.

Stable· Java (Maven/Gradle)

Overview

GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and LLM-powered answering server-side. The LangChain4j integration exposes those operations — managing spaces, storing memories, and semantic retrieval with optional reranking and LLM summaries — as LangChain4j @Tools that any LangChain4j agent can call.

Installation

Add the dependency to your pom.xml:

<dependency>
    <groupId>io.github.bashareid</groupId>
    <artifactId>goodmem-langchain4j</artifactId>
    <version>0.1.0</version>
</dependency>

Requires Java 17+ and dev.langchain4j:langchain4j-core 1.14.0 or newer.

The runtime package namespace is ai.pairsys.goodmem.langchain4j, but the artifact is currently published under a maintainer's personal Maven groupId, io.github.bashareid, rather than an official PAIR Systems coordinate. These coordinates may change, so pin the version and check the Maven Central listing before upgrading.

Configuration

GoodMemTools.builder() accepts:

OptionDescription
baseUrlURL of the GoodMem server (e.g. https://your-goodmem-server.example.com).
apiKeyAPI key for authentication.
verifySslDisable to accept self-signed certificates in development.

Quick start

import ai.pairsys.goodmem.langchain4j.GoodMemTools;
import dev.langchain4j.service.AiServices;

GoodMemTools goodMemTools = GoodMemTools.builder()
        .baseUrl("https://your-goodmem-server.example.com")
        .apiKey("your-api-key")
        .build();

interface Assistant {
    String chat(String message);
}

Assistant assistant = AiServices.builder(Assistant.class)
        .chatLanguageModel(model)
        .tools(goodMemTools)
        .build();

Local development. The example above uses a TLS-verified production URL. If you are running GoodMem locally with a self-signed certificate, use https://localhost:8080 and disable TLS verification with the client's verify-SSL option (see the Configuration table above). Keep TLS verification enabled for any deployed server.

Retrieval post-processing

GoodMem's retrieval call accepts these optional post-processing parameters (each framework exposes them under its own naming convention):

ParameterRangeDescription
reranker_idUUIDReranker model that reorders matched chunks by relevance.
llm_idUUIDLLM that generates a contextual answer (abstractReply) alongside the chunks.
relevance_threshold0–1Minimum relevance score for a result to be included.
llm_temperature0–2Sampling temperature for the LLM post-processor.
max_resultsintegerMaximum number of results to return.
chronological_resortbooleanRe-sort the final results by creation time instead of relevance.

Learn more

The full README, examples, and API reference live in the upstream repository: PAIR-Systems-Inc/goodmem-langchain4j.