LangChain
Add Suprflo long-term memory to LangChain chains and agents. Ships in the Python SDK.
Install
bash
pip install "suprflo[langchain]"What you get
All three are built on the Python SDK MemoryClient:
SuprfloMemory— a conversation memory that saves each turn to Suprflo and loads the relevant memories back into the prompt. Implements the classic LangChain memory interface (memory_variables,load_memory_variables,save_context,clear), compatible acrosslangchain-core0.2 → 1.x.SuprfloRetriever— aBaseRetrieverthat returns memories as documents for RAG / retrieval chains.create_memory_tools(client, user_id)— LangChainTools (save_memory,search_memory) to drop into an agent.
Memory in a chain
python
from suprflo import MemoryClient
from suprflo.integrations.langchain import SuprfloMemory
client = MemoryClient(api_key="YOUR_API_KEY")
memory = SuprfloMemory(client=client, user_id="alice")
# use `memory` wherever a LangChain memory is accepted; it recalls Alice's
# stored facts on load and persists new turns on save.Retriever for RAG
python
from suprflo.integrations.langchain import SuprfloRetriever
retriever = SuprfloRetriever(client=client, user_id="alice", top_k=5)
docs = retriever.invoke("dietary restrictions")Tools for an agent
python
from suprflo.integrations.langchain import create_memory_tools
tools = create_memory_tools(client, user_id="alice") # [save_memory, search_memory]
# add `tools` to your LangChain agent's toolsetIf
langchain-coreisn't installed, importing this module raises a clearImportErrortelling you topip install "suprflo[langchain]".