Skip to content

[BUG] Passing SageMakerAIEndpointConfig additional_args raises error #982

@athewsey

Description

@athewsey

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.10

Python Version

3.13.3

Operating System

macOS 15.7

Installation Method

pip

Steps to Reproduce

  1. Create a Strands SageMakerAIModel with a dict of additional_args in the endpoint config, for example:
model = SageMakerAIModel(
    endpoint_config={
        "endpoint_name": "{your-endpoint}",
        "additional_args": {
            "TargetContainerHostname": "my-cool-container",
        },
    },
)
  1. Try to invoke the model (either direct or via an agent)

Expected Behavior

The additional_args should be passed through to the SageMaker AI endpoint.

Actual Behavior

Invocation fails with error at this line:

AttributeError: 'dict' object has no attribute '__dict__'

Additional Context

(At least in CPython 3.12 and 3.13 on macOS), it seems that dictionary objects don't have a __dict__ property. Maybe there are some other versions or platforms where this is/was working? I couldn't tell for sure from the Python docs.

The equivalent section in Strands BedrockModel is not broken, because it just directly passes through the self.config["additional_args"] rather than attempting to fetch .__dict__ of it.

Possible Solution

Since additional_args is type-hinted as a Python dictionary, I suggest the fix should be to remove the unnecessary .__dict__ accessor and just stick with:

# Add additional args if provided
if self.endpoint_config.get("additional_args"):
    request.update(self.endpoint_config["additional_args"])

Related Issues

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions