feat: add read_only flag to AgentCoreMemorySessionManager to disable ACM persistence#389
Open
mohanasudhan wants to merge 1 commit intoaws:mainfrom
Open
feat: add read_only flag to AgentCoreMemorySessionManager to disable ACM persistence#389mohanasudhan wants to merge 1 commit intoaws:mainfrom
mohanasudhan wants to merge 1 commit intoaws:mainfrom
Conversation
noorullr
reviewed
Apr 3, 2026
…l ACM persistence Add PersistenceMode enum (FULL | NONE) and persistence_mode config option to AgentCoreMemoryConfig. When set to NONE, disables persistence to AgentCore Memory (create_event calls) while keeping local session/agent state management and memory injection (LTM retrieval) working. This allows customers who only need memory injection into agent context without persisting agent state to set persistence_mode=PersistenceMode.NONE on their existing configuration.
f54d9b2 to
0be29f0
Compare
noorullr
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a
read_onlyoption toAgentCoreMemoryConfigthat disables persistence to AgentCore Memory (create_eventcalls) while keeping local session/agent state management and memory injection (LTM retrieval) working.Motivation
Resolves strands-agents/sdk-python#2020
The
AgentCoreMemorySessionManagercurrently persists agent state and injects memories. Customers who only need memory injection into agent context (without persisting agent state) had no way to opt out of persistence. This adds aread_only=Trueflag so existing customers can disable persistence with a single config change.Changes
config.py: Addedread_only: bool = Field(default=False)toAgentCoreMemoryConfigsession_manager.py: Guarded ACM write calls (create_event,delete_event) behindread_onlycheck while preserving local state management (validation, caching,append_messagetracking)What's guarded (ACM writes skipped when
read_only=True)create_session— skipscreate_event, still validates and returns sessioncreate_agent— skipscreate_event/buffering, still cachescreated_atupdate_agent— delegates tocreate_agent, cache lookup still workscreate_message— skipscreate_event/buffering, returns{}soappend_messagetracks local state_flush_messages_only/_flush_agent_states_only— no-opcreate_event+delete_event, still reads dataWhat's unaffected
read_session,read_agent,list_messages)retrieve_customer_context)Usage
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.