5.2 Python: LangChain + MentisDB
Use MentisDB beside LangChain as durable long-term memory. Keep short conversational buffer memory in LangChain; store durable decisions, facts, and lessons in MentisDB.
from pymentisdb import MentisDbClient
memory = MentisDbClient("http://127.0.0.1:9472", chain_key="my-agent")
memory.append(
agent_id="langchain-agent",
thought_type="Decision",
content="Use the billing API v2 endpoint for invoice export.",
concepts=["billing", "invoice-export"],
tags=["langchain", "production"],
)
hits = memory.ranked_search("which billing endpoint exports invoices?", limit=5)Retrieve from MentisDB before calling the model, then include only the top relevant memories in the prompt.