-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Describe the bug
When using Strands agents with tool calls on the AgentCore runtime, applying the upstream OpenTelemetry fix for Bedrock ConverseStream responses (PR #3990) consistently exposes a failure in the AgentCore Memory Strands session manager during message persistence.
Specifically, AgentCoreMemorySessionManager.append_message assumes the memory “create message/event” call always returns a dict, and crashes when it returns None:
created_message.get("eventId")
# AttributeError: 'NoneType' object has no attribute 'get'
This occurs when the session manager hook attempts to persist Strands message events generated during tool-use flows.
To Reproduce
Steps to reproduce the behavior:
-
Deploy a Strands agent configured to use AgentCore Memory on the AgentCore runtime.
-
Enable tool calling on the agent.
-
Apply the upstream OpenTelemetry Bedrock ConverseStream guard (PR #3990) to avoid the KeyError: 'output' crash (the runtime currently injects an AWS OpenTelemetry distro that predates this fix).
-
Invoke a tool during a normal agent turn (toolUse → toolResult).
-
Observe the agent invocation fail with:
AttributeError: 'NoneType' object has no attribute 'get'
at bedrock_agentcore/memory/integrations/strands/session_manager.py:488
Expected behavior
-
Applying the upstream OpenTelemetry fix should allow execution to proceed normally.
-
If a memory persistence call fails or returns an empty response, the AgentCore Memory session manager should handle it gracefully (or surface a clear error), rather than crashing the agent event loop.
-
Tool-use flows should not cause unhandled exceptions during memory message persistence.
Screenshots
N/A (stack trace and logs available).
Desktop (please complete the following information):
OS: Linux (AgentCore managed runtime)
Runtime: AWS Bedrock AgentCore
Python: 3.13
Strands Agents: 1.21.0
bedrock-agentcore: 1.2.0
Additional context
-
The AgentCore runtime injects an AWS OpenTelemetry distro (telemetry.auto.version: 0.12.2-aws) that does not yet include the upstream OpenTelemetry fix for Bedrock ConverseStream (PR #3990).
-
Applying that fix via monkey patch unblocks execution but consistently exposes this separate failure in the AgentCore Memory Strands integration.
-
The failure occurs when the session manager hook attempts to persist Strands message events produced during tool-use flows; the persistence call returns None, which is not currently guarded against.