[BUG] strands_harness.models._openai() emits reasoning.effort on non-reasoning models and unsupported effort levels on effort-subset OpenAI models
Human Overview
When resolving native OpenAI models through strands_harness.models.resolve_model("openai/..."), _openai() attaches params={"reasoning": {"effort": "high"}} even on non-reasoning models (gpt-4o, gpt-4.1*, gpt-4-turbo, chat-latest) and forwards Harness effort levels (minimal, xhigh, max, off) verbatim to effort-subset families (o1/o3/o4-mini, gpt-5..gpt-5.2, gpt-6-astra/gpt-6.1-sol). This triggers HTTP 400 rejections from the OpenAI Responses API on non-reasoning models and mismatched effort levels.
Bug Description
In strands-harness 0.4.0 (harness-py/src/strands_harness/models.py), resolving native openai/<model> strings via resolve_model() builds an OpenAIResponsesModel with:
- Default
effort=None: attachesparams={"reasoning": {"effort": "high"}}unconditionally, even for non-reasoning OpenAI models (gpt-4o,gpt-4o-mini,gpt-4.1,gpt-4.1-mini,gpt-4-turbo,chatgpt-4o-latest,gpt-3.5-turbo). - Routed
effortvalues ("off","minimal","xhigh","max"): passed through without model-family clamping for families that only accept subsets:o1/o3/o4-mini: accept onlylow | medium | high(reject"minimal","xhigh","max","off").gpt-5..gpt-5.2: acceptminimal | low | medium | high(reject"xhigh","max","off").gpt-6-astra/gpt-6.1-sol: acceptlow | medium | high | xhigh(reject"minimal","off").
Reproduction (Verified on strands-harness 0.4.0)
from strands_harness.models import resolve_model
for model_id, effort in [
("openai/gpt-4o", None),
("openai/gpt-4.1-mini", None),
("openai/o3", "minimal"),
("openai/o3", "xhigh"),
("openai/gpt-5", "xhigh"),
("openai/gpt-6.1-sol", "minimal"),
]:
kw = {"effort": effort} if effort else {}
resolved = resolve_model(model_id, model_id, **kw)
print(model_id, effort, type(resolved).__name__, resolved.get_config().get("params"))
Observed output on strands-harness 0.4.0:
openai/gpt-4o None -> OpenAIResponsesModel {'reasoning': {'effort': 'high'}}
openai/gpt-4.1-mini None -> OpenAIResponsesModel {'reasoning': {'effort': 'high'}}
openai/o3 minimal -> OpenAIResponsesModel {'reasoning': {'effort': 'minimal'}}
openai/o3 xhigh -> OpenAIResponsesModel {'reasoning': {'effort': 'xhigh'}}
openai/gpt-5 xhigh -> OpenAIResponsesModel {'reasoning': {'effort': 'xhigh'}}
openai/gpt-6.1-sol minimal -> OpenAIResponsesModel {'reasoning': {'effort': 'minimal'}}
Expected Behavior
- Non-reasoning OpenAI models (
gpt-4o*,gpt-4.1*,gpt-4-turbo*,*chat-latest*,gpt-4,gpt-3.5*) should omit"reasoning"fromparams. - Effort-subset OpenAI models should clamp/omit unsupported
effortstrings rather than sending invalid Responses API parameters ("off"/"none"should omit"reasoning";o1/o3/o4-minishould clamp"minimal"->"low"and"xhigh"/"max"->"high";gpt-5..5.2should clamp"xhigh"/"max"->"high";gpt-6-astra/gpt-6.1-solshould map"minimal"->"low").
Suggested Fix & Downstream Workaround
- Update
supports_thinking()/_openai()instrands_harness/models.py(alongsideshared/model-info.jsoncapabilities) so non-reasoning OpenAI models do not receivereasoningparams and effort levels clamp per model family. - Reference workaround implemented downstream in
CsabaConsulting/strands-code:configure_openai_for_model()instrands_code_cli/model/model_switch.py.
AI-assisted investigation for @remote-controlled-man.
I reproduced the configuration issue on current main (4a7f0651e), using Python 3.12.14, strands-agents 1.66.0 and openai 2.54.0:
from strands_harness.models import resolve_model
for name in ("gpt-4o", "gpt-4.1", "gpt-4.1-mini"):
spec = f"openai/{name}"
print(name, resolve_model(spec, spec).get_config().get("params"))
All three produce {'reasoning': {'effort': 'high'}}. An o3 control with explicit effort="high" retains that supported setting. This was offline configuration inspection, with no model API requests; I have not independently reproduced the server-side 400.
The OpenAI provider defaults to high, while _MODEL_LEVELS has no OpenAI rows and supports_thinking() checks the provider rather than the model. The GPT-4.1 documentation identifies it as a non-reasoning model. I found no competing fix in the issue's cross-references or targeted searches.
Could a maintainer confirm a model-aware fix and assign this to @remote-controlled-man (or approve it here)? I would follow the harness's existing early-validation policy for unsupported explicit efforts, omit reasoning for non-reasoning models, and keep Python/TypeScript behavior aligned with regression coverage. The issue proposes clamping instead; I will wait for confirmation of that choice and scope before implementing.