feat(core): allow _format_output to pass through list of ToolOutputMixin instances (#36963)

This commit is contained in:
Hunter Lovell
2026-04-23 10:49:46 -07:00
committed by GitHub
parent bb77a4229f
commit 9a671d7919
2 changed files with 96 additions and 1 deletions

View File

@@ -1265,8 +1265,15 @@ def _format_output(
status: The execution status.
Returns:
The formatted output, either as a `ToolMessage` or the original content.
The formatted output, either as a `ToolMessage`, the original content,
or an unchanged list of `ToolOutputMixin` instances.
"""
if (
isinstance(content, list)
and content
and all(isinstance(item, ToolOutputMixin) for item in content)
):
return content
if isinstance(content, ToolOutputMixin) or tool_call_id is None:
return content
if not _is_message_content_type(content):