Framework Adapters: LangChain & Vercel AI SDK
Thin adapters that make RememberOS a drop-in for the popular agent frameworks. Both wrap the existing RememberOS SDKs; the framework itself stays an optional dependency you bring.
LangChain (Python)#
Source in sdk/langchain/ (longmem-langchain). A
BaseRetriever over the RememberOS Python SDK, plus a remember helper.
pip install -e sdk/python && pip install -e "sdk/langchain[langchain]"
from longmem import Longmem
from longmem_langchain import make_retriever, save_memory
client = Longmem(api_key="mv_...")
retriever = make_retriever(client, collection="docs", k=5)
docs = retriever.invoke("what did we decide about pricing?") # -> List[Document]
save_memory(client, "We settled on usage-based pricing.", collection="decisions")
Each hit becomes a Document (text as page_content; id, score,
category, collection, and the memory's metadata under memory_metadata).
langchain-core is an optional extra — the mapping core is dependency-free.
Vercel AI SDK (TypeScript)#
Source in sdk/vercel-ai/ (@longmem/vercel-ai). The client-side
counterpart to the memory proxy: inject memories
before a completion, remember the turn after.
npm i longmem @longmem/vercel-ai
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { Longmem } from "longmem";
import { withMemory, rememberTurn } from "@longmem/vercel-ai";
const lm = new Longmem({ apiKey: process.env.LONGMEM_API_KEY! });
let messages = [{ role: "user", content: "what theme does Alex prefer?" }];
messages = await withMemory(lm, messages, { collection: "prefs" }); // prepends a system msg
const { text } = await generateText({ model: openai("gpt-4o-mini"), messages });
await rememberTurn(lm, messages, { collection: "chat" }); // grows memory
Depends only on the RememberOS JS SDK — ai is your peer. Both adapters are
MIT and install-from-source.