Amazon Bedrock AgentCore - Memory | Amazon Web Services
Skills:
Agent Foundations80%
Key Takeaways
Configures AgentCore Memory for short-term and long-term context using the AgentCore SDK
Full Transcript
Hello everyone. As part of the Amazon Bedrock agent core video series, we are going to cover agent core memory. As part of this video, so let's start with a simple scenario that describes the problem that we are trying to solve. Imagine you are talking to a tech support agent about an issue with your computer. You spend around 30 minutes explaining your problem. The agent suggests some workarounds and then you hang up. A week later, you call back the agent again because none of the solution worked. But here is the problem. Because the agent is stateless, it has completely forgotten everything you discussed previously. So you have to start over again explaining the same issue all over again. This is exactly what memory aims to solve. It provides a mechanism to store and retrieve relevant agent experiences during runtime creating a personalization layer between agents and the users. So let's go back to our tech support example. So when you first call in the agent suggests workarounds and stores the entire interactions in the memory. Now when you call back the next time hey none of those workarounds actually worked the memory system kicks in. It provides the agent the context of your previous conversation what was tried before what did not work and what kind of solutions were suggested. Now the agent can pivot intelligently saying so I see those previous workarounds didn't help. Let's try something different this time. So this gives us a several key benefits. First, the context retention across sessions. The agent remembers your history. Second, the improved decision quality over time. It learns what worked and what did not. Third, reduced processing and latency. No need to research the same solution repeatedly. Finally, the personalization at scale. The agent learns about each user individually. So we can split the memory into two broad categories. First is short-term memory. This is essentially a collection of raw events like user messages or tool calls and assistant responses. It also handles session management and conversation branching. Think of it like you have the ability to go back and edit the previous message and create a new conversation branch. The short-term memory gets updated accordingly. So for example, you looking for flight tickets from Atlanta to New York and then you change your mind to change the destination to New Jersey. So memory gets updated accordingly based on the new edits. So that is short-term memory. The second category is the long-term memory which extracts meaningful and actionable information from those raw events. For example, if you keep asking your agent to generate code in camel case, it might learn that as a user preference. Or if you buy a grand latte at Starbucks three times a week, it extracts I buy coffee three times a week as a semantic fact. While I like grande becomes a user preference. At a very high level, here is how it works. Like know user interactions first goes into the short-term memory storage. Then an offline workflow extracts meaningful information based on specified strategies whether that's user preferences or semantic facts or session summaries. Finally, a consolidation phase manages these memories over time, dduplicating, merging or updating information to maintain accuracy. So, memory transforms AI agents from stateless tools into intelligent assistant that learns and adapt over time, making every interaction more personalized and effective. So, with this, we'll go into the code walkthrough in the demo. First import the memory client from the bedrock agent core. Then define the memory name. Then create memory using memory client by passing the memory name uh description event expiry date which defines the TTL like know time to live. In this case it's 7 days and the poll interval which checks the status in regular interval. In this case it's for every 10 seconds. You can see that the memory got created in the console. Next, we create the langraph agent. This function creates a langraph based fitness coach agent that integrates with agent core memory for conversation persistence. It sets up a chat bedrock lm with clots on it. defines the list events tool for retrieving conversation history and builds a graph for flow that automatically saves user assistant exchanges to memory while providing personalized fitness guidance based on remembered context. Then we define the actor ID and the session ID. These ids ensure each conversation session is uniquely tracked in the memory system allowing the agent to maintain separate conversation history for different users and workout sessions. Then we do couple of interactions with the workout routine. All these conversations are getting saved in the short-term memory. Next, we will test the short-term memory retrieval functionality by creating a new agent instance using the same actor ID and the session ID. This demonstrates like no session continuity. When we ask about the previous interaction, the agent successfully retrieves the conversation history from the memory and provides contextually relevant responses based on the earlier exchanges. Next, we will go through the long-term memory. First we will define the memory name. Then let's create a memory using the memory client by passing the memory name, description, event expiry date, the poll interval. The main difference here is we also pass the strategy and the name space. As I mentioned earlier, there are three kinds of strategies. The user preferences, semantic facts or the session summaries. The name spaces the memory system uses an hierarchical structure similar to S3 storage like know where extracted information is organized under the specific path using runtime variables like um actor ID, the strategy ID or the session ID ensuring like know complete data separation between users and preventing information leakages across different user sessions. Then we define the actor ID, the session ID and the name space. These three IDs ensure each conversation session is uniquely tracked in the memory system allowing the agent to maintain separate conversation histories for different users and work sessions. Here we are just mocking up some previous conversations and adding all those to the short-term memory. This one adds everything to the short-term memory. when we list all the events it displays all the previous mocked up conversations. So behind the scenes you know you know after the create event call is done the memory system detects that the memory has the user preference strategy configured. So without any additional coding, the system analyzes the conversation for the preference indicators, identifies the statements like like uh I am a vegetarian and I really enjoy Italian cuisines and extract these preferences into structured data. The extracted preferences are saved in the configured name space. This automatic process ensures that important information is preserved in the long-term memory even after the short-term memory conversation records expires. Now when you try to retrieve the content like foot preferences from the memory, you can see the context and the user preferences. So when you ask for the restaurant recommendations in your wine based on the user preferences, it was able to provide the appropriate restaurant suggestions in your wine. So that's the end of this code walkthrough of agent code memory. Thanks.
Original Description
Episode 5 of 8-part series on Amazon Bedrock AgentCore - Memory In this video, you’ll explore AgentCore Memory, the service that enables your agents to remember both short‑term and long‑term context, so they can deliver personalized and coherent interactions across sessions. You’ll see:
How to create and manage memory resources using the AgentCore SDK, including setting up short‑term memory for in-session context and long‑term memory for semantic facts and user preferences.
A code walkthrough showing how to use MemoryClient to create memories, store conversation events, load previous interactions, and apply strategies like semantic memory, session summaries, or user preference extraction.
How memory events are automatically logged and metrics like latency, invocation count, spans, and error metrics are emitted to CloudWatch for observability and debugging.
Subscribe to AWS: https://go.aws/subscribe
Sign up for AWS: https://go.aws/signup
AWS free tier: https://go.aws/free
Explore more: https://go.aws/more
Contact AWS: https://go.aws/contact
Next steps:
Explore on AWS in Analyst Research: https://go.aws/reports
Discover, deploy, and manage software that runs on AWS: https://go.aws/marketplace
Join the AWS Partner Network: https://go.aws/partners
Learn more on how Amazon builds and operates software: https://go.aws/library
Do you have technical AWS questions?
Ask the community of experts on AWS re:Post: https://go.aws/3lPaoPb
Why AWS?
Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud. Millions of customers—including the fastest-growing startups, largest enterprises, and leading government agencies—use AWS to be more agile, lower costs, and innovate faster.
#AWS #AmazonWebServices #CloudComputing
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Amazon Web Services · Amazon Web Services · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Agentic AI Design Patterns Introduction and walkthrough | Amazon Web Services
Amazon Web Services
Galileo on modernizing on banking infrastructure | Amazon Web Services
Amazon Web Services
Alliander Speeds Innovation and Energy Transition Using AWS | Amazon Web Services
Amazon Web Services
AWS and Scuderia Ferrari HP streamline F1 power unit assembly | Amazon Web Services
Amazon Web Services
How AWS machine learning supports Scuderia Ferrari HP pit stops | Amazon Web Services
Amazon Web Services
Nasdaq Builds Market Infrastructure of the Future with AWS | Amazon Web Services
Amazon Web Services
AWS Security Hub Exposure Findings | Amazon Web Services
Amazon Web Services
How do I use Session Manager port forwarding to connect to my EC2 instance through RDP?
Amazon Web Services
How do I extend an EBS volume with LVM partitions?
Amazon Web Services
AWS Graviton makes it easy to optimize performance, cost, and sustainability | Amazon Web Services
Amazon Web Services
Run Cloud Adoption Framework workshops with Miro | Amazon Web Services
Amazon Web Services
Getting Started with AWS Cost Optimization Hub | Amazon Web Services
Amazon Web Services
Why did my Amazon SQS messages get sent to a dead-letter queue?
Amazon Web Services
Declarative Policies for EC2 | Amazon Web Services
Amazon Web Services
How do I troubleshoot IAM permission issues for the Billing and Cost Management console?
Amazon Web Services
Integrity at Scale: Inside the Flo Health Mission | Amazon Web Services
Amazon Web Services
Fueling Success: Small shifts, powerful performance | Amazon Web Services
Amazon Web Services
WEX enhances customer experience with AI-powered chatbot | Amazon Web Services
Amazon Web Services
Accelerate troubleshooting with Amazon CloudWatch investigations | Amazon Web Services
Amazon Web Services
Why is my Windows WorkSpace stuck in the starting, rebooting, or stopping status?
Amazon Web Services
Telemetry Pipelines for AI | Amazon Web Services
Amazon Web Services
Getting Control over Security and Observability Data | Amazon Web Services
Amazon Web Services
The Problem with Telemetry Data Volume | Amazon Web Services
Amazon Web Services
Telemetry Pipelines on AWS | Amazon Web Services
Amazon Web Services
What are Telemetry Pipelines? | Amazon Web Services
Amazon Web Services
Using AI for RegEx on Telemetry Pipelines | Amazon Web Services
Amazon Web Services
Multi-Session Support in the AWS Console | Amazon Web Services
Amazon Web Services
How CloudHedge delivers assessment with AWS ISV Tooling Program at no cost?
Amazon Web Services
How customers speed up migration and modernization to AWS with CloudHedge | Amazon Web Services
Amazon Web Services
Chaos Experiment with Amazon ElastiCache | Amazon Web Services
Amazon Web Services
Amazon S3 Access Points: Easily manage access for shared datasets on S3 | Amazon Web Services
Amazon Web Services
ElastiCache Valkey 8.0 - Savings and Efficiency | Amazon Web Services
Amazon Web Services
Pennymac scales document processing with AWS | Amazon Web Services
Amazon Web Services
AWS | Next Level Innovation | Amazon Web Services
Amazon Web Services
Driving Cloud Innovation: Mindtickle's Partnership with AWS Enterprise Support | Amazon Web Services
Amazon Web Services
A Leader's Edge from Executive Insights | Amazon Web Services
Amazon Web Services
How do I create a custom Amazon WorkSpaces image?
Amazon Web Services
Charles Leclerc tests his AI-generated race track | Amazon Web Services
Amazon Web Services
Redington Scales India’s Cloud Access with AWS Partnership | Amazon Web Services
Amazon Web Services
How do I prevent the resources in my CloudFormation stack from getting deleted or updated?
Amazon Web Services
How do I troubleshoot authentication errors when I use RDP to connect to an EC2 Windows instance?
Amazon Web Services
Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Amazon Web Services
Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Amazon Web Services
AWS at the FORMULA 1 AWS GRAN PREMIO DELL'EMILIA-ROMAGNA 2025 | Amazon Web Services
Amazon Web Services
What's new in RCPs | Amazon Web Services
Amazon Web Services
API Caching using Amazon ElastiCache | Amazon Web Services
Amazon Web Services
Pendula: Amazon Nova Customer Testimonial | Amazon Web Services
Amazon Web Services
InDebted : Amazon Nova Customer Testimonial | Amazon Web Services
Amazon Web Services
Amazon DynamoDB global tables with multi-Region strong consistency | Amazon Web Services
Amazon Web Services
Siemens Mobility uses AWS to operate securely, efficiently on a global scale | Amazon Web Services
Amazon Web Services
How do I reuse a knowledge base session in Amazon Bedrock?
Amazon Web Services
EP5: MBZUAI, CMU : Causal AI, Answering The “Why“ and “What if“ Questions | AWS for AI Podcast
Amazon Web Services
Hema scales time to market developing a data mesh on AWS (Technical) - Cloud Adventures
Amazon Web Services
Hema scales time to market developing a data mesh on AWS (Business) - Cloud Adventures
Amazon Web Services
How Langfuse Scaled Their AI Platform with AWS: From Open-Source to Enterprise | Amazon Web Services
Amazon Web Services
SLMs and LLMs: What’s the Difference? | Amazon Web Services
Amazon Web Services
SLMs and LLMs: When to use them? | Amazon Web Services
Amazon Web Services
SLMs on CPU | Amazon Web Services
Amazon Web Services
Intelligent Model Routing | Amazon Web Services
Amazon Web Services
SLMs, LLMs, and Model Routing in Agents | Amazon Web Services
Amazon Web Services
More on: Agent Foundations
View skill →Related Reads
📰
📰
📰
📰
Terraform Cloudflare DNS Checklist Before Every Apply
Dev.to · Oleksandr Kuryzhev
Building a Windows Laptop Monitoring Agent with Webex and Email Alerts
Dev.to · sam codex
What Is Infrastructure as Code? A Beginner's Guide
Dev.to · Muskan Bandta
I just released SKTR, a deterministic architecture review CLI
Dev.to · Pablo Rubianes 🇺🇾
🎓
Tutor Explanation
DeepCamp AI