{"id":3136,"library":"mypy-boto3-sagemaker-a2i-runtime","title":"mypy-boto3-sagemaker-a2i-runtime type annotations","description":"This library provides type annotations (stubs) for the `boto3` client and resources related to the AWS SageMaker Augmented AI Runtime (A2I) service. It allows static type checkers like MyPy to validate code using `boto3` for this specific AWS service, catching potential errors before runtime. The current version is `1.42.3`, and releases are frequent, typically in sync with `boto3` updates and `mypy-boto3-builder` improvements.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","sagemaker","a2i"],"install":[{"cmd":"pip install mypy-boto3-sagemaker-a2i-runtime boto3","lang":"bash","label":"Install library and runtime"}],"dependencies":[{"reason":"Provides the actual runtime functionality; this package only offers type stubs.","package":"boto3"},{"reason":"Required for backporting new typing features to older Python versions, though typically handled by the package's dependency resolution.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"AugmentedAIRuntimeClient","correct":"from mypy_boto3_sagemaker_a2i_runtime.client import AugmentedAIRuntimeClient"},{"symbol":"HumanLoopSummaryTypeDef","correct":"from mypy_boto3_sagemaker_a2i_runtime.type_defs import HumanLoopSummaryTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_sagemaker_a2i_runtime.client import AugmentedAIRuntimeClient\nfrom mypy_boto3_sagemaker_a2i_runtime.type_defs import HumanLoopSummaryTypeDef\nimport os\n\n\ndef get_a2i_client() -> AugmentedAIRuntimeClient:\n    \"\"\"Initializes and returns a typed Sagemaker A2I Runtime client.\"\"\"\n    # Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)\n    # For local development, you might use 'aws configure'\n    # For production, consider IAM roles.\n    client: AugmentedAIRuntimeClient = boto3.client(\n        \"sagemaker-a2i-runtime\",\n        region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\")\n    )\n    return client\n\n\ndef list_a2i_flow_definitions():\n    \"\"\"Lists A2I flow definitions using the typed client.\"\"\"\n    client = get_a2i_client()\n    try:\n        # MyPy will now correctly type-check the client's methods and response structure\n        response = client.list_flow_definitions(MaxResults=10)\n        flow_definitions: list[HumanLoopSummaryTypeDef] = response[\"HumanLoopSummaries\"]\n\n        print(f\"Found {len(flow_definitions)} A2I Flow Definitions:\")\n        for fd in flow_definitions:\n            print(f\"- Name: {fd['FlowDefinitionName']}, Status: {fd['FlowDefinitionStatus']}\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    list_a2i_flow_definitions()\n","lang":"python","description":"This example demonstrates how to initialize a type-hinted `boto3` client for the Sagemaker A2I Runtime service and use it to list flow definitions. MyPy will provide strong type-checking for the client methods and the structure of the API responses, leveraging the installed stubs."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was removed starting from `mypy-boto3-builder` version 8.12.0. This means `mypy-boto3-sagemaker-a2i-runtime` versions built with 8.12.0 or newer (like 1.42.3) require Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-* >=1.42.3"},{"fix":"Ensure `boto3` is installed alongside this stub package (e.g., `pip install boto3 mypy-boto3-sagemaker-a2i-runtime`).","message":"This package (`mypy-boto3-sagemaker-a2i-runtime`) provides *only* type stubs. You must install `boto3` separately for your code to run successfully at runtime. The stubs have no runtime effect on `boto3` itself.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Keep `mypy-boto3-sagemaker-a2i-runtime` and `boto3` synchronized. For example, if `boto3` is `1.42.x`, install `mypy-boto3-sagemaker-a2i-runtime==1.42.*`.","message":"For optimal type-checking accuracy, ensure the `mypy-boto3-sagemaker-a2i-runtime` version matches your `boto3` library version as closely as possible. Significant version mismatches can lead to incorrect type hints or unresolved names.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}