InvariantDB stores an agent's events, beliefs and decisions in a graph. Each fact has a valid time and a recorded time, so you can query what the agent knew when it acted.
Example: to see what the agent knew at 15:47 on 13 April 2026, add
AT RECORDED '2026-04-13T15:47:00Z' to the MATCH.
Memory features built into the database.
Outlives context windows and process restarts. State lives in the graph, not in the agent process.
Real graph structure: entities, facts, sessions, contradictions. Query with Cypher.
Bitemporal by default. Replay agent memory state at any past moment with AT RECORDED.
Committed node and relationship writes are appended to a hash-chained history. Add a provenance object to a write to record the acting agent and the reason; the server also records the credential that made it. WORM mode is available under an Enterprise license: updates and deletes sent through Cypher, MCP tools, /execute and import are refused. It does not cover the legacy POST /write route on the default graph, schema or index changes, or an administrator dropping the whole graph.
Several agents can read and write the same graph, so one agent's findings inform another's. Limit each agent's API key to the graphs it should reach.
npm install https://sdk.invariantdb.com/node/invariantdb-0.8.0.tgz — the client runs the memory procedures through Cypher.
Ranked recall over HTTP (keyword or vector search plus hop expansion): POST /graphs/{graph}/memory/recall with {"query": "...", "k": 10, "hops": 1}.
Agents that support the Model Context Protocol can use the same graph without the SDK. remember saves a memory, recall finds memories by keyword, recall_as_of lists memories as of a past time, and record_episode and replay_episodes write and read a session log. save_document and get_document keep versioned documents. The endpoint is https://invariantdb.com/graphs/{graph}/mcp. See the MCP page for setup.
Schema suggestions are available through the HTTP API. The investigation endpoints are deprecated.
Suggests index and schema changes for a graph.
POST /graphs/{name}/suggestions/sweep checks for missing indexes, unused labels and schema drift.POST /graphs/{name}/suggestions/analyze checks one Cypher query against the graph’s indexes.GET /graphs/{name}/suggestions lists suggestions; POST /graphs/{name}/suggestions/{key}/apply applies one.The natural-language query, investigation and agent endpoints (/graphs/{name}/nlq, /graphs/{name}/investigate and /graphs/{name}/agent) are retired: from 1.4.3.3 they answer HTTP 410 with subcode FEATURE_RETIRED and call no model. Natural-language questions and agent runs move to the knowledge-graph product; run Cypher with POST /graphs/{name}/cypher. The memory tools (remember, recall, save_document) are not affected. GET /graphs/{name}/cases stays for reading recorded cases, is deprecated, and serves a case only to the credential that recorded it or to a global administrator holding the same roles.
Give each agent its own graph and an API key whose graphs list names only that graph. A compromised key can then reach only that graph.
Each agent can use its own graph. A key with a graphs list reaches only the graphs it names; a key without one can reach any graph its tenant allows.
Each key has a tenant, a role and an optional graphs list, checked on each request.
Each named graph accepts a limited number of concurrent queries. Extra requests are refused with HTTP 503 (MCP error -32000) and a suggested retry delay.
Set ttlDays when you create a key for an agent; a key created without it does not expire. An admin can rotate a key with POST /admin/api-keys/{id}/rotate, which revokes the old key.
Send provenance with a Cypher write, for example {"actor": "agent:support-bot", "reason": "refund approved"}, as the MCP cypher_query argument, an HTTP body field, or X-Provenance-* headers. The server adds the calling credential as principal. Read both with CALL db.propertyProvenance(...).
A write creates a new version instead of overwriting the old value. Read earlier values with AT RECORDED or CALL db.propertyHistory(...).
Create an API key, then install the SDK or connect over MCP.