ai newsMi., 25. Nov.
EilmeldungCan Claude’s storage webhooks miss an hour-long outage?

How to Evaluate AI Agent Memory: A Replay Suite That Beats Demo Benchmarks

An agent that remembers the wrong thing can look more capable than one with no memory at all—right up to the moment it sends an outdated refund policy, mixes two customers, or repeats a resolved incident. The useful question is not “which memory system wins a leaderboard?” It is: does this memory l

dev.toMontag 05:39 · 23.11.8 Min. Lesezeit
Bild: dev.to

An agent that remembers the wrong thing can look more capable than one with no memory at all—right up to the moment it sends an outdated refund policy, mixes two customers, or repeats a resolved incident. The useful question is not “which memory system wins a leaderboard?” It is: does this memory layer improve our agent on our tasks without adding unsafe, stale, or expensive context?

This guide shows how to answer that question with a small, repeatable AI agent memory evaluation suite. It works whether your implementation uses files, relational rows, a vector index, a graph, or a managed memory API. The aim is not to crown a tool. It is to make a memory decision testable before it becomes a production dependency.

Memory products differ on more than storage. They make different choices about when to write a memory, how to consolidate it, what to retrieve, and how much context to inject. A benchmark score can be useful evidence, but it rarely matches your model, prompt, permission model, data lifetime, or user workload.

The current interest in agent memory is real: recent community comparisons cover systems ranging from simple Markdown stores to hybrid vector, keyword, graph, and temporal retrieval. But comparison tables often hide the operational question: what happens when a memory was true last week and harmful today?

For a support agent, a stale plan can create a bad answer. For a coding agent, an old architectural decision can steer an edit into the wrong module. For a multi-tenant product, the worst failure is not poor relevance; it is retrieving another tenant’s data.

Treat memory as a pipeline with four jobs:

Your evaluation should test each job and the full task outcome. Otherwise, a system can appear accurate while succeeding for the wrong reason.

Before running tools, write down what memory is allowed to do. This prevents a trial from turning into an unbounded data collection exercise.

This table is more valuable than a vendor feature grid because it gives every candidate the same acceptance criteria. It also surfaces a common mistake: storing everything is not a memory strategy. It is an ingestion policy with no quality control.

The strongest test corpus comes from completed, de-identified tasks: support tickets, code reviews, runbooks, or account setup flows. Create a held-out set; do not use the same examples to tune prompts and declare victory.

Here is a compact fixture format. The forbidden_memory_ids field makes negative retrieval a first-class test instead of an afterthought.

{ "id": "support-plan-change-014", "tenant_id": "northwind", "events": [ { "id": "m1", "at": "2026-05-01", "text": "Plan permits 5 seats", "status": "superseded" }, { "id": "m2", "at": "2026-05-12", "text": "Plan permits 12 seats", "status": "current" } ], "task": "Can this account add two teammates? Cite the policy you used.", "expected_memory_ids": [ "m2" ], "forbidden_memory_ids": [ "m1" ], "expected_outcome": "yes" } Enter fullscreen mode Exit fullscreen mode Keep fixtures small at first: 20 to 40 cases across the tasks that create real risk. Add cases whenever an incident, support correction, or confusing model response exposes a new failure mode. This turns the suite into a living operational artifact rather than a one-time procurement exercise.

Give the system a fact, then a newer conflicting fact. Ask the same question at several points in time. The agent should retrieve the current record, preserve the source of the change, and avoid treating the older record as equal evidence.

Measure both answer correctness and temporal precision:

temporal_precision = cases using the current fact / cases with a time-sensitive fact Enter fullscreen mode Exit fullscreen mode Do not fix this only in the prompt. A prompt can remind an agent to prefer recent information, but retrieval still needs a usable timestamp, status, and ranking rule.

Feed in chat containing a joke, a transient request, an unsupported claim, and one stable preference. Only the stable preference should become durable memory. Then ask why each stored item exists.

write_precision = useful stored memories / all stored memories write_recall = useful memories stored / useful memories that appeared Enter fullscreen mode Exit fullscreen mode A high write-recall score with low precision creates a slow, noisy filing cabinet. A high precision score with low recall may be acceptable for low-risk assistance, but not for workflows where prior decisions must survive a session boundary.

Ask a task that has one relevant memory among many near-matches. Then run the task with retrieval disabled. If the answer gets worse after memory is enabled, the retrieved context caused negative transfer.

