{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/realtime/handler.py#L51-L87","documentation":"The Bedrock realtime (bidirectional stream) handler imports aws_sdk_bedrock_runtime (and smithy_aws_core) at call time. If the package is not installed, an ImportError is raised telling you to pip install aws-sdk-bedrock-runtime. This is an optional dependency required only for realtime voice use cases on Bedrock.","triggerScenarios":"Calling litellm.realtime() or the realtime socket handler with provider bedrock without having installed the aws-sdk-bedrock-runtime wheel (and its smithy_aws_core dependency).","commonSituations":"Fresh venv with plain 'pip install litellm' — the realtime SDK is not a default dependency; CI images trimmed of optional deps; mixing python versions where the wheel is unavailable.","solutions":["pip install aws-sdk-bedrock-runtime (which brings smithy-aws-core).","Pin it in requirements/pyproject alongside litellm if you use Bedrock realtime.","Verify with python -c \"from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient\" that the install is healthy."],"exampleFix":"# before: ImportError at realtime call\npip install litellm\n\n# after\npip install litellm aws-sdk-bedrock-runtime","handlingStrategy":"try-catch","validationCode":"def bedrock_realtime_deps_available() -> bool:\n    try:\n        import aws_sdk_bedrock_runtime  # noqa: F401\n        import smithy_aws_core  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":"def can_use_bedrock_realtime() -> bool:\n    return bedrock_realtime_deps_available()","tryCatchPattern":"try:\n    await litellm.realtime(model=model, ...)\nexcept ImportError as e:\n    if \"aws-sdk-bedrock-runtime\" in str(e):\n        raise SetupError(\"Install optional dep: pip install aws-sdk-bedrock-runtime\") from e\n    raise","preventionTips":["Add aws-sdk-bedrock-runtime to your dependency manifest if you use Bedrock realtime.","Fail fast at startup with an import probe rather than mid-session.","Document optional extras for teams deploying slim containers."],"tags":["bedrock","realtime","import-error","optional-dependency","installation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}