Skip to content

fix(bedrock): skip S3 location sources for models that do not support them#2076

Open
Zelys-DFKH wants to merge 1 commit into
strands-agents:mainfrom
Zelys-DFKH:fix/bedrock-s3-location-unsupported-models
Open

fix(bedrock): skip S3 location sources for models that do not support them#2076
Zelys-DFKH wants to merge 1 commit into
strands-agents:mainfrom
Zelys-DFKH:fix/bedrock-s3-location-unsupported-models

Conversation

@Zelys-DFKH

Copy link
Copy Markdown
Contributor

Problem

When using S3 location sources for documents, images, or videos with non-Nova Bedrock models (Anthropic Claude, Meta Llama, Mistral, Cohere), the Converse API returns a ValidationException with the message source.type: Field required. The SDK forwards the S3 location unconditionally, with no model capability check, so users receive a confusing error instead of a clear warning.

S3 location sources are only supported by Amazon Nova models. All other model families require inline bytes.

Solution

Added _MODELS_SUPPORT_S3_LOCATION = ["amazon.nova"] alongside the existing _MODELS_INCLUDE_STATUS capability constant. Added a _supports_s3_location property and updated _handle_location to check model support before formatting the S3 location. When the model does not support S3 locations, a warning is logged and the content block is dropped, matching the behavior of the existing non-S3 location fallback.

Testing

  • Updated test_format_request_image_s3_location_only, test_format_request_document_s3_location, and test_format_request_video_s3_location to use amazon.nova-pro-v1:0.
  • Added test_format_request_s3_location_skipped_for_unsupported_models to verify all three S3 location content types are dropped with a warning for non-Nova models.
  • 2489 tests pass, lint clean.

Fixes #1744

Documentation PR

N/A

Type of Change

Bug fix

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions Bot added the size/s label Apr 5, 2026
@yonib05 yonib05 added area-model Related to models or model providers python Pull requests that update python code bug Something isn't working labels May 27, 2026
@Zelys-DFKH Zelys-DFKH force-pushed the fix/bedrock-s3-location-unsupported-models branch from a7b8700 to 67236bb Compare June 1, 2026 17:34
@github-actions github-actions Bot added size/s and removed size/s labels Jun 1, 2026
… them

S3 location sources for documents, images, and videos are only supported
by Amazon Nova models. Other model families (Anthropic Claude, Meta Llama,
Mistral, Cohere) reject them with a ValidationException. This adds a
`_MODELS_SUPPORT_S3_LOCATION` capability constant, a `_supports_s3_location`
property, and updates `_handle_location` to warn and skip the content block
when the current model does not support S3 locations.

Fixes strands-agents#1744
@Zelys-DFKH Zelys-DFKH force-pushed the fix/bedrock-s3-location-unsupported-models branch from 67236bb to 0eb33bc Compare June 24, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-model Related to models or model providers bug Something isn't working python Pull requests that update python code size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] S3Location Does Not Work With All Models in Bedrock

3 participants