Agents that remember, learn and forget on purpose
Agent Memory gives your agents short-term session context, long-term facts, episodic recall and learned procedures in one place. You get the same contract over REST, MCP and the Node, Python and .NET SDKs, with every tenant isolated in Postgres by row-level security.
1import { AgentMemoryClient } from 'agentmemory'23const memory = new AgentMemoryClient({4 apiKey: process.env.AGENT_MEMORY_API_KEY,5 baseUrl: process.env.AGENT_MEMORY_URL,6 workspaceId: process.env.AGENT_MEMORY_WORKSPACE,7})89// remember10await memory.add('Alex is vegetarian', { userId: 'alex', runId: 'run-1', sourceKind: 'user' })1112// recall — keep the receipt13const context = await memory.search('what can Alex eat?', { userId: 'alex', runId: 'run-1' })1415// learn from the outcome of the run16await memory.outcome({ runId: 'run-1', buildSuccess: true, receiptId: context.receiptId })
One memory contract, every way you build
Memory that behaves like memory, not a vector dump
Persistent, multi-tenant memory for AI agents.
Four kinds of memory, one engine
Session context in Redis, plus durable workspace facts, run-level episodes and learned procedures in Postgres with pgvector. Your agent asks one question and gets back a single context built from all four.
Hybrid retrieval, not just vectors
Vector, full-text, structured, graph and episode searches run in parallel. Results are combined with reciprocal rank fusion, reranked, and trimmed to the token budget you set for each request.
Consolidation that learns
When a run ends, its session is distilled into an episode, promotable facts, relationships and procedures. Contradictions are detected, and outdated facts are superseded instead of left to compete.
Explainable recall
Every memory records where it came from, which model extracted it, what it derives from and what replaced it. Pass explain=true to see why each result was ranked where it was.
Bi-temporal by design
Memories record both when something was true and when it was recorded. Ask what the agent knew as of a given date, and superseded facts stay hidden unless you ask for them.
Receipts that close the loop
Each recall returns a receipt. Report the run's outcome or feedback against it, and the memories that actually helped gain trust while the ones that misled lose it.
Forgetting you can prove
A delete redacts the memory immediately, removes its derived copies, and gives you an erasure status you can check. If live memories depend on it, the delete is blocked and returns their ids unless you opt into cascade.
Shared memory with policy
Each memory carries a visibility: private, agent, user, workspace or tenant. A policy check runs before every search, so agents only see what they are allowed to see, and denials are audited.
Tenant isolation in the database
Postgres row-level security, composite foreign keys and a runtime role that cannot bypass RLS. A request without a tenant context reads zero rows.
From first call to an agent that learns
- 1
Connect your agent
Create a workspace and an API key bound to your agent. Then point an MCP client at the endpoint, or call the Node, Python, .NET or REST client. The key decides which agent is acting, so there is no agent id to spoof.
- 2
Remember as you go
Write decisions, corrections, preferences and references as they come up. Every write returns an operation receipt, and an Idempotency-Key makes retries safe.
- 3
Recall a compiled context
Ask in natural language. Agent Memory searches facts, episodes, procedures and conventions, ranks the results, and returns a context sized to your token budget, with a receipt naming exactly what was delivered.
- 4
Learn from outcomes
Report how the run went. Consolidation turns the session into an episode, promotes durable facts, flags contradictions and reinforces the procedures behind successful runs.
The right kind of memory for every job
Short-lived context, durable facts, run history and learned procedures, recalled together as one context.
Session memory
Short-lived context for the current run, stored in Redis and scoped by tenant, workspace, application and run. Idle sessions are consolidated automatically.
Workspace memory
Durable facts such as decisions, corrections, violations, approved patterns and artifact references. Each one carries an embedding, confidence, provenance, validity dates and a lifecycle state.
Episodic memory
One episode per run, recording what happened, how it ended and how well it scored. Agents can look up past runs that resemble the goal in front of them.
Procedural memory
Learned how-tos with a trigger, steps and anti-patterns, distilled from successful runs and repeated evidence. They are strengthened or weakened as later runs apply them, and they decay when unused.
Memory blocks
Hand-curated context such as a persona, rules or project notes, kept separate from consolidation and edited line by line.
Tenant and platform conventions
Facts confirmed independently in two or more workspaces can be promoted to tenant-wide conventions after an admin approves them. Platform policies are always rendered and cannot be overridden by lower layers.
Measured on LongMemEval
Long-horizon conversational memory, scored with the official evaluation.
Answerer GPT-4o, scored with the official evaluate_qa.py and the GPT-4o judge. 95% confidence interval: 80.6–87.0%. The oracle ceiling on the same setup was 90.4%.
Measured across 470 questions. Recall@5 = 0.912 and Recall@10 = 0.968.
Published baseline for answering from the raw ~115k-token history with no memory layer. Shown for context only; it is not our measurement.
On a 12-question sample, answering from consolidated facts used about 24x fewer tokens than raw transcript mode, with no loss of accuracy (9/12 vs 8/12). The sample is small, so treat this as indicative.
Sources and methodology are documented in the benchmark report.
Remember, recall, learn: three calls
The same contract over REST, MCP and the Node, Python and .NET clients. Every recall returns a receipt you can feed back as an outcome.
- Model Context Protocol (MCP): A remote Streamable HTTP endpoint with API key authentication, plus a stdio server for local use. Works with Claude Code, Claude Desktop, VS Code and other MCP clients.
- Claude Code plugin: A plugin that connects Claude Code to your Agent Memory workspace over MCP using an API key.
- Node.js SDK: The `agentmemory` package. Typed, no dependencies, runs on Node 18+.
- Python SDK: The `agentmemory` package for Python 3.9+, with the same methods as the Node SDK.
- .NET client: AgentMemory.Client, an HTTP implementation of the same IAgentMemory interface you can also embed in-process.
1import { AgentMemoryClient } from 'agentmemory'23const memory = new AgentMemoryClient({4 apiKey: process.env.AGENT_MEMORY_API_KEY,5 baseUrl: process.env.AGENT_MEMORY_URL,6 workspaceId: process.env.AGENT_MEMORY_WORKSPACE,7})89// remember10await memory.add('Alex is vegetarian', { userId: 'alex', runId: 'run-1', sourceKind: 'user' })1112// recall — keep the receipt13const context = await memory.search('what can Alex eat?', { userId: 'alex', runId: 'run-1' })1415// learn from the outcome of the run16await memory.outcome({ runId: 'run-1', buildSuccess: true, receiptId: context.receiptId })
Built for agents that work over time
Coding agents
Keep architecture decisions, corrections and approved patterns across sessions, so your agent stops re-reading the repo and repeating mistakes it was already corrected on.
Assistants and support agents
Remember each end user's preferences and context with userId, and erase that user's memories on request with a status you can verify.
Multi-agent pipelines
Orchestrator, backend, frontend and governance agents share one workspace memory, and visibility rules control what each of them can read and share.
SaaS products with many customers
Give each customer its own tenant and workspaces, enforced in the database, with metered usage and quotas per tenant.
Agents that improve with use
Report outcomes from builds, tests, deploys and user ratings. The memories and procedures behind good runs are credited, and the ones behind bad runs lose confidence.
Regulated and offline environments
Run the air-gapped profile with local models when data cannot leave your perimeter.
Isolation you can verify, not just promise
Agent Memory was built multi-tenant from the first schema. Isolation is enforced by Postgres itself, and the boundaries are covered by automated acceptance tests.
Row-level security, fail-closed
Every tenant table has ENABLE and FORCE ROW LEVEL SECURITY, with a policy keyed to a transaction-local tenant setting. If that setting is missing, a query returns zero rows.
A runtime role that cannot bypass RLS
The application connects as a role with NOSUPERUSER and NOBYPASSRLS that does not own any tables. Migrations run under a separate owner connection.
Cross-tenant references are impossible
Composite foreign keys on (tenant_id, id) mean a relationship, episode event or derivative can never point at another tenant's data.
Identity comes from the credential
The tenant and agent come from a verified token or an agent-bound API key, never from the request body. Resources outside your tenant return 404, so their existence is not revealed.
Standard or dedicated placement
Tenants live in a shared schema protected by RLS by default. A tenant can also be provisioned onto its own dedicated database.
PII-aware writes
Writes are scanned for PII using checksum-verified detection. Flagged memories are never promoted, and they are redacted in exports and webhook summaries.
Managed cloud in the EU
The managed service runs on Microsoft Azure in the European Union (Germany West Central), with nightly verified backups to geo-redundant storage.
Self-hosted and air-gapped
A reference air-gapped profile runs Postgres, Redis and a local OpenAI-compatible model server with no outbound network. The hosts refuse to start if any configured dependency would leave the perimeter.
Supply chain checks
Every commit gets a CycloneDX SBOM, images are signed keylessly with cosign, and CI blocks on SAST, container, dependency, secret and license findings.
Questions, answered
How is Agent Memory different from a vector database?
A vector database stores embeddings. Agent Memory decides what to keep and how to recall it. It combines vector, full-text, structured, graph and episode searches, consolidates sessions into durable facts and procedures, resolves contradictions, tracks provenance and validity time, and returns a context sized to a token budget. pgvector is one of the components it uses.
What are the different memory types?
There are four. Session memory holds context for the current run in Redis. Workspace memory holds durable facts. Episodic memory keeps one record per run with its outcome. Procedural memory holds learned how-tos. Consolidation moves knowledge from the session into the other three, and memory blocks give you hand-curated context alongside them.
How do I connect my agent?
Use MCP if your agent is an MCP client: there is a remote Streamable HTTP endpoint, a stdio server, and a Claude Code plugin. Otherwise use the Node or Python SDK, the .NET client, or the /v1 HTTP API. All of them share one contract, and a parity scenario in CI checks that they behave the same.
How are tenants isolated?
In the database. Every tenant table is protected by Postgres row-level security keyed to a transaction-local tenant setting. The application role cannot bypass RLS, and a missing tenant context returns zero rows. Composite foreign keys block cross-tenant references, and Redis keys are scoped per tenant as well. Within a tenant, workspaces separate data and per-memory visibility controls what each agent can see.
Can I delete a user's data?
Yes. A delete redacts the memory right away and removes its derived copies in the background, and you can check the erasure status until it reads complete. If other memories derive from the one you are deleting, the delete is blocked and returns their ids, unless you ask for a cascade. Admins can also purge or export a whole workspace or tenant.
Can I self-host or run it air-gapped?
There is a reference air-gapped deployment profile that runs Postgres, Redis, a local OpenAI-compatible model server and the Agent Memory hosts with no outbound network. It has passed an acceptance run. Contact us to discuss self-hosted and on-premises deployments.
Which LLMs and embedding models does it use?
Extraction, summarization and reranking can use Anthropic Claude or any OpenAI-compatible endpoint, including local servers such as Ollama or vLLM. Embeddings can use OpenAI, AWS Bedrock or a local ONNX model. If no LLM key is configured, the platform falls back to rule-based processing.
How did you measure the benchmark numbers?
We ran the full LongMemEval_S set (500 questions) with GPT-4o as the answerer and the official evaluate_qa.py script with the GPT-4o judge, and got 83.8% QA accuracy (95% CI 80.6–87.0%). An earlier 50-question subset scored about 4 points higher, so we publish the full-set number. Methodology and the deviations from defaults are documented with the results.
Give your agents a memory
Start on the free Hobby plan or take a 14-day Pro trial. Connect over MCP or an SDK in minutes.