strands.decisions.sagemaker_decision_model
Decision model backed by a System One model on a SageMaker AI real-time endpoint.
SageMakerDecisionModel
Section titled “SageMakerDecisionModel”class SageMakerDecisionModel(DecisionModel)Defined in: src/strands/decisions/sagemaker_decision_model.py:34
Decision model backed by a System One model on a SageMaker AI real-time endpoint.
Requests are signed with the standard AWS credential chain; callers need
sagemaker:InvokeEndpoint on the endpoint.
ask raises ModelThrottledException when the endpoint is throttled,
ContextWindowOverflowException when the request is too large, ValueError for an invalid
request, and StructuredOutputException for a malformed response. Other SageMaker errors
propagate unchanged.
Example:
decisions = SageMakerDecisionModel("my-decider-endpoint", region_name="us-east-1")result = await decisions.ask( "A customer needs a refund today.", \{"urgent": \{"question": "Is this urgent?", "choices": "boolean"}},)__init__
Section titled “__init__”def __init__( endpoint_name: str, *, region_name: str | None = None, boto_session: boto3.Session | None = None, boto_client_config: BotocoreConfig | None = None, client: "SageMakerRuntimeClient | None" = None, default_min_confidence: float = _SAGEMAKER_DEFAULT_MIN_CONFIDENCE) -> NoneDefined in: src/strands/decisions/sagemaker_decision_model.py:55
Create a SageMaker-backed decision model.
Arguments:
endpoint_name- Name of the SageMaker AI real-time endpoint serving the System One model.region_name- AWS region of the endpoint. Takes precedence overboto_client_config’s region. Cannot be combined withboto_sessionorclient.boto_session- Boto session used to create thesagemaker-runtimeclient, for example one with a named profile or assumed-role credentials. Its region is used unlessboto_client_configsets one. Cannot be combined withregion_nameorclient.boto_client_config-botocoreconfiguration for thesagemaker-runtimeclient. Cannot be combined withclient.client- Pre-builtsagemaker-runtimeclient, for example one shared with other components or configured with an endpoint override. Used as is, without the SDK’s user agent. Cannot be combined withregion_name,boto_sessionorboto_client_config.default_min_confidence- Default minimum confidence in[0.0, 1.0]. Defaults to0.5.
Raises:
ValueError- If the endpoint name is empty, the confidence threshold is out of range,region_nameis combined withboto_session, orclientis combined withregion_name,boto_sessionorboto_client_config.