Inspiration
Agents forget. Every restart wipes the operational rules a team has already taught them — "back up the schema before prod deploys" gets re-learned the hard way. We wanted the smallest honest system where a memory demonstrably changes an agent's next action, across process restarts, on infrastructure a solo developer can actually run.
What it does
CRDB Agentic Memory is a persistent, tenant-scoped memory layer on CockroachDB plus a closed-loop demo agent:
- Store/recall: 384-d embeddings in a
memoriestable; CockroachDB's distributed vector index returns the nearest neighbours for this agent only (prefix-scoped byagent_id), then the application reranks by recency (true half-life) and importance. - Memory changes action: a deploy-assistant agent recalls constraints before planning. In session A an operator teaches it two rules; the process exits; in session B — a NEW process and a NEW task — the plan gains a pre-step (schema backup) and post-step (notify #ops), each audited in an
actionstable with the exact memory ids that shaped it. - Self-check via the Managed MCP Server: the agent inspects its own memory infrastructure (query plans, recall audit log) through CockroachDB Cloud's hosted MCP endpoint with a service-account API key — no SQL credentials in the agent.
- Deployed on AWS: the agent runs as an AWS Lambda container image (embedding model baked in at build time) behind a public Function URL — the demo URL below hits Lambda, which talks to CockroachDB Cloud (aws-ap-southeast-1, same region).
CockroachDB tools used (rule: at least 2)
- Distributed Vector Indexing —
CREATE VECTOR INDEXon(agent_id, embedding);EXPLAINon the exact application SQL at 10,000 rows showsvector search ... memories_embedding_idx. - CockroachDB Cloud Managed MCP Server — the agent's self-check calls
explain_query/select_queryonhttps://cockroachlabs.cloud/mcp, authenticated by a service-account API key (Cluster Operator role).
AWS services used (rule: at least 1)
AWS Lambda (container image, 2048MB) + Function URL (AuthType NONE — judges can curl it anonymously) serving the agent; the CockroachDB Cloud cluster itself also runs on AWS (ap-southeast-1).
Try it (no auth needed)
Demo URL: https://22ui2md5g3jzumyog776yhmdhy0kvkrh.lambda-url.ap-southeast-1.on.aws/
- GET returns a canned demo task.
- POST
{"task": "your task here"}plans an arbitrary task against the same memory.
How we built it
Python. memory.py is 100 lines of psycopg2 — no ORM — implementing two-stage retrieval: ANN candidates from the vector index, then a weighted rerank (0.75 cosine similarity + 0.15 recency + 0.05 importance; weights and formula documented exactly as implemented). fastembed (BAAI/bge-small-en-v1.5) for embeddings. The MCP interface uses FastMCP over stdio for local agent demos; the Managed MCP client is stdlib-only (urllib) speaking streamable-HTTP JSON-RPC.
Evaluation (honest numbers)
10,000 memories across 5 agents on a free CockroachDB Cloud Basic cluster, queried from a consumer laptop cross-region:
- Recall@10 = 1.00 on 100 fact-targeted paraphrase queries (fetch = 32 / 64 / 128 ablation; 32 suffices)
- End-to-end p50 = 299 ms, p95 = 313 ms — including query embedding on CPU and the public-internet round trip
- Bulk insert ~241 rows/s; fresh-connection persistence verified
Methodology note: template paraphrases measure retrieval plumbing at scale, not open-domain generalization. English-only model.
Challenges we ran into
- The optimizer (correctly) full-scans tiny tables; vector search engages at scale — we verified the real query plan at 10k rows instead of trusting a toy EXPLAIN.
- A naive benchmark gave Recall@10 = 0.2: the queries didn't identify the target fact, making the task unwinnable. Fixing the benchmark (not the system) was the lesson.
- Cross-process demos mean nothing survives in memory — which is the point, and also what makes them annoying to script.
What's next
Forget/supersede APIs, per-kind decay, provenance and trust levels on memories, and multi-agent auth on the MCP surface.
Pre-existing work disclosure
Built during the submission period. The memory-layer design draws on the authors' prior personal experiments with agent memory (SQLite-based); all code in this repository was written new for this project.
Built With
- aws-lambda
- cockroachdb
- fastembed
- mcp
- psycopg2
- python
Log in or sign up for Devpost to join the conversation.