BetterDB is an open-source SDK for building a context layer on Valkey or Redis that gives AI agents long-term memory, semantic caching, and retrieval. It runs on any Valkey or Redis instance you operate, with observability at every layer and no vendor lock-in.
What is BetterDB?
BetterDB is an SDK and managed service that provides agent memory, semantic caching, agent caching, retrieval, monitoring, and data migration for AI applications. It takes prompts, chat histories, and tool results as input and produces ranked memory, cached responses, and typed retrieval results as output. The platform runs natively on any Valkey or Redis deployment and is developed by BetterDB Inc. (an open-core company).
Key Features
- Agent Memory — Long-term memory that persists across sessions, scoped and ranked by relevance, with hybrid rerank achieving ~93% recall at scale on LongMemEval-M.
- Semantic Cache — Catch paraphrased prompts and return cached answers from Valkey in under a millisecond (0.7ms p50 latency), roughly 100× faster than a hosted cache.
- Agent Cache — Exact-match caching for LLM calls, tool results, and session state across frameworks like OpenAI Agents SDK, LangChain, and LangGraph.
- Retrieval — Typed retrieval over your own data with full observability at every layer.
- Monitor — Real-time visibility into Valkey or Redis performance with history that outlives log rotation.
- Migration — Move data between Redis, Valkey, cloud, and self-hosted environments in any direction.
- Self-tuning cache — The cache automatically adjusts thresholds, TTL, and invalidation based on hit rate and similarity distribution, with human approval via BetterDB Monitor.
- Drop-in adapters — Pre-built integrations for OpenAI, Anthropic, LangChain, LlamaIndex, Pydantic AI, Vercel AI SDK, and more.
Who is it for?
- AI agent developers building agents that need persistent memory across user sessions without storing data externally.
- Engineering teams running LLM applications on Valkey or Redis who want to reduce latency and API costs by caching semantically similar prompts.
- Platform teams managing self-hosted Valkey infrastructure who need monitoring, migration tools, and a caching layer that tunes itself.
What can you do with BetterDB?
- Build agents with long-term context: Store user conversation history in Valkey, retrieve relevant memories across sessions without re-feeding context.
- Slash LLM costs with semantic caching: Catch user queries that rephrase the same intent and return cached LLM responses in under 1 millisecond.
- Migrate between Redis and Valkey: Move data between cloud-managed and self-hosted instances with the built-in migration tool, preserving all cache keys and memory structures.