Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

langgraph-goodmem

Give LangGraph agents searchable, persistent memory with GoodMem. GoodMem handles document storage, chunking, embedding, search, and optional reranking. Use it from a graph node or give an agent a search tool with access to the spaces you choose.

This package shares its tools, retriever, and ingestion functions with langchain-goodmem, so fixes reach both integrations.

Install

pip install langgraph-goodmem

Requires Python 3.10+. Configure an existing GoodMem server and space:

export GOODMEM_BASE_URL="https://your-goodmem-server.example.com"
export GOODMEM_API_KEY="your-api-key"
export GOODMEM_SPACE_ID="your-space-uuid"

Search from a graph

This complete example searches your space without an LLM. The retrieval node adds Document objects, including source metadata, to the graph's state.

import os
from typing import TypedDict

from langchain_core.documents import Document
from langchain_core.runnables import RunnableConfig
from langgraph.graph import END, START, StateGraph
from langgraph_goodmem import GoodMemRetriever

class State(TypedDict):
    question: str
    documents: list[Document]

retriever = GoodMemRetriever(space_ids=[os.environ["GOODMEM_SPACE_ID"]], k=5)

def search(state: State, config: RunnableConfig):
    return {"documents": retriever.invoke(state["question"], config=config)}

builder = StateGraph(State)
builder.add_node("search", search)
builder.add_edge(START, "search")
builder.add_edge("search", END)
graph = builder.compile()
result = graph.invoke({"question": "What is the refund policy?", "documents": []})
for document in result["documents"]:
    print(document.metadata["source"], document.page_content, sep="\n")

Use an agent

The agent example gives create_agent a scoped search tool, also usable in ToolNode. Give searches distinct names and descriptions; your code controls their spaces, filters, and rerankers.

Install langgraph-goodmem[agents] plus your chosen model provider's LangChain package, configure its credentials, and set GOODMEM_CHAT_MODEL=provider:model.

Add documents

import os

from goodmem import Goodmem
from langchain_core.documents import Document
from langgraph_goodmem import add_documents

with Goodmem(base_url=os.environ["GOODMEM_BASE_URL"],
             api_key=os.environ["GOODMEM_API_KEY"]) as client:
    memory_ids = add_documents(client, os.environ["GOODMEM_SPACE_ID"], [
        Document(page_content="Refunds are available within 30 days.",
                 metadata={"source": "https://example.com/refunds"})
    ])

Ingestion waits for the memories it created. Empty searches return immediately. GoodMemIngestionError.created_memory_ids identifies accepted writes if indexing fails, so you can check them with wait_for_memory instead of uploading again.

More options

  • Set filter="CAST(val('$.department') AS TEXT) = 'support'" on the retriever for metadata filtering.
  • Set reranker_id and optionally fetch_k to rerank without an LLM.
  • Use retriever.invoke, ainvoke, batch, or abatch for Document results. Async calls currently run the shared synchronous SDK in a thread executor.
  • Pass client=Goodmem(...) to share a connection. For local self-signed TLS, use Goodmem(..., verify=False); keep verification enabled in production.
  • Administrative tools remain available for trusted workflows. GoodMemRetrieveMemories returns raw SDK events, including failure statuses. When the server reports a problem, GoodMemRetriever still returns the Documents it received, each with goodmem_partial and goodmem_statuses metadata; with no Documents it returns an empty list and emits a warning. It does not raise.
  • Tools refuse any ID that is not a UUID before sending a request, so a model-supplied ID cannot reach a different endpoint.

This package provides retrieval and ingestion; it does not implement LangGraph's BaseStore or a checkpointer for graph execution state. See the 0.2 migration notes for API changes.

Metadata

Release files for langgraph-goodmem 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-goodmem 0.2.1
File Size Uploaded
langgraph_goodmem-0.2.1.tar.gz 144.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-goodmem 0.2.1
File Interpreter ABI Platform
langgraph_goodmem-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 149.9 kB

Release files / langgraph_goodmem-0.2.1.tar.gz

Download URL langgraph_goodmem-0.2.1.tar.gz
Size 144.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bd10bcec3968618db15072afb50719139823d8cada8bc888d7c4814ed1e3b887
BLAKE2b-256 checksum
How to use checksums
0afa062f8549812a6dced0241db5f0059cc719a2d493dd69994e1f46c5f02d40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / langgraph_goodmem-0.2.1-py3-none-any.whl

Download URL langgraph_goodmem-0.2.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3697f3798a2b6e7496308232f41ae5984dacdb2b76ef6d53a521892cbf93462
BLAKE2b-256 checksum
How to use checksums
85791a8945c98c224a59240f440fd7e710dddc974d19014f2964132d28cfd302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page