type MemoryRun = { caseId: string; retrievedIds: string [ ]; injectedTokens: number; answerCorrect: boolean; actionCorrect: boolean; citationMatchesSource: boolean; latencyMs: number; }; Enter fullscreen mode Exit fullscreen mode Ask the agent to return memory IDs alongside its answer during evaluation. In production, users may see friendly citations instead; the important part is that an operator can trace a conclusion back to a source.

Create identical facts for two tenants, then query from each tenant. Add a user whose access is revoked after the fact was written. Retrieval must filter authorization before semantic ranking; adding tenant IDs to the final prompt is too late.

Include adversarial cases: similar company names, shared employee names, copied templates, and documents with an irrelevant tenant ID embedded in the text. A memory system does not pass this test because it “usually” returns the right namespace. It passes when forbidden records are absent from every retrieved set.

Deleting a source row is insufficient if an embedding, summary, cache entry, or generated profile can still reintroduce it. Write one test that creates a memory, confirms it is retrievable, deletes it, refreshes any materialized state, and proves it is absent.

Run the test across every retrieval path. This is especially important if your system uses asynchronous embedding or consolidation workers.

Run the exact fixtures through each candidate with the same model, prompt, tool permissions, and token budget. Then run a no-memory baseline. A simple scorecard keeps the decision honest.

Avoid collapsing these into one magic number. An 85% task-success rate with a single tenant leak is not a good system. Set non-negotiable gates first, then compare trade-offs among candidates that pass.

The evaluator does not need to know a provider’s internal architecture. It needs a small adapter: reset state, seed events, run a task, and return retrieved IDs plus telemetry.

def evaluate ( adapter, cases ): results = [ ] for case in cases: adapter. reset ( case [ "tenant_id" ] ) adapter. seed ( case [ "events" ] ) run = adapter. run_task ( case [ "tenant_id" ], case [ "task" ] ) expected = set ( case [ "expected_memory_ids" ] ) forbidden = set ( case [ "forbidden_memory_ids" ] ) actual = set ( run. retrieved_ids ) results. append ( { "id": case [ "id" ], "answer_ok": run. outcome == case [ "expected_outcome" ], "retrieval_recall": len ( actual & expected ) / max ( 1, len ( expected ) ), "forbidden_hit": bool ( actual & forbidden ), "tokens": run. injected_tokens, "latency_ms": run. latency_ms, } ) return results Enter fullscreen mode Exit fullscreen mode Make forbidden_hit a hard failure. For quality metrics, inspect the cases that lost rather than trusting averages. A system may need a better metadata filter, a smaller retrieval limit, a recency boost, or a different write validator—not a larger model.

Start in shadow mode. Let the system retrieve and log candidate memory, but do not inject it into user-facing responses. Review what it would have supplied, the token cost, and any forbidden hits. Then enable it for a small cohort and retain a no-memory fallback.

The contrarian lesson is simple: a memory layer is not automatically an upgrade. For a narrow workflow, explicit state in a database or a short project file can beat a sophisticated retrieval stack. Add complexity only when your replay suite proves a durable benefit.

Create 20 realistic cases this week: five stale-fact cases, five write-quality cases, five retrieval cases, three isolation cases, and two deletion cases. Run the no-memory baseline before touching a new dependency. The output will give you a defensible implementation choice and a regression suite you can keep using after launch.

It is the process of testing whether a system that stores and retrieves prior information improves agent tasks safely. A useful evaluation measures writes, retrieval, currentness, authorization, deletion, cost, latency, and final task outcomes.

Start with 20 to 40 representative cases. Expand the suite with incidents and newly observed failures. Coverage of high-risk actions matters more than a large collection of easy questions.

Use benchmarks as one input, not the decision. Their models, datasets, prompts, and allowed context may not match your application. Paired replay runs against your own workload provide stronger implementation evidence.

Seed an older fact and an explicitly newer replacement, then require the agent to answer with the current fact and cite its source. Test what happens after summarization, embedding refreshes, and session boundaries.

No. Similarity search can help retrieval, but it does not by itself provide write validation, temporal supersession, tenant authorization, provenance, deletion guarantees, or a safe way to apply retrieved content.

Negative transfer occurs when retrieved memory makes an answer or action worse than the no-memory baseline. It commonly comes from stale, irrelevant, conflicting, or over-broad context.

Run it in CI for changes to memory logic and before deploying changes to prompts, models, embedding models, permissions, ranking, chunking, or deletion workflows. Also schedule a periodic production replay using de-identified cases.

Quelle: dev.to (dev.to). Original öffnen