Skip to content

fix(aws): restore Transcribe STT on transcribe-streaming 0.11 - #7094

Merged
longcw merged 2 commits into
mainfrom
longc/aws-stt-transcribe-0-11
Sep 2, 2026
Merged

fix(aws): restore Transcribe STT on transcribe-streaming 0.11#7094
longcw merged 2 commits into
mainfrom
longc/aws-stt-transcribe-0-11

Conversation

@longcw

@longcw longcw commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Problem: AWS Transcribe STT cannot start on aws-sdk-transcribe-streaming 0.10.0 or later. 0.10.0 dropped the Config export and 0.11.0 dropped the TranscribeStreamingClient alias, so the module import fails and STT() raises a misleading ImportError: The 'aws_sdk_transcribe_streaming' package is not installed.

Fix: Raise the floor to 0.11.0, import AsyncTranscribeStreamingClient and AsyncTranscribeStreamingConfig directly, and build the config with await Config.resolve(...). 0.11.0 makes AIOHTTPClient the default transport, which cannot carry a bidirectional stream, so StartStreamTranscription now gets the SpeechStream's AWSCRTHTTPClient through transport=, closed once in aclose().

Replaces #7074, whose transport diagnosis this keeps. Close #7072.

Context for reviewing and coding agents

How to see the failure

Install aws-sdk-transcribe-streaming 0.11.0, then run the module. On main all five tests fail, because livekit.plugins.aws.stt sets _AWS_SDK_AVAILABLE = False and every test constructs an STT.

uv run pytest tests/test_plugin_aws_stt.py --unit

The new test asserts the resolved config carries the SpeechStream's own AWSCRTHTTPClient, and that the client is closed exactly once, after aclose(). The close count guards the restart path: AWS ends a stream after 15 seconds of silence and _run loops, so a close inside the loop leaves the next attempt with a dead HTTP client.

What else the lock bump moves

transcribe-streaming 0.11.0 needs smithy-core~=0.8.0, while the locked 0.7.0 needed ~=0.6.0. uv therefore also lifts aws-sdk-bedrock-runtime 0.7.0 to 0.11.0, plus smithy-aws-core, smithy-http, and smithy-json. The only other consumer of bedrock-runtime is livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realtime/realtime_model.py, which #7076 already made work on 0.11.

Why the floor moved instead of a version ladder

The client name, the config name, and the config constructor all differ across 0.9.0, 0.10.0, and 0.11.0. A ladder that keeps >=0.2.0 needs nested import fallbacks and a hasattr(Config, "resolve") check at runtime. One floor makes the imports direct and leaves the config path with no branch.

What the raise costs

A Python 3.12+ install that holds transcribe-streaming below 0.11.0 must upgrade. STT is already dead on 0.10.0 and 0.11.0, so only pins at 0.9.0 and earlier lose a working version. The dependency added is smithy-http[awscrt], not awscrt, because 0.11.0 moved the CRT transport behind an extra and smithy-http owns the awscrt~=0.32.0 bound.

aws-sdk-transcribe-streaming 0.10.0 dropped the Config export and 0.11.0
dropped the TranscribeStreamingClient alias, so the plugin import failed
and STT() raised a misleading "package is not installed" ImportError.

0.11.0 also makes AIOHTTPClient the default transport, which cannot carry
a bidirectional stream. StartStreamTranscription is bidirectional, so the
SpeechStream's AWSCRTHTTPClient is now passed as transport= and closed
once in aclose().
@longcw
longcw requested a review from a team as a code owner September 2, 2026 03:56
devin-ai-integration[bot]

This comment was marked as resolved.

The stream shared one AWSCRTHTTPClient across restarts, so a restarted
attempt reused the pooled HTTP/2 connection of the stream that AWS had
already finished on its idle timeout. StartStreamTranscription then
carried no audio and raised nothing, so the session went silent after
the first 15 seconds of quiet.

Build the transport per attempt and close the previous one when the loop
restarts. Closing at the top of the next iteration rather than the end
of the current one matters: a close after `await gather_future` is
skipped, because CancelledError escapes the surrounding
contextlib.suppress(Exception).

Verified against live Transcribe on transcribe-streaming 0.11.0. Both
attempts transcribe across a restart, and the last transport closes on
aclose.

Replace test_aws_stream_pins_the_crt_transport, which asserted on a
single attempt and could not see this, with a test that drives a real
restart through the idle-timeout BadRequestException.
@longcw
longcw merged commit f170a3c into main Sep 2, 2026
22 of 23 checks passed
@longcw
longcw deleted the longc/aws-stt-transcribe-0-11 branch September 2, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugins-aws: STT unusable with aws-sdk-transcribe-streaming ≥0.11.0

2 participants