nlqdb

Solve · Agent builders

How do I give my AI agent persistent memory across sessions?

If your agent needs to remember facts across sessions and later *aggregate* them, give it a real database via MCP — nlqdb's `nlqdb_query` tool provisions Postgres from the agent's first English goal and answers `GROUP BY` / top-N / per-period questions over what it stored. Retrieval gets you one fact; analytics gets you the report.

Agent builders pick between unstructured memory (vector recall over chat history, e.g. Mem0) and structured memory (typed rows the agent can aggregate later). Vector recall returns the top-k similar facts — but it has no query planner, so the moment the agent needs `average per group` or `top 10 this month` it ends up doing arithmetic over a list of search hits. Retrieval ≠ analytics.

Drop this in your HTML

The query an agent runs to summarise its own memory — `GROUP BY` + count + top-N — is exactly what a vector store can't answer and a real database can.

> top 5 things the agent remembered this week by frequency
<nlq-data goal="top 5 things the agent remembered this week by frequency"></nlq-data>

What nlqdb actually does for this

  • MCP `nlqdb_query` provisions Postgres from the agent's first English goal (no `db` set → creates one when the agent has none) and answers in English — plus `nlqdb_list_databases` / `nlqdb_describe`, no human in the loop.
  • Memory is typed rows in real Postgres, so the agent can `GROUP BY`, rank top-N, and aggregate per-period over what it stored — not just recall a single fact by similarity.
  • Schema evolves via English: `"add a priority column"` migrates the table; the diff is shown before apply (`SK-ONBOARD-004`).
  • Per-(mcp_host, device_id) keys (`sk_mcp_*`) let one tenant share memory across an agent fleet without leaking other tenants' rows.

What nlqdb doesn't do here

  • No native vector search yet — nlqdb is Postgres-first; for unstructured fact recall over chat-text strings, Mem0 or pgvector are the right shape.
  • No explicit per-row TTL / forget primitive yet — anonymous DBs auto-sweep at 72h, but authed rows persist until deleted.

Questions buyers ask

Is nlqdb a replacement for Mem0 for AI agent memory?
It's the structured, analytical half — and the only half that can answer analytical questions. Mem0 owns unstructured similarity recall ("the user prefers Celsius"); nlqdb owns typed rows the agent later aggregates ("top 10 topics this month by count"). Both can sit behind one MCP-aware agent.
Why can't a vector store answer "average per group" about agent memory?
A vector store returns the top-k most similar facts; it has no query planner. So an aggregation becomes the LLM doing arithmetic over a list of search hits — a hallucination generator, not a `GROUP BY`. nlqdb runs the actual aggregation in Postgres and shows the SQL.
How does the agent create its own database?
Via `nlqdb_query` with no `db` set — the agent sends an English goal (`"a memory store for my research assistant"`); when it has no database, nlqdb provisions Postgres from the goal and answers in one call. There is no separate `create_database` tool — provisioning and querying are the same call.
What about agent frameworks like LangChain or AutoGen?
Any framework that speaks MCP can connect; the `@nlqdb/sdk` (TypeScript) is the typed fallback for non-MCP integrations. The `mcp` surface is the no-glue path — point the host (Claude Desktop, Cursor, Cline) at `mcp.nlqdb.com`.
Does the agent need its own credentials?
Yes — agents authenticate with `sk_mcp_*` keys minted with `(mcp_host, device_id)` claims. Per-device tagging means the dashboard shows `Cursor on macbook-air ran 14 queries today`; revocation is per-device, not per-user.

Where this pain shows up in public

Enduring discussion hubs where you can verify the theme without taking our word for it. We don't quote individual posts; we cite search-result and subreddit URLs that stay live as new threads land.

Try nlqdb in 30 seconds

No sign-in. The anonymous database lasts 72 hours; adopt it with one click if you keep it.

Start with a goal →

Looking at this from a different angle? Browse all solve pages or browse competitor comparisons.