Skip to content

fix(memory): use current Strands bidi session hooks - #664

Open
pgrayy wants to merge 1 commit into
aws:mainfrom
pgrayy:agent-tasks/fix-strands-bidi-hooks
Open

pgrayy wants to merge 1 commit into
aws:mainfrom
pgrayy:agent-tasks/fix-strands-bidi-hooks

Conversation

@pgrayy

@pgrayy pgrayy commented Sep 16, 2026

Copy link
Copy Markdown

Issue #, if available:

N/A

Description of changes:

Importing AgentCoreMemorySessionManager fails with Strands 1.56.0 because it references bidi hook events removed in strands-agents/harness-sdk#4280. Use the shared initialization and message hooks for both Agent and BidiAgent, and use BidiAgentStopEvent to save state when a bidi session stops. Keep initialization synchronous and offload persistence callbacks when async_mode=True.

Update the agent annotations to LocalAgent, migrate the existing hook-registration test, and raise the minimum strands-agents version to 1.56.0.

Validation:

  • All pre-commit checks and the Bandit security scan passed.
  • The full test suite with coverage passed in the locked Python 3.10 development environment (91% coverage). The focused session-manager suite also passed on Python 3.13 (182 tests).
  • Five existing live AWS integration tests passed, covering initialization, conversation persistence, batching, and session restoration.
  • Two one-off bidi checks passed against live AgentCore storage with a scripted model. These exercised public start, send, receive, and stop calls in both callback modes, including message restoration and state saved on stop.

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

@pgrayy
pgrayy requested a review from a team September 16, 2026 02:17
@github-actions github-actions Bot added the size/s PR size: S label Sep 16, 2026
@github-actions github-actions Bot added size/s PR size: S and removed size/s PR size: S labels Sep 16, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@9f31042). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ore/memory/integrations/strands/session_manager.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #664   +/-   ##
=======================================
  Coverage        ?   89.51%           
=======================================
  Files           ?      123           
  Lines           ?    10700           
  Branches        ?     1677           
=======================================
  Hits            ?     9578           
  Misses          ?      734           
  Partials        ?      388           
Flag Coverage Δ
unittests 89.51% <80.00%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants