Skip to main content

langchain-memorae

Connect an existing LangChain, LangGraph, or local chatbot to MeMorae's project-key API. MeMorae handles ingestion, approval, and retrieval; this package only calls the existing endpoints. The MeMorae backend must already be running.

MCP exposes MeMorae tools to MCP clients. This package provides Python memory and retriever objects for application code using LangChain or LangGraph.

Install

From the repository root:

pip install -e integrations/langchain-memorae

When published, install with pip install langchain-memorae.

Basic usage

from langchain_memorae import MeMoraeMemory, MeMoraeRetriever

memory = MeMoraeMemory(api_key="MEMORAE_PROJECT_API_KEY",
                       base_url="http://localhost:8000",
                       subject_id="user_123", namespace="default")
context = memory.load_memory_variables({"input": "What food do I like?"})
memory.save_context({"input": "I love pizza"}, {"output": "Got it."})

retriever = MeMoraeRetriever(api_key="MEMORAE_PROJECT_API_KEY",
                             base_url="http://localhost:8000",
                             subject_id="user_123", namespace="default")
docs = retriever.invoke("What sports do I enjoy?")

context["history"] is a compact string of retrieved memories. docs contains LangChain Document objects with memory_id and source_ids metadata. Ingestion is asynchronous on the server; a new message may take time to appear in search. Assistant output is saved only with save_assistant=True.

subject_id identifies the end user whose memories are recalled. namespace separates memory spaces for that user; use the same values for saving and searching. A project API key determines the project scope. Keep it on your server, load it from an environment variable, and never put it in browser code or logs.

LangGraph

In a graph, call memory.load_memory_variables({"input": question}) in a recall node before the answer node. Call memory.save_context({"input": question}, {"output": answer}) in a save node afterward. See langgraph_chatbot.py for a complete small graph.

Local chatbot

Wrap your existing answer function: load history, pass it to the function as context, then save the question and answer. See local_chatbot_flask.py for a Flask route and basic_chatbot.py for ChatOpenAI. Examples read MEMORAE_API_KEY, MEMORAE_BASE_URL, and MEMORAE_SUBJECT_ID from the environment. The ChatOpenAI examples also need OPENAI_API_KEY and their optional dependencies.

clear() is a no-op because clearing remote memories is a separate MeMorae review action.

Metadata

Release files for langchain-memorae 0.1.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 langchain-memorae 0.1.0
File Size Uploaded Provenance Actions
langchain_memorae-0.1.0.tar.gz 5.9 kB Without provenance Details for langchain_memorae-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-memorae 0.1.0
File Interpreter ABI Platform Actions
langchain_memorae-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_memorae-0.1.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / langchain_memorae-0.1.0.tar.gz

Download URL langchain_memorae-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ad8307ed305fbde5a7a036364b2cba8fa9c5a0cea3abcfc6a6a23225a69a578b
BLAKE2b-256 checksum
How to use checksums
80d8534886953d95b2416fa88f242d47084bb07834fe3157e1f4256deaeed0e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / langchain_memorae-0.1.0-py3-none-any.whl

Download URL langchain_memorae-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15a8aca8f7dd59fa269788f66a673605ca8e52e3eaed596d0a183f9966c5e9c2
BLAKE2b-256 checksum
How to use checksums
9846edfff7bc6691749278ec2812a31f8e70b138d540fef9c91e9a1ce9a2f774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for langchain-memorae 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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