Skip to content

feat(memory): add streamDeliveryResources support to memory SDK#302

Merged
Hweinstock merged 1 commit into
aws:mainfrom
Hweinstock:feature/stream-delivery-resources
Mar 10, 2026
Merged

feat(memory): add streamDeliveryResources support to memory SDK#302
Hweinstock merged 1 commit into
aws:mainfrom
Hweinstock:feature/stream-delivery-resources

Conversation

@Hweinstock

Copy link
Copy Markdown
Contributor

Issue #, if available: N/A

Description of changes:

Problem

Customers must poll memory APIs to detect new records. The service now supports streamDeliveryResources for push-based delivery to Kinesis, but the Python SDK doesn't expose this parameter.

Solution

Added stream_delivery_resources parameter to:

  • controlplane.py: create_memory(), update_memory()
  • client.py: create_memory(), create_memory_and_wait(), create_or_get_memory()

Passed through as streamDeliveryResources in the boto3 call.

Updated to botocore 1.42.63 which includes the service model.

Testing

  • Unit tests: test_create_memory_with_stream_delivery and test_update_memory_with_stream_delivery in tests/bedrock_agentcore/memory/test_controlplane.py
  • Manual e2e: Created IAM role + Kinesis stream, verified create (FULL_CONTENT), update (changed to METADATA_ONLY), get (returns updated config), and delete — all successful

local code used to test:

import time
from bedrock_agentcore.memory.controlplane import MemoryControlPlaneClient
c = MemoryControlPlaneClient()
account_id =...
region = ...

delivery_config = {
    'resources': [{
        'kinesis': {
            'dataStreamArn': f'arn:aws:kinesis:{region}:{account_id}:stream/test-memory-stream',
            'contentConfigurations': [{'type': 'MEMORY_RECORDS', 'level': 'FULL_CONTENT'}],
        }
    }]
}

memory = c.create_memory(
    name='test_stream_e2e',
    memory_execution_role_arn=f'arn:aws:iam::{account_id}:role/test-memory-stream-delivery-role',
    stream_delivery_resources=delivery_config,
)
memory_id = memory['id']
print('CREATE - id:', memory_id)
print('CREATE - streamDeliveryResources:', memory.get('streamDeliveryResources'))

print('\nWaiting for ACTIVE...')
for i in range(30):
    m = c.get_memory(memory_id)
    if m['status'] == 'ACTIVE':
        print(f'ACTIVE after {i*10}s')
        break
    time.sleep(10)

updated_config = {
    'resources': [{
        'kinesis': {
            'dataStreamArn': f'arn:aws:kinesis:{region}:{account_id}:stream/test-memory-stream',
            'contentConfigurations': [{'type': 'MEMORY_RECORDS', 'level': 'METADATA_ONLY'}],
        }
    }]
}
updated = c.update_memory(memory_id=memory_id, stream_delivery_resources=updated_config)
print('\nUPDATE - streamDeliveryResources:', updated.get('streamDeliveryResources'))

details = c.get_memory(memory_id)
print('GET    - streamDeliveryResources:', details.get('streamDeliveryResources'))
print('\nMemory', memory_id, 'left running.')

Notes

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Hweinstock Hweinstock force-pushed the feature/stream-delivery-resources branch from eaf489f to ca0bc60 Compare March 9, 2026 21:19
@Hweinstock Hweinstock changed the title feat: add streamDeliveryResources support to memory SDK feat(memory): add streamDeliveryResources support to memory SDK Mar 9, 2026
@Hweinstock Hweinstock marked this pull request as ready for review March 9, 2026 21:24
@Hweinstock Hweinstock requested a review from a team March 9, 2026 21:24
@codecov-commenter

codecov-commenter commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@17e1357). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/bedrock_agentcore/memory/client.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #302   +/-   ##
=======================================
  Coverage        ?   91.28%           
=======================================
  Files           ?       38           
  Lines           ?     3880           
  Branches        ?      588           
=======================================
  Hits            ?     3542           
  Misses          ?      184           
  Partials        ?      154           
Flag Coverage Δ
unittests 91.28% <66.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hweinstock Hweinstock merged commit 907f816 into aws:main Mar 10, 2026
18 checks passed
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.

3 participants