Skip to content

feat(strands-s3-vectors-memory): multi-agent memory isolation (v0.2.0)#30

Open
nihilg wants to merge 6 commits intomainfrom
feat/multi-agent-memory-support
Open

feat(strands-s3-vectors-memory): multi-agent memory isolation (v0.2.0)#30
nihilg wants to merge 6 commits intomainfrom
feat/multi-agent-memory-support

Conversation

@nihilg
Copy link
Copy Markdown
Contributor

@nihilg nihilg commented Apr 3, 2026

Summary

Adds agent.name as a mandatory second memory scoping dimension so multiple agents
sharing the same store don't overwrite or cross-contaminate each other's memories.

Commits

  1. feat — core agent_name scoping in store/retrieve + init_agent enforcement
  2. test — 128 unit tests passing, 35 integration tests passing (run locally)
  3. docs — multi-agent usage, isolation section, design decisions, and orchestrator example
  4. ci — unit-tests only in CI

Breaking changes

  • S3VectorMemoryPlugin requires agent.name — raises ValueError if unset
  • Existing vectors without agent_name won't match agent-scoped queries

nihilg added 4 commits April 3, 2026 12:18
- 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.
nihilg added 2 commits April 3, 2026 13:33
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants