sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Support reasoning effort on caller- constructed model instances

Open ekumar96 opened this issue 2 months ago • 1 comments

Human Overview

Strands defaults model reasoning effort to auto, but in our service we've been passing it a prebuilt Bedrock model, which bypassed that default. As a result, we could not enable extended/adaptive thinking unless it was configured explicitly through provider-specific request fields

SDK Language

Python

Problem Statement

Applications that construct a Strands BedrockModel directly cannot configure reasoning through a provider-neutral API. They must instead know which native request fields each model family expects, such as adaptive thinking, extended thinking, or provider-specific effort fields.

This makes application code depend on model IDs and provider payload formats. The mappings can become stale as providers introduce models or change their recommended reasoning mechanisms. It is particularly difficult for libraries and platforms that must construct model instances to apply settings such as token limits, sampling parameters, client configuration, and additional request fields.

Proposed Solution

Add a first-class, provider-neutral reasoning setting to Strands model configuration. For example:

model = BedrockModel(
    model_id=model_id,
    reasoning_effort="auto",
)

The model implementation would translate the abstract setting into the request fields supported by the selected model. For example, "auto" could select the SDK's recommended effort and use adaptive or extended thinking based on the model's capabilities.

Explicit provider-specific reasoning fields should take precedence over the default. An explicit "off" value should disable reasoning where supported. Unsupported explicit settings should produce an actionable validation error.

The exact API name is flexible. A public helper such as apply_reasoning_effort(model, "auto") could also work, provided callers do not need to maintain model-family mappings or manipulate provider request fields.

Use Case

An application accepts model configuration from its users and constructs a Strands BedrockModel with custom token limits, sampling settings, timeouts, and additional request fields. It wants to use the current recommended reasoning behavior without identifying the model family or constructing provider-specific thinking payloads.

The application should be able to specify one portable value, such as "auto", while preserving any explicit reasoning configuration supplied by the user. The same code should continue to work when new models use different native reasoning formats.

Alternatives Solutions

Applications can maintain model-ID mappings and inject native request fields themselves. This duplicates provider knowledge from the SDK and can become stale.

They can construct a second model through another resolver and inspect its configuration, but that relies on implementation details and creates an unnecessary model instance.

They can avoid constructing the model themselves, but this prevents them from applying application-specific model and client configuration. A provider-neutral model setting preserves that flexibility while keeping model capability detection in Strands.

Additional Context

Extended context

A current workaround resembles the following:

reasoning_fields = resolve_reasoning_fields(model_id, effort="auto")

model = BedrockModel(
    model_id=model_id,
    additional_args={
        "additionalModelRequestFields": reasoning_fields,
    },
)

The missing piece is a supported resolve_reasoning_fields or model-level equivalent. Applications should not need to determine whether a model expects adaptive thinking, extended thinking, reasoning, or reasoning_effort.

The responsibility could be divided as follows:

  • The application selects an abstract setting such as "auto", "off", "low", or "high".
  • The Strands model implementation detects the model's supported reasoning mechanism.
  • The provider adapter generates the corresponding native request fields.
  • Explicit native configuration continues to take precedence.

This would also provide one consistent contract for future model providers and reasoning mechanisms.

ekumar96 avatar Oct 01 '26 22:10 ekumar96

I'd be interested in helping with this. I checked the current harness resolver: pre-built Model / ModelRouter instances are intentionally returned unchanged, and non-auto effort gets a warning. That seems like an important ownership contract to preserve rather than changing it implicitly.

Would a Bedrock-only first slice be useful, with an explicit opt-in API for caller-constructed models? I'd reuse the existing model-family reasoning mappings instead of introducing another registry, preserve explicit native thinking fields, and avoid guessing configuration for unknown model families or routers.

The initial tests could be offline request-construction tests covering auto/off, supported explicit effort, native-field precedence, unsupported settings, and unchanged behavior when the new option isn't used. Live provider compatibility would still need a separate integration check; I wouldn't claim it from mocks alone.

Do you prefer a model configuration field or a public helper here? I'll wait for that direction before starting production changes, since it affects the public API and Python/TS parity. I have inspected the resolver but have not implemented or validated the proposed API.

Drafted with AI assistance.

Placidoe avatar Oct 03 '26 11:10 Placidoe