GoodMemGoodMem
IntegrationsAgent Frameworks

LangChain

Expose GoodMem memory operations as LangChain tools that wire into any agent or chain.

Stable· Python (3.10+)

Overview

GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and LLM-powered answering server-side. The LangChain integration exposes those operations — creating spaces, storing memories, and semantic retrieval with optional reranking and LLM summaries — as LangChain BaseTools you can drop into any agent or chain.

Installation

pip install langchain-goodmem

The pip package is langchain-goodmem; the import name is langchain_goodmem.

Configuration

VariableDescription
GOODMEM_BASE_URLBase URL of your GoodMem server (no /v1 suffix), e.g. https://your-goodmem-server.example.com.
GOODMEM_API_KEYAPI key used to authenticate requests.
GOODMEM_VERIFY_SSLSet to false to skip TLS verification for self-signed dev certs (default: true).

Each tool also accepts goodmem_base_url and goodmem_api_key constructor arguments if you prefer to configure them in code instead of the environment.

Quick start

from langchain_goodmem import (
    GoodMemCreateSpace,
    GoodMemCreateMemory,
    GoodMemRetrieveMemories,
)
from langchain.chat_models import init_chat_model
from langchain.agents import create_agent

goodmem_kwargs = {
    "goodmem_base_url": "https://your-goodmem-server.example.com",
    "goodmem_api_key": "your-api-key",
}

tools = [
    GoodMemCreateSpace(**goodmem_kwargs),
    GoodMemCreateMemory(**goodmem_kwargs),
    GoodMemRetrieveMemories(**goodmem_kwargs),
]

agent = create_agent(init_chat_model("openai:gpt-4o"), tools)
response = agent.invoke(
    {"messages": [{"role": "user", "content": "Save this fact and recall it later."}]}
)

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 are available on the PyPI package page.