Protocol & integration

Redis-Compatible Vector Database: KV + HNSW in One Process

Session state and vector memory in the same engine, behind one connection. Your existing redis-py, ioredis, and go-redis clients connect without a custom driver.

01

The Problem: Two Databases for One Agent

AI agents need two kinds of memory: working state (session tokens, scratchpads, rate counters with TTL) and semantic recall (vector embeddings for RAG, personalization, memory). Conventional stacks use Redis for the first and Pinecone/Qdrant/Milvus for the second.

Two databases means two backup schedules, two failure domains, two billing meters, and a consistency gap — the agent's session and its recall can drift apart if one system is down while the other accepts writes.

02

How DBX Combines KV and Vectors

KV with TTL (session, scratchpad, rate counters) and HNSW vectors (semantic recall) live in the same process, behind one connection, in one data directory, and inside one backup archive. An agent's session and its recall cannot drift apart — there is no second system to drift from.

The authenticated RESP data plane runs on port 6380. The first command is AUTH tenant_id:key_id secret. After that, the same connection handles both SET/GET and VADD/VSEARCH.

KV operations

Session State with Standard Redis Clients

Python (redis-py)
import redis

# Connect with any RESP client — no custom driver needed
r = redis.Redis(host="localhost", port=6380,
                username="acme-corp:key_001",
                password="your-256-bit-secret")

# Standard KV with TTL
r.setex("session:user_42", 3600, "active")
r.set("scratchpad:draft", "Meeting notes from 2pm call")
r.incr("rate:api_calls")

# TTL and expiry work as expected
r.ttl("session:user_42")  # 3599

Vector operations on the same connection

Semantic Recall via RESP

RESP commands
# Same authenticated connection — KV and vectors share one wire
AUTH acme-corp:key_001 your-256-bit-secret

# Store a vector
VADD docs doc_001 0.012 -0.043 0.091 ...

# Semantic search
VSEARCH docs 0.012 -0.043 0.091 ... 5

# Similar-to-id (no re-embedding needed)
VSIM docs doc_001 5

# Set session state on the same connection
SET session:user_42 active EX 3600

Framework Integrations

DBX v1.3.0 includes LangChain and LlamaIndex adapters. The Python SDK (pip install dbx) wraps both KV and vector operations.

A

LangChain RAG

The dbx[langchain] extra provides a vector store adapter and a cache backend. Use DBX as the retriever in a LangChain RAG chain with per-tenant isolation. See examples/langchain-rag.

B

LlamaIndex

The dbx[llamaindex] extra provides a vector store and storage context adapter. Each tenant's documents are indexed into an isolated DBX engine.

C

Next.js cache

Use SETEX via ioredis for Next.js page caching. The same tenant connection handles both cache writes and vector recall. See examples/nextjs-cache.

RESP compatibility lowers the cost of trying DBX. It is not a reason to choose DBX, and it is not a claim that DBX is a substitute for a tuned Redis cluster. Non-string RESP mutation families fail closed.