AgentCore course → Lesson 4
Memory and context
Memory is the capability most likely to surprise a customer on their first invoice, and the one where the compliance-friendly choice happens to also be the cheap one. It is also where the mental model most people arrive with is simply wrong.
Start from what you have
You've wired up a checkpointer and watched a context window fill with turns until quality degraded. You know the naive answer (persist the transcript, replay it) and you know it doesn't scale. AgentCore takes the other road, and that difference is the whole lesson.
The correction most customers need
Long-term memory in AgentCore is not a transcript. AWS is explicit: instead of saving all raw conversation data, long-term memory preserves only the key insights: conversation summaries, facts and knowledge, or user preferences."Instead of saving all raw conversation data, long-term memory preserves only the key insights." Long-term memory. Retrieved 2026-08-05.
Raw turns arrive as events. A strategy then extracts and consolidates structured insight from them, and it is that distilled output which persists across sessions. AWS's own example is the right one to reuse: a customer mentions their preferred shoe brand in one chat, and in a completely different conversation later the agent recalls it and makes a tailored suggestion.
The one idea
Short-term memory holds the conversation. Long-term memory holds conclusions drawn from conversations, and increasingly from any structured data you feed it. The strategy in between is where you control cost, quality, and where your data goes.
The ledger: three meters, one lifecycle
Memory bills on three separate meters, and teams model the first two while forgetting the third. The figures below are the worked support-agent sketch from the pricing card: 10,000 sessions, 8 turns each, 2 memory retrievals per turn.
Read the two levers against each other, because the asymmetry is the finding. Switching storage tiers saves $7.50. Halving retrievals per turn saves $40. Retrieval discipline — consulting memory once per turn instead of twice, caching within a turn, narrowing the namespace queried — is worth five times more than the configuration change, and it is the thing nobody models. Retrieval alone is about three times the entire Runtime bill.
Say this to a customer"Memory bills on three meters, not one: what you write, what you keep, and what you read back. Almost everyone models the first two. Reading back is usually the biggest line, so before you ship, decide how many times per turn your agent really needs to consult memory. Twice instead of once can double that part of your bill."
The one configuration change that moves two lines at once
Above the choice of which strategy sits the choice of how much of it you own. Three tiers, and this is the decision worth walking a customer through carefully, because it moves meter 2 and data residency together.
| Tier | What you control | Storage cost per 1k records / month |
Cross-region inference |
|---|---|---|---|
| Built-in | Nothing. AWS's default extraction and consolidation | $0.75 | Yes, unavoidable |
| Built-in with overrides | Your own extraction prompts, and you pick the foundation model for extraction and consolidation | $0.25 | Avoidable |
| Self-managed | The entire extraction and consolidation pipeline; AgentCore provides only storage and retrieval | $0.25 | Avoidable |
The mechanism connecting those last two columns is worth understanding rather than memorising. Long-term memory has to run inference to extract insight from raw turns. On a built-in strategy, AWS chooses the model, which means AWS also chooses where it runs, hence cross-region inference. On built-in with overrides you select the foundation model yourself, and AWS documents this as precisely the way to manage model selection and avoid cross-region inference.Overrides let you provide your own instructions and select a specific foundation model for extraction and consolidation (Customize a built-in strategy); the CRIS opt-out via built-in-with-overrides is stated in Cross-region inference. Retrieved 2026-08-10.
The rare easy win in Canada
Almost every compliance conversation is a trade-off. This one is not. Built-in with overrides is simultaneously the cheaper storage tier and the one that lets a Canadian customer keep memory inference in-region. Three times cheaper on stored records and better on residency. Lead with it.
What the strategy actually extracts
Four built-in strategies, each answering a different question about the user. Naming them precisely is what makes you sound like you have used this.
- Semantic
- Extracts facts and contextual knowledge — entities, events, details discussed — building a persistent knowledge base. Answers: what is true about this user's world?
- User preferences
- Extracts preferences, choices, and styles, building a persistent profile per user. Answers: what does this user like and expect?
- Summary
- Condenses conversations into summaries rather than retaining the turns. Answers: what happened, in brief?
- Episodic
- Captures meaningful slices of interaction. AgentCore detects when an episode completes and consolidates its events into a compact, structured record, so the agent recalls a sequence rather than a static profile. Answers: what happened, in what order, and what came of it?
Episodic is the one worth knowing about, both because it is the newest and because it changes what you can claim. A support agent with a preference profile knows the customer likes email; a support agent with episodic memory knows this is the third time they have reported the same fault. That difference is the whole pitch for agents that improve with use.Four strategies and the reflection step, Built-in strategies and Episodic memory strategy. Retrieved 2026-08-24.
Three steps, and the third is new to most people
Strategies run in steps, and different strategies use different ones. Extraction identifies what is worth keeping. Consolidation decides whether that becomes a new record or updates an existing one. Reflection then works across episodes to surface patterns and higher-level conclusions — not what happened, but why it mattered and how it should change future behaviour.
Reflection is where the "learns from experience" claim actually lives. It is also where to be careful: AWS publishes no timing for it, so if a customer asks how quickly a lesson learned becomes available, that is a measure-it answer rather than a quote-a-number answer.
Newer than the lesson: structured data goes in directly
Since 20 August 2026 CreateEvent accepts a JSON payload
of up to 100 KB, not just conversation turns. Behavioural events, activity logs and
system events feed the extraction pipeline as-is, and it treats them the same way it
treats a conversation, across all four strategies. Available everywhere Memory is,
Canada included.Memory
now supports extracting memories from non-conversational JSON payloads, 20 August
2026. Retrieved 2026-08-24.
This removes a genuinely annoying workaround. Teams used to fake a transcript to get product-usage events into memory. If a customer has good behavioural data and a weak conversation history, that is now the better input.
Memory records are organised into namespaces, patterns
such as /users/{actorId}/preferences/.Strategy types,
namespaces, and the extraction and consolidation steps,
Configure
built-in strategies and
Memory
strategies. Retrieved 2026-08-05. That is the
mechanism behind the claim that memory stores can be shared between agents: two agents
pointed at the same namespace see the same accumulated understanding of a user. For a
startup running a support agent and a sales agent, that is the difference between one
coherent product and two that contradict each other.
Don't overclaim
AWS does not publish extraction latency, how long consolidation takes to make a new fact retrievable, or any accuracy figure for the built-in strategies. If a customer asks "will it remember the right things," the honest answer is that it depends on their domain and is worth measuring with Evaluations, which is Lesson 5, rather than assuming.
Read this next: 6 minutes
AgentCore Developer Guide: Built-in strategies
The page that names all four strategies and the three processing
steps, with a page per strategy behind it. Read
Episodic
memory strategy next, since it is the one customers have not heard of.
Retrieved 2026-08-24. Note the docs restructured in
August: long-term-memory.html now serves a generic overview, so older
links to it no longer land on the strategy detail.
Retrieval practice
Four questions. Question three interleaves Lesson 2 on purpose, because it is the confusion customers make most often.
-
What does AgentCore long-term memory actually persist across sessions?
Answer: B. Extracted insight, not raw turns.
-
A Canadian customer needs memory inference to stay in-region. Which tier do you recommend?
Answer: C. Built-in with overrides, cheaper and in-region.
-
A customer says "if sessions are isolated, how can the agent remember me?" What is the resolution?
Answer: A. Different boundaries. Isolation is compute; Memory is deliberate persistence.
-
In the worked support-agent sketch, which single change saves the most money?
Answer: B (halving retrievals per turn).
Where to go next
You can now explain to a founder what their agent will remember, how it decides what to keep, roughly what it will cost per thousand sessions, and which tier to pick if they care about residency.
Lesson 5 answers the question that separates a good AgentCore conversation from a great one: how do you know the agent is actually any good, and how do you make it better on evidence rather than instinct?
Questions to take forward
- Sketch a namespace layout for a customer running two agents over one user base.
- Redo the retrieval-count arithmetic with a customer's real numbers instead of the illustrative ones.
- At what scale does the strategy choice stop mattering?