Skip to main content

mentedb-langchain

MenteDB helpers for LangChain and LangGraph: a conversation memory, a retriever, and a chat history, each backed by a local MenteDB database.

Installation

pip install mentedb-langchain

Status

MenteDBMemory, MenteDBRetriever and MenteDBChatHistory follow the method names of LangChain's memory, retriever and chat history interfaces, but they do not subclass LangChain's base classes. LangChain rejects them when they are passed directly to chains such as ConversationChain(memory=...) or RetrievalQA.from_chain_type(retriever=...) (checked with LangChain 0.3). Call their methods from your own code or graph nodes, as shown below.

Only one MenteDB instance can open a data directory at a time. Give each component its own data_dir, or share one object. agent_id, when set, must be a UUID string.

Components

MenteDBMemory

Stores each turn as an episodic memory and loads the most similar stored memories (top 10 by similarity search) for the next input.

from mentedb_langchain import MenteDBMemory

memory = MenteDBMemory(data_dir="./agent-memory")

memory.save_context(
    inputs={"input": "What database should I use for time series data?"},
    outputs={"output": "TimescaleDB is a good fit."},
)
context = memory.load_memory_variables({"input": "Tell me more about that database"})
# -> {"history": "User: ...\nAssistant: ..."}

MenteDBRetriever

Similarity search with an optional tag filter (all listed tags must match). Results are dicts shaped like LangChain documents.

from mentedb_langchain import MenteDBRetriever

retriever = MenteDBRetriever(data_dir="./docs-memory", k=10, tags=["backend"])
docs = retriever.get_relevant_documents("database migration decisions")
# -> [{"page_content": ..., "metadata": {"id", "score", "memory_type", "tags"}}]

MenteDBChatHistory

Stores every message in MenteDB as an episodic memory tagged with the session id. messages returns the messages added through this object as {"role", "content"} dicts; it does not reload earlier sessions from disk.

from mentedb_langchain import MenteDBChatHistory

history = MenteDBChatHistory(session_id="session-123", data_dir="./chat-memory")

history.add_user_message("What database should I use?")
history.add_ai_message("I recommend PostgreSQL for your use case.")

messages = history.messages

Usage with LangGraph

Use MenteDBMemory as a context source inside graph nodes:

from mentedb_langchain import MenteDBMemory

memory = MenteDBMemory(data_dir="./graph-memory")

def plan_node(state):
    context = memory.load_memory_variables({"input": state["task"]})
    return {**state, "context": context}

def reflect_node(state):
    memory.save_context(
        inputs={"input": state["task"]},
        outputs={"output": state["result"]},
    )
    return state

Configuration

Parameter Default Description
data_dir ./mentedb-data Path to the MenteDB data directory
agent_id None Optional agent UUID stored as the memory owner (not used to filter searches)
token_budget 4096 Accepted by MenteDBMemory but currently not applied
k 10 Number of results to return (MenteDBRetriever)
tags None Tag filter for retrieval (MenteDBRetriever)

License

Apache 2.0

Metadata

Release files for mentedb-langchain 0.40.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 mentedb-langchain 0.40.0
File Size Uploaded
mentedb_langchain-0.40.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mentedb-langchain 0.40.0
File Interpreter ABI Platform
mentedb_langchain-0.40.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / mentedb_langchain-0.40.0.tar.gz

Download URL mentedb_langchain-0.40.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
442b7178a464c9e2eed8f2810df6ebc20a58362222edc24a4c9bc075324028c6
BLAKE2b-256 checksum
How to use checksums
06830256f1004ed8ff420629b4f0880d4f0c1d7f79dd1bb55558d4469ee75627
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 Oct 19, 2026.

Transparency log

Release files / mentedb_langchain-0.40.0-py3-none-any.whl

Download URL mentedb_langchain-0.40.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae4967dd4a30bd5576b0b9b71ff38ac10e2fb907d72b220d1af7dc8fb149882d
BLAKE2b-256 checksum
How to use checksums
57e95f36ca63d8d828afb4e8e78d0fbb65f6dbac826e7f6b0017e7f3ca74f251
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 Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

0.41.1

2 release files

0.41.0

2 release files

This release

0.40.0 This release

2 release files

0.39.2

2 release files

0.39.1

2 release files

0.39.0

2 release files

0.38.0

2 release files

0.32.2

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.0

2 release files

0.27.3

2 release files

0.27.2

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.6

2 release files

0.24.5

2 release files

0.24.4

2 release files

0.24.3

2 release files

0.21.1

2 release files

0.21.0

2 release files

0.20.4

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.9

2 release files

0.17.8

2 release files

0.17.7

2 release files

0.17.6

2 release files

0.17.5

2 release files

0.17.4

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.7

2 release files

0.14.6

2 release files

0.14.5

2 release files

0.14.4

2 release files

0.14.3

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.6

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.7

2 release files

0.11.6

2 release files

0.11.5

2 release files

0.11.4

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.1.1

2 release files

0.1.0

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