feat(agent-memory): multitenancy via per-tenant bindings#232
Merged
cassiofariasmachado merged 10 commits intoJul 16, 2026
Merged
Conversation
- create_client() and AgentMemoryClient.__init__ accept access_strategy (default SUBSCRIBER_ONLY) and tenant as constructor params - _resolve_tenant is now an instance method; per-call params override instance defaults - All method signatures change to Optional[AccessStrategy] = None (sentinel: use instance default) - user-guide: add client-level configuration section and PROVIDER_ONLY isolation warning - tests: update TestAccessStrategy and TestCreateClient for instance method
…for tenant isolation
- Add _load_config_for_instance(instance) to config.py — loads secrets
from /etc/secrets/appfnd/hana-agent-memory/{instance}/ following the
same pattern as the destination module
- Refactor AgentMemoryClient to maintain a per-tenant HttpTransport cache:
provider binding ('default') and subscriber bindings (one per tenant)
are each loaded into their own transport and lazily cached
- create_client() selects the initial binding based on access_strategy and
tenant, and wires config_loader for per-call tenant override support
- Integration test conftest now skips subscriber tests when the tenant
binding itself is not configured (not just the tenant name env var)
- Unit tests cover _load_config_for_instance, _get_transport routing,
per-call binding cache, and create_client() factory wiring
… warning - SUBSCRIBER_ONLY → SUBSCRIBER, PROVIDER_ONLY → PROVIDER across all agent_memory source, tests, feature files, and user guide - Add logger.warning() when AccessStrategy.PROVIDER is used, making the no-isolation behaviour explicit at runtime
NicoleMGomes
previously approved these changes
Jul 15, 2026
NicoleMGomes
previously approved these changes
Jul 16, 2026
NicoleMGomes
previously approved these changes
Jul 16, 2026
NicoleMGomes
approved these changes
Jul 16, 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
Adds multitenancy support to the
agent_memorymodule via a per-tenant binding approach. The runtime provisions one dedicated service instance per tenant, mounted at/etc/secrets/appfnd/hana-agent-memory/<tenant-subdomain>/. Each tenant gets its ownHttpTransportloaded from its binding atcreate_client()time.How it works
access_strategyandtenantare configured once atcreate_client()time — they are not parameters on individual methods. TheAgentMemoryClientsimply holds a single_transportresolved at construction.Key changes
AccessStrategyenum (SUBSCRIBER/PROVIDER) — configured atcreate_client()_load_config_for_instance(instance)inconfig.py— loads any named binding instance via the secret resolver (mirrors thedestinationmodule's pattern)AgentMemoryClientsimplified: single_transportfield, noconfig_loader, no per-call overrides, validation at construction timelogger.warning()onAccessStrategy.PROVIDERconstruction — surfaces the no-isolation riskRelated Issue
Closes #
Type of Change
How to Test
Checklist
Breaking Changes
Migration:
Additional Notes
create_client()binding logic changes, zero changes to caller code.logger.warning()is emitted atAgentMemoryClientconstruction time whenPROVIDERis used.