Skip to main content

LangChain integration for GoodMem: long-term agent memory with semantic storage and retrieval.

Project description

langchain-goodmem

PyPI License: MIT

LangChain integration for GoodMem — long-term agent memory with semantic storage and retrieval.

GoodMem is a memory layer for AI agents that handles embedding, vector search, reranking, and LLM-powered answering server-side. This package exposes GoodMem operations as LangChain BaseTools that can be wired into any LangChain agent or chain.

Installation

pip install langchain-goodmem

Requires Python 3.10+.

Tools

Tool Description
GoodMemListEmbedders List available embedder models
GoodMemListSpaces List all spaces in your account
GoodMemGetSpace Fetch a single space by ID
GoodMemCreateSpace Create a new space or reuse an existing one
GoodMemUpdateSpace Update name / public-read / labels on a space
GoodMemDeleteSpace Delete a space (cascades to its memories)
GoodMemCreateMemory Store text or files as memories
GoodMemListMemories Paginate memories within a space
GoodMemRetrieveMemories Semantic search with optional reranker / LLM summary
GoodMemGetMemory Fetch a specific memory by ID
GoodMemDeleteMemory Permanently delete a memory

Quick start

from langchain_goodmem import (
    GoodMemCreateSpace,
    GoodMemCreateMemory,
    GoodMemRetrieveMemories,
)

goodmem_kwargs = {
    "goodmem_base_url": "http://localhost:8080",
    "goodmem_api_key": "your-api-key",
}

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

Use with a LangChain agent

from langchain.chat_models import init_chat_model
from langchain.agents import create_agent

llm = init_chat_model("openai:gpt-4o")
agent = create_agent(llm, tools)

response = agent.invoke({"messages": [{"role": "user", "content": "Save this fact and recall it later."}]})

Retrieve with reranking and LLM summary

GoodMemRetrieveMemories exposes the full server-side post-processor. Set any of these fields to enable reranking, threshold filtering, chronological re-sort, or an LLM-generated abstractReply summary:

result = retrieve.invoke({
    "query": "Which framework develops applications with language models?",
    "space_ids": "space-uuid-1,space-uuid-2",
    "max_results": 5,
    "reranker_id": "reranker-uuid",
    "llm_id": "llm-uuid",
    "llm_temperature": 0.2,
    "relevance_threshold": 0.1,
    "chronological_resort": False,
})

Leave them all unset for plain semantic search.

Environment variables

Variable Description
GOODMEM_BASE_URL Base URL of the GoodMem API server
GOODMEM_API_KEY API key for authentication
GOODMEM_VERIFY_SSL Set to false to skip TLS verification for self-signed dev certs (default: true)

Examples

A live end-to-end smoke test exercising every tool and every post-processor knob is in examples/live_smoke_test.py.

export GOODMEM_BASE_URL=https://localhost:8080
export GOODMEM_API_KEY=...
export GOODMEM_VERIFY_SSL=false
python examples/live_smoke_test.py

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_goodmem-0.1.0.tar.gz (106.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_goodmem-0.1.0-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_goodmem-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_goodmem-0.1.0.tar.gz
  • Upload date:
  • Size: 106.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_goodmem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f5731322cf31ea7cbf6b7fa7bbcecc5a5d3517eb0f0d1e4ecf0d28ee3d1b672
MD5 941119f47bb8e5a5e103e76e255bc04b
BLAKE2b-256 aeee52eb3060d6a97763ffb4070fa6be863ab9b9456ed3ccd66d8cc7e79518dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_goodmem-0.1.0.tar.gz:

Publisher: release.yml on PAIR-Systems-Inc/goodmem-langchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_goodmem-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_goodmem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 214492a4702e126f7814284a6b5aec4e35ef8dbbc3be4323d14f879ddabb5d8b
MD5 f84a2846fe77e1aa9a9d849891a04dd6
BLAKE2b-256 bfa494236d2f38a4db4320de50adb8c45751c04ea85f867c6a408177f6d171d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_goodmem-0.1.0-py3-none-any.whl:

Publisher: release.yml on PAIR-Systems-Inc/goodmem-langchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page