AWS has published a deployable workflow for managing what long-running Bedrock AgentCore agents remember. The design runs nightly through Step Functions, expires old records, scores what remains and uses a language model to consolidate related memories before deleting the originals.

The approach separates memory into three types. Episodic records describe past conversations and are the first candidates for expiration. Semantic memory contains compact facts and preferences that should last longer. Procedural memory stores learned workflows and receives the highest bar for removal because it can shape how an agent uses tools.

The example starts with a 90-day expiration limit for episodic data, then calculates relevance from a record’s age, most recent access and total access count. Because AgentCore records do not expose a last-access field, the architecture captures retrieval events in CloudTrail and maintains a cumulative access ledger in S3. Thresholds and weights can be adjusted for different workloads.

Low-scoring records may be merged into a concise semantic entry by a Bedrock model. If consolidation fails, the originals are retained; successful consolidation is still lossy and requires monitoring. AgentCore does not provide built-in automatic deletion based on time to live, so the workflow calls its listing and deletion APIs directly. Teams must set retention periods around their own legal, operational and audit requirements rather than copying the example defaults unchanged.