{"record":{"id":"8e15c40985371500","repo":"BerriAI/litellm","slug":"missing-aws-sdk-bedrock-runtime-install-with-pip","errorCode":null,"errorMessage":"Missing aws_sdk_bedrock_runtime. Install with: pip install aws-sdk-bedrock-runtime","messagePattern":"Missing aws_sdk_bedrock_runtime\\. Install with: pip install aws-sdk-bedrock-runtime","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/realtime/handler.py","lineNumber":69,"sourceCode":"        \"\"\"\n        Establish bidirectional streaming connection with Bedrock Nova Sonic.\n\n        Args:\n            model: Model ID (e.g., 'amazon.nova-sonic-v1:0')\n            websocket: Client WebSocket connection\n            logging_obj: LiteLLM logging object\n            aws_region_name: AWS region\n            Various AWS authentication parameters\n        \"\"\"\n        try:\n            from aws_sdk_bedrock_runtime.client import (\n                BedrockRuntimeClient,\n                InvokeModelWithBidirectionalStreamOperationInput,\n            )\n            from aws_sdk_bedrock_runtime.config import Config\n            from smithy_aws_core.identity import StaticCredentialsResolver\n        except ImportError:\n            raise ImportError(\"Missing aws_sdk_bedrock_runtime. Install with: pip install aws-sdk-bedrock-runtime\")\n\n        # Get AWS region\n        if aws_region_name is None:\n            optional_params: Final = {\n                \"aws_region_name\": aws_region_name,\n            }\n            aws_region_name = self._get_aws_region_name(optional_params, model)\n\n        # Get endpoint URL\n        if api_base is not None:\n            endpoint_uri = api_base\n        elif aws_bedrock_runtime_endpoint is not None:\n            endpoint_uri = aws_bedrock_runtime_endpoint\n        else:\n            endpoint_uri = f\"https://bedrock-runtime.{aws_region_name}.amazonaws.com\"\n\n        verbose_proxy_logger.debug(\"Bedrock Realtime: Connecting to %s with model %s\", endpoint_uri, model)\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/realtime/handler.py#L51-L87","documentation":"The Bedrock realtime handler (bidirectional streaming, e.g. Nova Sonic) imports the aws_sdk_bedrock_runtime preview SDK and smithy_aws_core.identity at session start; an ImportError is caught and re-raised with this pip hint. boto3/botocore alone is not enough for realtime: the separate aws-sdk-bedrock-runtime package is required because bimi-directional streaming is not in boto3.","triggerScenarios":"Starting a litellm realtime session against a Bedrock realtime model in an environment where aws_sdk_bedrock_runtime is not installed (only litellm base deps or boto3 present).","commonSituations":"Slim Docker images, CI environments, or requirements files that never included the realtime extra; environments where chat/completion via SigV4 works fine, masking the missing package.","solutions":["pip install aws-sdk-bedrock-runtime","Add aws-sdk-bedrock-runtime to requirements.txt/pyproject alongside litellm","Verify with: python -c \"import aws_sdk_bedrock_runtime\""],"exampleFix":"# before: ImportError at session start\n# after\npip install aws-sdk-bedrock-runtime","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"aws_sdk_bedrock_runtime\") is None:\n    raise SystemExit(\n        \"bedrock realtime requires the preview SDK; install with: pip install aws-sdk-bedrock-runtime\"\n    )","typeGuard":"def bedrock_realtime_available() -> bool:\n    \"\"\"True when the realtime preview SDK and its smithy dependency are importable.\"\"\"\n    return importlib.util.find_spec(\"aws_sdk_bedrock_runtime\") is not None and importlib.util.find_spec(\"smithy_aws_core\") is not None","tryCatchPattern":"try:\n    session = litellm.realtime(model=\"bedrock/amazon.nova-sonic-v1:0\", ...)\nexcept ImportError as e:\n    if \"aws_sdk_bedrock_runtime\" in str(e):\n        raise SystemExit(\"pip install aws-sdk-bedrock-runtime\") from e\n    raise","preventionTips":["Add aws-sdk-bedrock-runtime to requirements whenever realtime models are deployed","Fail fast at container startup with find_spec checks for optional heavy deps","Keep a smoke test that opens a realtime session in CI to catch missing extras"],"tags":["bedrock","realtime","dependency","import-error"],"backgroundTag":"missing-dependency","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}