feat(strands-s3-vectors-memory): multi-agent memory isolation (v0.2.0)#30
Open
feat(strands-s3-vectors-memory): multi-agent memory isolation (v0.2.0)#30
Conversation
- Add agent_name param to store_memory (defaults to 'default')
- Add agent_name param to retrieve_memories ($and filter when set, plain user_id filter when None)
- Add init_agent enforcing agent.name at wiring time — raises ValueError if unset
- Update summary key to {user_id}_{agent_name}_summary_{hash}
- Add agent_name to stored vector metadata
- Bump version to 0.2.0
- Add TestInitAgent (raises on missing/empty agent.name, stores name) - Add agent_name tests to TestCloseSession (key format, metadata field) - Add agent_name tests to TestStoreMemory and TestRetrieveMemories - Add TestMultiAgentIsolation integration tests (isolation, own recall, cross-agent) - Add agent.name = 'test-agent' to mock_strands_agent fixture - Update integration conftest nonFilterableMetadataKeys to include stored_at
… example - Add multi-agent usage section to README with example and cross-agent pattern - Add multi-agent memory isolation section to plugin reference - Add 5 design decision rows covering agent scoping, isolation, key format, compound filter requirement, and cross-agent access constraints - Update nonFilterableMetadataKeys in all index creation commands to include stored_at - Add examples/multi_agent_orchestrator.py — 5-step demo showing orchestrator/ researcher isolation and cross-agent supervisor access via agent_name=None
Integration tests need S3_VECTOR_BUCKET_NAME, S3_VECTOR_TVM_ROLE_ARN, and an OIDC role — not available in CI. Run locally against real AWS resources.
… name - Replace shared instance var _agent_name with _cv_agent_name ContextVar so each agent invocation carries its own name — fixes isolation failure when multiple agents share the same plugin instance (last init_agent call was overwriting the shared var for all agents) - Capture _cv_agent_name before submitting to background thread in after_invocation — ContextVars do not propagate across thread boundaries - Pass agent_name as explicit arg to close_session_with_data - Detect Strands framework default name 'Strands Agents' in init_agent and raise ValueError — agent.name is never None in practice, the framework always sets it to this default when name= is not provided by the developer - Raise summary limit from 500 to 2000 chars and update prompt to request plain text (no markdown) to avoid truncated/formatted stored summaries
…est limits - Add name='test-agent' to _make_agent helper and TestConversationSummary setup in integration tests — Agent() without name= now raises ValueError - Add TestInitAgentEnforcement integration class with two tests against a real Agent() to catch mock-vs-reality gaps (MagicMock.name is settable to None but real Agent.name is never None — always 'Strands Agents' by default) - Update TestInitAgent unit tests: replace unreachable None case with the real-world 'Strands Agents' default case - Update summary length assertions from 500 to 2000 chars in unit and integration tests to match the raised prompt limit - Add name='assistant' to single_tenant_agent.py and multi_tenant_agent.py - Fix multi_agent_orchestrator.py example: use semantically distinct topics (budget vs coral reef) so isolation check is unambiguous
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.
Summary
Adds
agent.nameas a mandatory second memory scoping dimension so multiple agentssharing the same store don't overwrite or cross-contaminate each other's memories.
Commits
agent_namescoping in store/retrieve +init_agentenforcementBreaking changes
S3VectorMemoryPluginrequiresagent.name— raisesValueErrorif unsetagent_namewon't match agent-scoped queries