Skip to content

Conversation

athewsey
Copy link

@athewsey athewsey commented Oct 6, 2025

Description

  • Fix 982 error where passing an additional_args dict to SageMakerAIModel / SageMakerAIEndpointConfig would raise an AttributeError during inference request preparation, because Python dicts have no 'dict' attribute.
  • Fix 984 issue where additional_args passed to SageMakerAIPayloadSchema were ignored during inference request preparation - instead insert them into the request body/payload.
  • Fix typing of SageMakerAIModel.endpoint_config and SageMakerAIModel.payload_config to use the proper typed dicts for these structures rather than a plain dict() (coming from the shallow copy in the model constructor)
  • Add a unit test to validate that format_request() correctly includes additional_args (both types)

Related Issues

Fixes #982, Fixes #984

Documentation PR

None

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

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
    • This fix doesn't introduce the additional_args feature, but it seems like that is missing from the SageMaker model provider doc in the Strands-Agents User Guide.
    • I also see that SageMaker is generally missing from the Strands Models API reference
  • 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.

Fix error where passing an additional_args dict to SageMakerAIModel
would raise an AttributeError because Python dicts have no '__dict__'
attribute.

Fixes strands-agents#982
Fix typing for SageMakerAIModel.endpoint_config which was previously
being treated as an arbitrary dictionary due to init assignment.
Fix typing for SageMakerAIModel.payload_config, which was previously
being treated as a plain dict due to init assignment.
Add a test to check for insertion of endpoint config additional_args
Copy SageMakerAIPayloadSchema's additional_args into request payloads
where provided - previously these were being ignored. Includes unit
tests.
@athewsey athewsey temporarily deployed to manual-approval October 6, 2025 04:48 — with GitHub Actions Inactive
@athewsey
Copy link
Author

athewsey commented Oct 6, 2025

(Expanded scope to include fixing the second related issue with payload additional_args found from exploring the first one)

@athewsey athewsey changed the title Remove __dict__ accessor from SageMakerAIEndpointConfig additional_args Fix additional_args passing in SageMakerAIModel Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] SageMaker payload additional_args being ignored [BUG] Passing SageMakerAIEndpointConfig additional_args raises error
1 participant