feat(agent-memory): add access_strategy and tenant params for multitenancy#222
Draft
cassiofariasmachado wants to merge 6 commits into
Draft
feat(agent-memory): add access_strategy and tenant params for multitenancy#222cassiofariasmachado wants to merge 6 commits into
cassiofariasmachado wants to merge 6 commits into
Conversation
GAMAURER
reviewed
Jul 14, 2026
| | Value | Description | | ||
| | --------------------------- | ------------------------------------------------------------------ | | ||
| | `SUBSCRIBER_ONLY` (default) | Reads and writes against the subscriber tenant. Requires `tenant`. | | ||
| | `PROVIDER_ONLY` | Reads and writes against the provider tenant. No `tenant` needed. | |
There was a problem hiding this comment.
I think it might be useful to note that there is no tenant isolation in this case, just to make the consequences of enabling provider very clear.
Member
Author
There was a problem hiding this comment.
Done. I've updated the documentation to make it clear.
- 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
3282daf to
db9ba9b
Compare
15 tasks
… 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
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. Implements AFSDK-4011.AccessStrategy controls which tenant token is used for every operation:
SUBSCRIBER(default) — fetches a subscriber-scoped OAuth2 token using the providedtenantsubdomain. The subscriber token URL is derived by replacing the provider'sidentityzoneintoken_url. RaisesAgentMemoryValidationErrorif no tenant is available.PROVIDER— uses the provider token; notenantrequired.logger.warning()on every call — no tenant isolation applies.Two ways to configure:
create_client(), inherited by all calls):Per-call params always override the client-level default.
Code review changes
SUBSCRIBER_ONLY/PROVIDER_ONLYrenamed toSUBSCRIBER/PROVIDERfor brevitylogger.warning()emitted wheneverAccessStrategy.PROVIDERis resolved, making the no-isolation risk explicit at runtimeBreaking change:
create_client()with no args raisesAgentMemoryConfigError(defaultSUBSCRIBERrequirestenant). Migration:Related Issue
Closes #
Type of Change
How to Test
pytest tests/agent_memory/unit/— 256 tests passpytest tests/agent_memory/integration/— 14 pass, 12 skipCLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_SUBSCRIBER_TENANT=<subdomain> pytest tests/agent_memory/integration/— 26 passChecklist
Breaking Changes
What breaks:
create_client()with no args raisesAgentMemoryConfigError.Migration:
Additional Notes
HttpTransport._oauth_cache.identityzonefield is parsed from the UAA JSON binding and stored inAgentMemoryConfig. It is used to derive the subscriber token URL via string replacement, following the pattern used in thedestinationmodule.Given I use the configured subscriber tenantstep to flip the strategy — all scenario step implementations are shared (no duplication).