For LangChain and LangGraph teams

Stop rebuilding context
in every agent run.
Give your agents memory and continuity.

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.

What this fixes
Your LangChain chat app forgets the user between sessions
Your LangGraph workflow loses thread state after each run
You keep replaying old context in prompts to fake memory
You want stateful agents without building storage yourself
Core SDK surface
import { RetainDBClient } from "@retaindb/sdk";
import { createLangChainMemoryAdapter } from "@retaindb/sdk/langchain";
import { createLangGraphCheckpointAdapter } from "@retaindb/sdk/langgraph";

const client = RetainDBClient.fromEnv();

What you get when this is wired in properly

The point is simple: the agent remembers, resumes work, and behaves more consistently.

Agents remember what users already said

Keep preferences and prior answers across sessions.

Workflows resume from the right step

Restore graph state so long-running flows continue cleanly.

You stop hand-rolling state plumbing

Skip the custom memory store and checkpoint plumbing.

LangChain

Memory adapter

Use RetainDB as memory for chat flows, agents, and custom memory classes.

Persistent conversation memory
User and session scoping
Return messages in LangChain format
Works with chains and agents
LangGraph

Checkpoint adapter

Store thread state and resume workflows with RetainDB-backed checkpoints.

Thread-aware checkpoint persistence
State restore across invocations
Session-aware configuration
Works with prebuilt and custom graphs

How teams usually implement this

Keep conversational memory and workflow state separate. It is simpler, cleaner, and easier to debug.

01
Create one client once

Initialize one client and reuse it across the runtime.

02
Attach memory where prompts are built

Use the LangChain adapter when the app needs recall.

03
Attach checkpoints where graph state matters

Use the LangGraph adapter when the workflow must resume.

04
Keep IDs deterministic

Reuse stable IDs so state resolves predictably.

The actual implementation shape
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.

Supported patterns

ConversationChain and chat flows
LCEL and runnable pipelines
AgentExecutor-style agents
LangGraph prebuilt agents
Custom StateGraph workflows
Memory plus checkpoint setups
Start with what already exists

RetainDB is the plumbing. The outcome is better agents.

Use the LangChain adapter when the agent needs memory. Use the LangGraph adapter when the workflow needs resume support. Combine them when you need both.