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; the scoped retriever reports known failures as errors.

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.0

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.0
File Size Uploaded
langgraph_goodmem-0.2.0.tar.gz 143.7 kB Details

Built distribution (wheel)

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

Total release size: 148.8 kB

Release files / langgraph_goodmem-0.2.0.tar.gz

Download URL langgraph_goodmem-0.2.0.tar.gz
Size 143.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9bce997a5dbc94790d2477ce090a732b8c43a95733ff41dacd4c433fda366b6a
BLAKE2b-256 checksum
How to use checksums
d0410be1e98b060406347ed3083fa8a65e8fec7e74b3fb2d087923d596648bca
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 15, 2026.

Transparency log

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

Download URL langgraph_goodmem-0.2.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b418ddfc58085bff85a2ecae15921a4ff89f1542871d025804dc53392a0e012
BLAKE2b-256 checksum
How to use checksums
f9bc7943a3b8228a6a2be16c4b99bfbbbfe40dedb045fd585887e185e5c799ee
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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 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