feat(compose): add enhanced tool interfaces with multimodal support#760
Merged
zhuangjie1125 merged 1 commit intomainfrom Feb 5, 2026
Merged
feat(compose): add enhanced tool interfaces with multimodal support#760zhuangjie1125 merged 1 commit intomainfrom
zhuangjie1125 merged 1 commit intomainfrom
Conversation
Introduce EnhancedInvokableTool and EnhancedStreamableTool interfaces that support returning structured multimodal results (ToolResult) instead of plain strings. Key changes: 1. New Tool Interfaces (components/tool/interface.go): - EnhancedInvokableTool: accepts ToolArgument, returns *ToolResult - EnhancedStreamableTool: accepts ToolArgument, returns StreamReader[*ToolResult] 2. Tool Utils (components/tool/utils/): - Added InferEnhancedTool and InferEnhancedStreamTool for type inference - Added NewEnhancedTool and NewEnhancedStreamTool factory functions - Support both regular and optionable variants 3. ToolsNode Enhancement (compose/tool_node.go): - Added EnhancedInvokableToolMiddleware and EnhancedStreamableToolMiddleware - Auto-conversion between enhanced invokable and streamable endpoints - Priority given to enhanced tools when both interfaces are implemented - Updated interrupt/rerun state to track enhanced tool results separately 4. Schema Extensions (schema/message.go): - Added ToolPartType enum (text, image, audio, video, file) - Added ToolArgument and ToolResult structs for structured I/O - Added ToolOutputPart with multimodal content support - Added ConcatToolResults for stream chunk merging - Added ToMessageInputParts() for ToolResult to Message conversion - Enhanced Message.String() to display multimodal content 5. React Agent Integration (flow/agent/react/): - Added enhanced tool result senders for MessageFuture - Added middleware support for enhanced tool result collection This enables tools to return rich content like images, audio, video, and files alongside text, supporting advanced multimodal AI agent scenarios.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #760 +/- ##
==========================================
- Coverage 81.70% 80.47% -1.23%
==========================================
Files 129 129
Lines 12427 13007 +580
==========================================
+ Hits 10153 10468 +315
- Misses 1518 1737 +219
- Partials 756 802 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shentongmartin
approved these changes
Feb 5, 2026
shentongmartin
pushed a commit
that referenced
this pull request
Feb 5, 2026
…760) Introduce EnhancedInvokableTool and EnhancedStreamableTool interfaces that support returning structured multimodal results (ToolResult) instead of plain strings. Key changes: 1. New Tool Interfaces (components/tool/interface.go): - EnhancedInvokableTool: accepts ToolArgument, returns *ToolResult - EnhancedStreamableTool: accepts ToolArgument, returns StreamReader[*ToolResult] 2. Tool Utils (components/tool/utils/): - Added InferEnhancedTool and InferEnhancedStreamTool for type inference - Added NewEnhancedTool and NewEnhancedStreamTool factory functions - Support both regular and optionable variants 3. ToolsNode Enhancement (compose/tool_node.go): - Added EnhancedInvokableToolMiddleware and EnhancedStreamableToolMiddleware - Auto-conversion between enhanced invokable and streamable endpoints - Priority given to enhanced tools when both interfaces are implemented - Updated interrupt/rerun state to track enhanced tool results separately 4. Schema Extensions (schema/message.go): - Added ToolPartType enum (text, image, audio, video, file) - Added ToolArgument and ToolResult structs for structured I/O - Added ToolOutputPart with multimodal content support - Added ConcatToolResults for stream chunk merging - Added ToMessageInputParts() for ToolResult to Message conversion - Enhanced Message.String() to display multimodal content 5. React Agent Integration (flow/agent/react/): - Added enhanced tool result senders for MessageFuture - Added middleware support for enhanced tool result collection This enables tools to return rich content like images, audio, video, and files alongside text, supporting advanced multimodal AI agent scenarios.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce EnhancedInvokableTool and EnhancedStreamableTool interfaces that support returning structured multimodal results (ToolResult) instead of plain strings.
Key changes:
New Tool Interfaces (components/tool/interface.go):
Tool Utils (components/tool/utils/):
ToolsNode Enhancement (compose/tool_node.go):
Schema Extensions (schema/message.go):
React Agent Integration (flow/agent/react/):
This enables tools to return rich content like images, audio, video, and files alongside text, supporting advanced multimodal AI agent scenarios.