feat: add ReadOnlySessionManager wrapper for read-only sessions#2023
Open
mohanasudhan wants to merge 1 commit intostrands-agents:mainfrom
Open
feat: add ReadOnlySessionManager wrapper for read-only sessions#2023mohanasudhan wants to merge 1 commit intostrands-agents:mainfrom
mohanasudhan wants to merge 1 commit intostrands-agents:mainfrom
Conversation
da1c176 to
80da9e8
Compare
80da9e8 to
843385a
Compare
843385a to
60f5181
Compare
60f5181 to
f397c14
Compare
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.
Motivation
In multi-tenant systems, agents often need to load shared session context (conversation history, state) without persisting per-request interactions back to storage. Currently there's no way to use a session manager in a read-only capacity — all session managers write on every lifecycle event.
This PR introduces a
ReadOnlySessionManagerwrapper that delegates read operations (initialize, restore state) to any inner session manager while no-oping all write operations (append, sync, redact). Read-only enforcement lives entirely at the SessionManager level, meaning all write calls are blocked regardless of caller — Agent hooks, direct calls, or custom code.Resolves: #2020
Public API Changes
New
ReadOnlySessionManagerclass wraps any existing session manager:The wrapper is a
SessionManagersubclass, so it works anywhere a session manager is accepted. The inner session manager is accessible via_innerfor inspection. No changes toSessionManager,Agent, or any concrete session manager implementation.Use Cases