fix(agent): guard multimodal tool content behind provider profile flag - #27597
Closed
zccyman wants to merge 2 commits into
Closed
fix(agent): guard multimodal tool content behind provider profile flag#27597zccyman wants to merge 2 commits into
zccyman wants to merge 2 commits into
Conversation
When computer_use returns image content, _tool_result_content_for_active_model currently checks only _model_supports_vision() before passing through the multimodal content list. However, many providers (e.g. Xiaomi MiMo) support images in user messages but require string-only content in role: "tool" messages, causing a 400 error. Add supports_multimodal_tool_content to ProviderProfile (default False) and check it in addition to vision support. Only providers known to accept multimodal tool content (Anthropic, OpenAI Codex, OpenRouter, xAI) have the flag set to True. Fixes NousResearch#27344
Collaborator
|
CI triage note from rock-turning: this PR is already called out above as a duplicate of #27351. Its current blocking check is not a code failure; the |
Contributor
Author
|
Closing as duplicate of #27351 (confirmed by alt-glitch). Both PRs implement the same provider profile flag approach for multimodal tool content support. |
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.
Summary
When
computer_usecaptures a screenshot and returns_multimodalcontent (list of text + image_url parts),_tool_result_content_for_active_modelcurrently only checks_model_supports_vision()before passing through the multimodal content list.However, many providers (e.g. Xiaomi MiMo) support images in user messages but require
contentto be a string inrole: "tool"messages. Sending a list causes a 400 error.Changes
providers/base.py: Addsupports_multimodal_tool_content: bool = FalsetoProviderProfilerun_agent.py:_provider_supports_multimodal_tool_content()that checks the profile flag_tool_result_content_for_active_model()to also check this flag before passing multimodal content throughApproach
Option 2 from the issue — conservative default. Only providers explicitly marked with
supports_multimodal_tool_content=Truereceive multimodal tool content. All others (including new/unrecognized providers) get the text summary fallback.This is safe because:
Falsemeans no existing provider behavior changes unless explicitly enabledFixes #27344