Can't use Amazon Nova Sonic. I get ImportError: cannot import name 'BedrockRuntimeClient' from 'aws_sdk_bedrock_runtime.client'
Bug Description
I'm trying to run Amazon Nova Sonic realtime model. I get this error
Traceback (most recent call last):
File "/usr/local/lib/python3.13/dist-packages/livekit/plugins/aws/__init__.py", line 32, in __getattr__
from .experimental import realtime
File "/usr/local/lib/python3.13/dist-packages/livekit/plugins/aws/experimental/realtime/__init__.py", line 1, in <module>
from .realtime_model import RealtimeModel, RealtimeSession
File "/usr/local/lib/python3.13/dist-packages/livekit/plugins/aws/experimental/realtime/realtime_model.py", line 18, in <module>
from aws_sdk_bedrock_runtime.client import (
...<2 lines>...
)
ImportError: cannot import name 'BedrockRuntimeClient' from 'aws_sdk_bedrock_runtime.client' (/usr/local/lib/python3.13/dist-packages/aws_sdk_bedrock_runtime/client.py)
ImportError: The 'realtime' module requires optional dependencies. Please install them with: pip install 'livekit-plugins-aws[realtime]'
Yet I have already installed 'livekit-plugins-aws[realtime]'
Expected Behavior
The nova sonic model should work with this error and the agent should start speaking. All the other realtime models work fine.
Reproduction Steps
Steps to reproduce the behavior:
1. Run the Voice AI Quickstart using Amazon Nova Sonic Realtime model
2. You will get the above error
Operating System
macOs
Models Used
Amazon Nova Sonic RealtimeModel
Package Versions
- Python 3.14
- livekit 1.1.15
- livekit-agents 1.7.1
- livekit-plugins-aws 1.7.1
Session/Room/Call IDs
No response
Proposed Solution
Additional Context
No response
Screenshots and Recordings
Here is a screenshot of my pyproject.toml file
Please assign me this
I checked the current main branch: commit 1c472dd (#7002) updates the Bedrock Runtime imports for aws-sdk-bedrock-runtime 0.10+. The report is using the 1.7.1 wheel, which predates that fix. Could you please cut a patch release containing #7002 and note the supported SDK version in the release notes?
@wangyuxy9805-web The PR #7002 was merged to main branch. To ensure that I'm using the latest merged code, I cloned the main repo livekit/agents and used that instead.
When I try running the amazon nova sonic model, I get a new error below;
smithy_core.exceptions.UnsupportedTransportError: The configured transport (AIOHTTPClient) does not support duplex (bidirectional) event streaming, which is required by the com.amazonaws.bedrockruntime#InvokeModelWithBidirectionalStream operation. Use a transport that does, such as smithy_http.aio.crt.AWSCRTHTTPClient. Custom transports that support duplex streaming can implement DuplexClientTransport by setting SUPPORTS_DUPLEX_STREAMING to True.
I checked the pyproject.toml and I see that required realtime dependencies are these:
[project.optional-dependencies]
realtime = [
"aws-sdk-bedrock-runtime>=0.2.0; python_version >= '3.12'",
"aws-sdk-signers>=0.0.3; python_version >= '3.12'",
"boto3>1.35.10",
]
@longcw would you consider switching to the capo-bedrock instead? It's more complete, provides a synchronous client, supports Python 3.10, and should generally be more robust