Browse docs

Getting Started

Tap to expand
StartUpdated 2026-05-25

Introduction

RetainDB is hosted memory infrastructure for AI apps and agentic systems.

RetainDB gives AI products a memory layer they can trust in production.

Use it when your app or agents need to remember users, sessions, decisions, tool results, project context, and handoffs without building a storage, search, auth, and routing stack yourself.

Choose your path

If you are buildingStart hereThen read
Chatbots, copilots, assistants5 minute quickstartUser and session memory
Multi-agent workflowsAgent Memory BusMulti-agent handoff tutorial
Existing OpenAI-compatible chat stackMemory Router v1OpenAI-compatible integration
MCP or coding agentsMCP setupAgent host setup
Non-TypeScript runtimeRaw HTTP quickstartAPI reference

What RetainDB is for

NeedRetainDB surface
Remember user preferences and factsUser and session memory
Retrieve context before calling a modelSDK context helpers or Memory Router
Share memory across multiple agentsAgent Memory Bus
Hand work from one agent to anotherAgent handoffs
Connect coding or MCP agentsRetainDB MCP tools
Use raw HTTP from any runtimeREST API at https://api.retaindb.com

First path: user memory chat

Most teams should start with a user memory loop:

  1. Store a user fact or preference.
  2. Retrieve relevant context for the next message.
  3. Add that context to your OpenAI-compatible chat call.
  4. Store useful new information after the turn.

That path is simple, production-shaped, and maps to nearly every AI app.

ts
import { RetainDB } from "@retaindb/sdk";

const db = new RetainDB({ apiKey: process.env.RETAINDB_API_KEY });
const user = db.user("user_123");

await user.remember("User prefers concise technical answers.");

const { context } = await user.getContext("How should I answer this user?");

Continue with 5 minute quickstart.

Agent path: shared memory across agents

When your product has planners, builders, reviewers, support agents, or coding agents, use Agent Memory Bus.

ts
const task = db.agent("planner").task("checkout-redesign");

await task.event({
  type: "decision",
  summary: "Use Stripe Checkout for the first release."
});

const handoff = await task.handoff({
  toAgentId: "builder",
  summary: "Builder should implement the Stripe Checkout path."
});

Continue with Agent Memory Bus.

Product surfaces

  • SDK v5: the recommended TypeScript interface for app and agent builders.
  • REST API: stable HTTP endpoints for non-TypeScript stacks.
  • Memory Router v1: OpenAI-compatible chat memory injection with fallback.
  • MCP tools: agent-native memory and handoff tools.
  • Dashboard: keys, usage, projects, and team operations.

What good integration feels like

After RetainDB is wired correctly:

  • users stop repeating stable preferences and facts
  • agents can resume work without rediscovering previous decisions
  • prompts include a small memory context instead of a pasted transcript
  • each memory result is scoped to the right user, session, project, or task
  • failures include a trace_id your team can debug

Next steps

Was this page helpful?

Your feedback helps us prioritize docs improvements weekly.