If your agent keeps forgetting users, losing thread state, or replaying the same context on every call, this is the fix. RetainDB adds persistent memory and resumable workflow state without a custom storage layer.
import { RetainDBClient } from "@retaindb/sdk";
import { createLangChainMemoryAdapter } from "@retaindb/sdk/langchain";
import { createLangGraphCheckpointAdapter } from "@retaindb/sdk/langgraph";
const client = RetainDBClient.fromEnv();The point is simple: the agent remembers, resumes work, and behaves more consistently.
Keep preferences and prior answers across sessions.
Restore graph state so long-running flows continue cleanly.
Skip the custom memory store and checkpoint plumbing.
Use RetainDB as memory for chat flows, agents, and custom memory classes.
Keep conversational memory and workflow state separate. It is simpler, cleaner, and easier to debug.
Initialize one client and reuse it across the runtime.
Use the LangChain adapter when the app needs recall.
Use the LangGraph adapter when the workflow must resume.
Reuse stable IDs so state resolves predictably.
import { RetainDBClient } from "@retaindb/sdk";
import { createLangChainMemoryAdapter } from "@retaindb/sdk/langchain";
import { createLangGraphCheckpointAdapter } from "@retaindb/sdk/langgraph";
const client = RetainDBClient.fromEnv();
const memory = createLangChainMemoryAdapter(client, {
user_id: "user-123",
session_id: "chat-456",
returnMessages: true,
});
const checkpointer = createLangGraphCheckpointAdapter(client, {
user_id: "user-123",
session_id: "chat-456",
});
// Use memory in LangChain flows.
// Use checkpointer in LangGraph flows.