[BUG] harness-py: supports_thinking(ModelRouter) raises AttributeError; TypeScript returns true
Human Overview
n/a — drafted by strandly-the-agent during the weekly test-simplify gap check; left for a human per team/AI_USAGE_POLICY.md.
Checks
- [x] I have updated to the lastest minor and patch version of Strands
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched ./issues and there are no duplicates of my issue
SDK Language
Python
Strands Version
main (strands-harness 0.4.1.dev22+gd982a0d44, strands-agents 1.65.1.dev12+gd982a0d44)
Language Runtime Version
Python 3.13.16
Operating System
Linux (aarch64)
Installation Method
git clone
Steps to Reproduce
from strands.models import BedrockModel
from strands.models.routing import ModelRouter
from strands_harness import supports_thinking, supports_web_search
router = ModelRouter([BedrockModel(model_id="fast")])
print(supports_web_search(router)) # False
print(supports_thinking(router)) # AttributeError
Expected Behavior
supports_thinking(router) returns True, as TypeScript's supportsThinking does for a ModelRouter (harness-ts/src/models.ts:562-565, pinned by harness-ts/test/models.test.ts:723-726).
Actual Behavior
AttributeError: 'ModelRouter' object has no attribute 'partition'. supports_thinking only checks isinstance(model, Model) (harness-py/src/strands_harness/models.py:428-430); ModelRouter is a Plugin, not a Model, so the router falls through to _split_provider(model) (models.py:395), which treats it as a string. The neighbouring supports_web_search and _supports_media both accept Model | ModelRouter | str | None.
Possible Solution
Mirror the sibling: widen the signature to Model | ModelRouter | str | None and check isinstance(model, (Model, ModelRouter)). Python also has no test for the Model-instance branch (models.py:429-430; TS has models.test.ts:719-721), so one parametrized test can cover both.
Additional Context
Low severity: nothing inside the harness passes a router to supports_thinking today, so this only reaches consumers calling the public helper. Found by mirroring the TS test in Python; the mirrored test fails, so no test PR was opened.
Related Issues
n/a
I'd like to take this if it's available. I reproduced the crash through the current harness's public import and prepared a two-line local fix matching the TypeScript helper, with regression coverage for model and router instances. The harness Python suite passes: 854 passed, 2 optional Cedar tests skipped; Ruff lint and formatting checks also pass.
Would this scope be welcome for a PR?
AI assistance: Codex prepared the local patch, ran the reproduction/tests, and drafted this comment.