Agent memory carries selected information across tasks or sessions. Retrieval-augmented generation (RAG) fetches material to ground an answer. Long context lets a model work with more material in the current request. Choose among them by asking three questions: how long the information must remain useful, where its source of truth lives, and what the current task needs to see. A reliable workflow can use all three.
What does each approach keep available?
The three approaches solve different information problems. “Available” also means something different in each case. A document can exist in a retrieval store without being included in a model request. A preference can be saved as memory without being relevant to every task. A long-context model can accept a large input, but the model only sees the material supplied in that request.
| Approach | What it makes available | Best fit | How it should be updated | Main failure to test |
|---|---|---|---|---|
| Agent memory | Selected facts, decisions, preferences, or task state that should carry across work | Information that remains useful across sessions and has a clear owner or scope | Replace, expire, or re-approve the saved item when the underlying decision changes | Stale memory overrides a newer decision |
| RAG | Relevant passages retrieved from an external collection for the current task | Policies, manuals, records, and other sources that change or are too large to include every time | Update the source collection, its metadata, and the retrieval index | The system retrieves an outdated or irrelevant passage |
| Long context | Material placed directly in the current model request | A bounded set of documents that must be compared or transformed together | Assemble the right inputs again for each request | A critical detail is present but missed or outweighed by other material |
Agent memory is a system-level capability rather than a guarantee that a model permanently remembers everything. Memory implementations commonly separate information used within a thread from information saved across threads; the LangChain memory documentation describes this distinction as short-term and long-term memory.
RAG was introduced as a way to combine a model's generated response with retrieved external knowledge. The original Retrieval-Augmented Generation paper evaluated a particular retrieval-and-generation architecture. It supports the basic definition, but it does not prove that every retrieval setup will be accurate.
Which approach fits these three tasks?
1. Keep an approved release-note format for several weeks
Use scoped agent memory when the team has approved a repeatable preference such as “start with the customer impact, then list breaking changes.” Save the preference with its owner, scope, approval date, and a condition for review. Do not store “the release notes format” as an unqualified permanent fact if different projects use different formats.
2. Answer from a support policy that changes
Use retrieval when the current policy remains the source of truth. Store an effective date or version with each policy document, retrieve the relevant passage, and require the answer to name its source. Saving the full policy as long-lived memory creates a second copy that can drift from the maintained document.
3. Review two short drafts once
Put both drafts directly in the current context. Label them clearly, state the comparison criteria, and ask the model to quote the relevant wording before recommending an edit. Persistent memory and a retrieval pipeline add little when the material is small, task-specific, and unlikely to be reused.
These are design defaults, not universal performance claims. Document size, model behavior, retrieval quality, latency, and cost can change the choice. Measure those factors in the workflow you will actually run.
When do agent memory, RAG, and long context work together?
Suppose an agent must prepare release notes while checking whether two candidate drafts comply with the current support policy. The workflow can combine the approaches without treating any one of them as the complete knowledge base:
- Memory supplies the approved writing preference: lead with customer impact, use the format approved by the release owner, and apply it only to this product.
- RAG retrieves the current support policy: select the relevant passage and include its title, version, and effective date.
- Long context carries the immediate working set: place draft A, draft B, the retrieved passage, and the scoped preference in the same request.
- The output exposes its basis: identify which draft follows the current policy, cite the passage used, and flag any decision that still needs the release owner.
The effective date matters. Without it, the workflow can retrieve a policy that looks relevant but is no longer current. The same problem applies to memory: a saved preference needs enough provenance to tell whether it is still approved. Long context does not resolve conflicting sources by itself; the request must state which source has authority and what to do when sources disagree.
What are the limits of each approach?
- Memory can become stale. Save only information worth carrying forward, attach scope and provenance, and define when it must be reviewed.
- RAG can retrieve the wrong evidence. Evaluate retrieval separately from the final answer. A fluent answer cannot repair a missing or obsolete source.
- Long context does not guarantee equal attention. The Lost in the Middle study found that performance in its tested multi-document and key-value tasks varied with the position of relevant information. Treat that result as a reason to test placement and document selection, not as a universal score for every model or task.
- More supplied text creates more work to manage. Clear labels, source boundaries, and compact task state often matter more than filling the available context window. Anthropic's context engineering guidance similarly frames context as a limited resource that should contain the information most useful for the next action.
What should you test before choosing?
Run a small change test before committing to an architecture. Use the same task and evaluation criteria in each run.
- Create version 1 of a source with one clear answer, such as a support window ending on Tuesday.
- Run the task and record the exact response, the source or memory item used, and any unsupported statement.
- Replace the source with version 2, changing the answer to Thursday. Mark version 2 as current and version 1 as superseded.
- Run the same task again. Check whether the response uses Thursday, identifies version 2, and avoids treating version 1 as current.
- Record what still requires human approval. Repeat the test after any change to the model, retrieval settings, memory rules, or prompt assembly.
Score source selection separately from answer quality. A useful test record includes the question, expected source, source version, observed answer, citation or evidence used, and the reviewer's decision. This makes a stale-memory failure distinguishable from a retrieval failure or a model interpretation error.
To test whether an approved decision survives a fresh session, use the two-session handoff exercise. It gives you a five-field note and a repeatable question for checking which decision the next session actually uses.
