OpenAIConverseConverter drops all but the first toolResult of a parallel tool call, and json results
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read memory/integrations/strands/converters/openai.py, especially _bedrock_to_openai and message_to_payload, then compare its behavior with AgentCoreMemoryConverter. Reproduce the round trip using parallel toolResult blocks and a JSON result. Done means every result and its content survive restoration, consecutive tool messages are merged for Converse history, and the described reproduction passes.
由索引模型根据 Issue 内容生成。
描述
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": ""}].
To Reproduce
from strands.types.session import SessionMessage
from bedrock_agentcore.memory.integrations.strands.converters.openai import OpenAIConverseConverter as C
def roundtrip(msg):
payload = C.message_to_payload(SessionMessage(message=msg, message_id=0))
events = [{"payload": [{"conversational": {"content": {"text": t}, "role": r.upper()}}]} for t, r in payload]
return [m.message for m in C.events_to_messages(events)]
results = {"role": "user", "content": [
{"toolResult": {"toolUseId": "t1", "status": "success", "content": [{"text": "sunny"}]}},
{"toolResult": {"toolUseId": "t2", "status": "success", "content": [{"json": {"temp_c": 21}}]}},
]}
print([b["toolResult"]["toolUseId"] for m in roundtrip(results) for b in m["content"] if "toolResult" in b])
# ['t1'] (AgentCoreMemoryConverter returns ['t1', 't2'])
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).
- 主要语言
- Python
- 星标
- 786
- 派生
- 163
- 平均合并
- 4 小时
- 30 天内合并 PR
- 22
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/bedrock-agentcore-sdk-python 的其他 Issue
-
bug high-severity
难度 2/5 1-3 小时 新手友好度 72/100
aws/bedrock-agentcore-sdk-python#752 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
aws/bedrock-agentcore-sdk-python#751 · 1 个 reaction ·
维护者通常 1 天内回复
-
delete_all_long_term_memories_in_namespace deletes only the first 10 records可能已有人在做 @Fire162 于 18 天前认领。 未关闭bug high-severity
难度 2/5 1-3 小时 新手友好度 75/100
aws/bedrock-agentcore-sdk-python#727 ·
维护者通常 1 天内回复
-
MPP: credential is always sent in Authorization, ignoring header="Payment-Authorization" in the challenge可能已有人在做 @abhiramshaji-cyber 于 24 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
aws/bedrock-agentcore-sdk-python#702 ·
维护者通常 1 天内回复
-
[Bug] update_message fails with parameter validation error when SessionMessage.message_id is a Strands positional integer index可能已有人在做 @citizen204 于 144 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
aws/bedrock-agentcore-sdk-python#556 ·
维护者通常 1 天内回复
查看 aws/bedrock-agentcore-sdk-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
bug difficulty:2
难度 2/5 1-3 小时 新手友好度 72/100
MakazhanAlpamys/Soup#3167 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
snap-stanford/Biomni#380 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
jsboige/CoursIA#27768 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 66/100
rossant/awesome-math#206 ·