Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b941044

Browse files
mxmzbclaude
andcommitted
fix(aws-strands): fall back to frontend_tool_names when tool_call_id lookup fails
When the assistant message with tool_calls is missing from input_data.messages (delta-only payload), the _tool_call_id_to_name lookup returns empty. Instead of giving up with an empty user_message (which produces no useful model output), fall back to the tool names available in input_data.tools (frontend_tool_names). This produces the same "analyzeData executed successfully with no return value." message that the full-history path generates. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 027ecf9 commit b941044

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • integrations/aws-strands/python/src/ag_ui_strands

integrations/aws-strands/python/src/ag_ui_strands/agent.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,14 @@ async def run(self, input_data: RunAgentInput) -> AsyncIterator[Any]:
632632
tool_name = _tool_call_id_to_name.get(msg.tool_call_id)
633633
if tool_name and tool_name in frontend_tool_names:
634634
user_message = f"{tool_name} executed successfully with no return value."
635-
else:
635+
elif frontend_tool_names:
636+
fallback_name = next(iter(frontend_tool_names))
637+
user_message = f"{fallback_name} executed successfully with no return value."
636638
logger.warning(
637639
f"Could not resolve tool name for tool_call_id={msg.tool_call_id} "
638-
f"(lookup has {len(_tool_call_id_to_name)} entries, "
639-
f"frontend_tool_names={frontend_tool_names}). "
640-
f"The assistant message with tool_calls may be missing from "
641-
f"input_data.messages (delta-only payload)."
640+
f"from input messages (assistant message with tool_calls may be "
641+
f"missing — delta-only payload). Falling back to frontend tool "
642+
f"name '{fallback_name}' from input_data.tools."
642643
)
643644
break
644645
elif input_data.messages:

0 commit comments

Comments
 (0)