◈ AWS AGENTCORE BLUEPRINTS
PART II · CORE SERVICES · CHAPTER 10 / 36
TOCCONSULTING.FR
AMAZON BEDROCK / SERVICE DETAIL S03 MEMORY

AGENTCORE MEMORYPRACTICAL

CHAPTER 10 / 36
TOPIC create a memory, write events, retrieve
REV 2026.07
New to these words? Sheet 01-A "Key terms" defines session, namespace, and tool. Concept: chapter 09 "Memory".
IN PLAIN WORDS

You will create a memory, write a few chat messages into it, then read back both the raw messages and the facts the agent learned from them. Terms: strategy = the rule for what to remember (SEMANTIC keeps plain facts); actor id = the user; session id = the conversation; namespace = a folder-like path where memories are filed; top_k = how many results to return.

[ 1 ] INSTALL AND CREATE A PROJECT
$ pip install bedrock-agentcore $ npm install -g @aws/agentcore $ agentcore create --name agentcore-memory-quickstart --no-agent $ cd agentcore-memory-quickstart $ python -m venv .venv && source .venv/bin/activate
[x] AWS account (aws configure)
[x] Python 3.10+
[x] Node.js 18+ (for the CLI)
[ 2 ] STEP 1, CREATE A MEMORY WITH A SEMANTIC STRATEGY
$ agentcore add memory --name CustomerSupportSemantic --strategies SEMANTIC $ agentcore deploy # takes 2 to 3 minutes $ agentcore status # verify the memory was created
A memory accepts short-term events by default. A strategy (here SEMANTIC) is what turns them into long-term records.
[ 3 ] STEP 2 AND 3, WRITE EVENTS, THEN RETRIEVE (AgentCore SDK)
# write conversation turns (short-term)
import boto3
from bedrock_agentcore.memory import MemorySessionManager
from bedrock_agentcore.memory.constants import (
    ConversationalMessage, MessageRole)

ctrl = boto3.client('bedrock-agentcore-control',
                   region_name='us-west-2')
memory_id = ctrl.list_memories()['memories'][0]['id']

mgr = MemorySessionManager(memory_id=memory_id,
                            region_name="us-west-2")
session = mgr.create_memory_session(
    actor_id="User1", session_id="OrderSupportSession1")

session.add_turns(messages=[ConversationalMessage(
    "How can I help you today?", MessageRole.ASSISTANT)])
session.add_turns(messages=[ConversationalMessage(
    "My order #35476 has not arrived.", MessageRole.USER)])

turns = session.get_last_k_turns(k=5)        # read short-term
# retrieve from long-term memory

# all records under a namespace path
records = session.list_long_term_memory_records(
    namespace_path="/")

# or a semantic search
records = session.search_long_term_memories(
    query="summarize the support issue",
    namespace_path="/",
    top_k=3,
)

for r in records:
    print(r)
Under the hood these call CreateEvent (short-term) and RetrieveMemoryRecords (semantic, cosine relevance). Long-term extraction runs asynchronously, so allow a short delay before records appear.
[ 4 ] WIRE MEMORY INTO A STRANDS AGENT, AND CLEAN UP
$ agentcore add memory --name MyMemory \ --strategies SEMANTIC,SUMMARIZATION $ agentcore deploy # cleanup when done: $ agentcore remove memory --name CustomerSupportSemantic $ agentcore deploy
# app/MyAgent/memory/session.py (Strands integration)
from bedrock_agentcore.memory.integrations.strands.session_manager \
    import AgentCoreMemorySessionManager
from bedrock_agentcore.memory.integrations.strands.config \
    import AgentCoreMemoryConfig, RetrievalConfig

# env var MEMORY_MYMEMORY_ID is injected at runtime
# pass the manager to your agent in main.py:
#   Agent(model=..., session_manager=get_memory_session_manager(...))
SRC: AWS AgentCore Developer Guide (get started with AgentCore Memory, retrieve records)
DRAWN 2026.06, REV 2026.07.26
◄ PREVIOUS · CH 09
AgentCore Memory, Plain Language
NEXT · CH 11 ►
AgentCore Gateway, Plain Language
AWS AGENTCORE BLUEPRINTS · CONTENTS
Back to tocconsulting.fr Cover & Table of Contents
PART I · FOUNDATIONS
01AgentCore Overview, Plain LanguageCONCEPT02AgentCore, Key Terms in Plain LanguageCONCEPT03AgentCore, Common Mistakes ExplainedCONCEPT04Inside an AgentCore Agent, BlueprintCONCEPT05Harness, Practical 1, Strands PathPRACTICAL06Harness, Practical 2, Managed HarnessPRACTICAL
PART II · CORE SERVICES
07AgentCore Runtime, Plain LanguageCONCEPT08AgentCore Runtime, PracticalPRACTICAL09AgentCore Memory, Plain LanguageCONCEPT10AgentCore Memory, PracticalPRACTICAL11AgentCore Gateway, Plain LanguageCONCEPT12AgentCore Gateway, PracticalPRACTICAL13AgentCore Identity, Plain LanguageCONCEPT14AgentCore Identity, PracticalPRACTICAL
PART III · TOOLS AND OPERATIONS
15AgentCore Code Interpreter, Plain LanguageCONCEPT16AgentCore Code Interpreter, PracticalPRACTICAL17AgentCore Browser, Plain LanguageCONCEPT18AgentCore Browser, PracticalPRACTICAL19AgentCore Observability, Plain LanguageCONCEPT20AgentCore Observability, PracticalPRACTICAL21AgentCore Evaluations, Plain LanguageCONCEPT22AgentCore Evaluations, PracticalPRACTICAL
PART IV · GOVERNANCE AND TRANSACTIONS
23AgentCore Policy, Plain LanguageCONCEPT24AgentCore Policy, PracticalPRACTICAL25AgentCore Registry, Plain LanguageCONCEPT26AgentCore Registry, PracticalPRACTICAL27AgentCore Payments, Plain LanguageCONCEPT28AgentCore Payments, PracticalPRACTICAL
PART V · MULTI-AGENT AND ARCHITECTURE
29A2A and Multi-Agent, Plain LanguageCONCEPT30A2A and Multi-Agent, PracticalPRACTICAL31Architecture Patterns, Plain LanguageCONCEPT32Multi-Tenant Agents, Plain LanguageCONCEPT33Agent Security and Threat Model, Plain LanguageCONCEPT34Governance at Org Scale, Plain LanguageCONCEPT35Governance at Org Scale, PracticalPRACTICAL36Multi-Region and Distribution, Plain LanguageCONCEPT