#23467: feat: support image model resolution from media tool config
agents
size: XS
Cluster:
Image Model Enhancements
## Problem
The image tool did not explicitly prefer `cfg.tools.media.image.models` when resolving the vision model configuration.
**Why it matters:** Users should be able to define dedicated vision models (with ordered fallbacks) specifically for the image tool instead of relying only on global/default resolution logic.
---
## What Changed
- Added support for resolving image models from `cfg.tools.media.image.models`
- The first entry is treated as **primary**; remaining entries are treated as **fallbacks**
- Preserved existing `agents.defaults.imageModel` behavior and fallback logic
**What did NOT change (scope boundary):**
- No changes to model execution logic
- No changes to auth handling
- No changes to fallback execution flow
---
## Change Type
Feature
## Scope
Skills / tool execution, API / contracts
## Linked Issues
- Closes #23281
- Related #8096, #7564
---
## User-Visible / Behavior Changes
Users can now configure ordered vision models under `cfg.tools.media.image.models`. The first model becomes the primary vision model and subsequent models act as fallbacks. If no media image models are configured, existing behavior remains unchanged.
---
## Security Impact
No new permissions, no changes to secrets/token handling, no new network calls, no changes to execution surface or data access scope.
---
## Repro & Verification
1. Configure multiple models under `cfg.tools.media.image.models`
2. Trigger the image tool
3. Inspect resolved model selection
**Expected:** First configured model used as primary, remaining as fallbacks, default behavior preserved if config is absent.
**Actual:** ✅ Behavior matches expected.
---
## Compatibility / Migration
Fully backward compatible. No config, env, or migration changes required.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added support for resolving image models from `cfg.tools.media.image.models` configuration. The implementation correctly prioritizes media-specific image models before falling back to `agents.defaults.imageModel` and other default resolution logic. The first configured model becomes the primary model, with remaining models treated as fallbacks, maintaining full backward compatibility when the config is absent.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is straightforward and follows existing patterns in the codebase. It adds a new configuration path that is checked before existing fallback logic, maintaining full backward compatibility. The code includes appropriate null checks and array filtering. The only minor concern is that CLI-type models from the config would be silently filtered out, but this is handled gracefully and doesn't affect the primary use case.
- No files require special attention
<sub>Last reviewed commit: 447c97e</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#20572: feat (agents): add force option to imageModel for cheaper/better vi...
by primevalsoup · 2026-02-19
77.1%
#8660: fix: respect agents.defaults.models.*.params.maxTokens in image tool
by dbottme · 2026-02-04
75.6%
#21963: fix(cli): models fallbacks add now includes primary model in allowlist
by ashiabbott · 2026-02-20
75.4%
#11464: feat(models): add forward-compat fallback for gemini-3-pro-image
by ben-milanko · 2026-02-07
74.5%
#4459: fix: enable image input for Kimi K2.5 and refresh stale config mode...
by manikv12 · 2026-01-30
74.1%
#11349: fix(agents): do not filter fallback models by models allowlist
by liuxiaopai-ai · 2026-02-07
73.8%
#7044: feat: Add local model tool calling support
by jokelord · 2026-02-02
73.1%
#20275: fix(cli): include primary model in allowlist when adding fallbacks
by MFS-code · 2026-02-18
73.0%
#20965: feat: Add comprehensive model configuration and discovery for various…
by rodeok · 2026-02-19
72.7%
#11782: fix: resolve 403 auth error for GithubCopilot imageModel (#10277)
by adamkoncz · 2026-02-08
72.4%