Skip to content

[BUG] SageMaker payload additional_args being ignored #984

@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.0

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 payload config, for example:
model = SageMakerAIModel(
    endpoint_config={
        "endpoint_name": "{your-endpoint}",
    },
    payload_config={
        "additional_args": {
            "logprobs": True,
        },
    }
)
  1. Invoke the model (either direct or via an agent) and check the generated payload (or just call the model.format_request(...) method to check it out)

Expected Behavior

The extra parameters provided in payload_config.additional_args should be added to the Body of every request.

Actual Behavior

The additional_args are ignored because:

  1. This key of payload_config is (correctly) skipped over when directly adding config keys to the payload here... but
  2. Nothing after that actually unpacks the contents of additional_args to the payload as expected. Only the endpoint_config.additional args are addressed (here) which are different because those are actual boto3 parameters, not components within the payload.

Additional Context

As far as I can tell (since some docs are missing), it seems like the intention in the current implementation was for:

  • SageMakerAIEndpointConfig.additional_args to allow inserting additional top-level SageMaker boto3 invoke_endpoint(...) or invoke_endpoint_with_response_stream(...) arguments (presumably for features like EnableExplanations, TargetContainerName`, or etc)
  • SageMakerAIPayloadSchema.additional_args to allow inserting additional fields to the actual body of your requests to the model (like requesting logprobs, setting non-standard hyperparameters, or etc).

Possible Solution

Assuming the above interpretation is correct, I think we just need to add a step in format_request() to update the payload with the self.payload_config["additional_args"], where they're present?

Related Issues

Found during investigation of #982

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