Deprecate MemoryControlPlaneClient with per-method migration warnings#262
Deprecate MemoryControlPlaneClient with per-method migration warnings#262
Conversation
MemoryControlPlaneClient and MemoryClient have significant functional overlap. MemoryClient is a superset that provides all control plane operations plus data plane features, response normalization, and typed strategy helpers. Maintaining both creates a maintenance burden and user confusion. This refactors MemoryControlPlaneClient to be a thin pass-through that delegates all operations to an internal MemoryClient instance, and emits a DeprecationWarning on instantiation directing users to migrate. Closes #247
7e81382 to
2bfcf89
Compare
| return self._memory_client.gmcp_client | ||
|
|
||
| logger.info("Initialized MemoryControlPlaneClient for %s in %s", environment, region_name) | ||
| @client.setter |
There was a problem hiding this comment.
no setters allowed. Pass the boto3 client inside the constructors in a backwards compatiable way.
| break | ||
|
|
||
| # Add strategy count to each memory summary | ||
| for memory in memories: |
There was a problem hiding this comment.
this adds a strategy count. Does the MemoryClient have that? Make sure they return the same structured dictionary.
| check_strategies=True, | ||
| ) | ||
| start_time = time.time() | ||
| while time.time() - start_time < max_wait: |
There was a problem hiding this comment.
Doesn't memory client has wait_for_memory()?
| raise | ||
|
|
||
| raise TimeoutError(f"Memory {memory_id} was not deleted within {max_wait} seconds") | ||
| return self._memory_client.delete_memory(memory_id=memory_id) |
There was a problem hiding this comment.
Please check all the returns to make sure it returns the same dicti.
Keep original implementation (no pass-through to MemoryClient) to preserve exact return value contracts. Add deprecation warnings to __init__ and every public method with specific MemoryClient migration suggestions. Add client= constructor parameter for backward-compatible boto3 client injection. Closes #247
Customer-facing deprecation warningsHere's what users will see when running with from bedrock_agentcore.memory.controlplane import MemoryControlPlaneClient
client = MemoryControlPlaneClient()
# DeprecationWarning: MemoryControlPlaneClient is deprecated and will be removed in v1.4.0.
# Use MemoryClient instead, which provides all control plane operations plus data plane
# features. See: https://github.com/aws/bedrock-agentcore-sdk-python/issues/247
client.create_memory(name="my-memory")
# DeprecationWarning: MemoryControlPlaneClient.create_memory() is deprecated.
# Use MemoryClient.create_memory() or create_memory_and_wait() instead.
# See: https://github.com/aws/bedrock-agentcore-sdk-python/issues/247
client.get_memory("mem-abc123")
# DeprecationWarning: MemoryControlPlaneClient.get_memory() is deprecated.
# Use MemoryClient.get_memory(memoryId=...) or get_memory_strategies() instead.
# See: https://github.com/aws/bedrock-agentcore-sdk-python/issues/247
client.list_memories()
# DeprecationWarning: MemoryControlPlaneClient.list_memories() is deprecated.
# Use MemoryClient.list_memories() instead.
# See: https://github.com/aws/bedrock-agentcore-sdk-python/issues/247
client.delete_memory("mem-abc123")
# DeprecationWarning: MemoryControlPlaneClient.delete_memory() is deprecated.
# Use MemoryClient.delete_memory() or delete_memory_and_wait() instead.
# See: https://github.com/aws/bedrock-agentcore-sdk-python/issues/247Each warning points to the specific |
Customer-facing deprecation warningsHere's what users will see when running with from bedrock_agentcore.memory.controlplane import MemoryControlPlaneClient
client = MemoryControlPlaneClient()
# DeprecationWarning: MemoryControlPlaneClient is deprecated and will be removed in v1.4.0.
# Use MemoryClient instead, which provides all control plane operations plus data plane features.
client.create_memory(name="my-memory")
# DeprecationWarning: MemoryControlPlaneClient.create_memory() is deprecated.
# Use MemoryClient.create_memory() or create_memory_and_wait() instead.
client.get_memory("mem-abc123")
# DeprecationWarning: MemoryControlPlaneClient.get_memory() is deprecated.
# Use MemoryClient.get_memory(memoryId=...) or get_memory_strategies() instead.
client.list_memories()
# DeprecationWarning: MemoryControlPlaneClient.list_memories() is deprecated.
# Use MemoryClient.list_memories() instead.
client.delete_memory("mem-abc123")
# DeprecationWarning: MemoryControlPlaneClient.delete_memory() is deprecated.
# Use MemoryClient.delete_memory() or delete_memory_and_wait() instead.Each warning points to the specific |
Summary
MemoryControlPlaneClient.__init__()indicating removal in v1.4.0client=constructor parameter for backward-compatible boto3 client injection (no property getter/setter)Approach
Adds deprecation warnings that guide users to the correct
MemoryClientequivalent for each method.Closes #247
Customer experience
Each method emits its own warning pointing to the specific
MemoryClientequivalent.Test plan
test_deprecation_warningverifies class-level warning on inittest_method_deprecation_warningsverifies each public method emits its own warning withMemoryClientsuggestiontest_constructor_client_paramandtest_constructor_default_clientverify constructor injection