You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenAIConverseConverter drops all but the first toolResult of a parallel tool call, and json results #723
Describe the bug
With converter=OpenAIConverseConverter, a Strands agent that makes parallel tool calls stores only the first tool result. Strands puts every result of a parallel tool-use turn into one user message (strands/event_loop/event_loop.py:960), but _bedrock_to_openai (memory/integrations/strands/converters/openai.py, the if content and "toolResult" in content[0] branch) converts only content[0]. After restore, the assistant turn has N toolUse blocks and the next user turn has one toolResult, so the next Converse call fails the toolUse/toolResult pairing check (the same ValidationException class as #245).
It also keeps only text parts, so a tool result with a json block is restored as [{"text": ""}].
A single result whose content is only {"json": {...}} comes back as [{"text": ""}].
Expected behavior
Every toolResult survives the round trip with its content, as with the default AgentCoreMemoryConverter.
Suggested fix
Emit one OpenAI role: "tool" message per toolResult (message_to_payload already returns a list), serialize json parts with json.dumps, and in events_to_messages merge consecutive restored tool messages back into one user message so the history keeps the alternation Converse requires.
Additional context
Reproduced on main. Not covered by #245 (default converter, different cause) or #718 (reasoning bytes only).
I reproduced this issue and implemented a proposed fix in my fork.
The change preserves all parallel toolResult blocks, restores structured JSON content, and groups consecutive tool results into the appropriate Strands user message while retaining compatibility with previously stored tool messages.
Activity
OKAN-SOFTWARE commentedon Oct 29, 2026
I reproduced this issue and implemented a proposed fix in my fork.
The change preserves all parallel
toolResultblocks, restores structured JSON content, and groups consecutive tool results into the appropriate Strands user message while retaining compatibility with previously stored tool messages.Validation:
Implementation and regression tests:
https://github.com/OKAN-SOFTWARE/bedrock-agentcore-sdk-python/tree/fix/723-parallel-tool-results
I noticed the repository currently doesn't accept external code PRs, so I'm sharing the tested implementation here for the AWS team's consideration.
Happy to provide additional test cases or details if helpful.