You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with version 0.11.0, the aws-sdk-* client packages include breaking changes to client names and default HTTP transports. This release also adds automatic cleanup of client HTTP resources.
Async-prefixed client names
Seven clients currently expose both an Async-prefixed client name and a deprecated unprefixed alias. Starting with version 0.11.0, these deprecated aliases are removed and only the Async<ServiceId>Client names remain. All other clients already expose only an Async-prefixed name and are not affected by this change.
# 0.11.0 and laterfromaws_sdk_bedrock_runtime.clientimportAsyncBedrockRuntimeClient
AIOHTTPClient is now the default transport
All clients now default to the AIOHTTPClient transport, which uses the aiohttp library to send HTTP requests. This changes the default transport for the following client packages, which previously used AWSCRTHTTPClient:
aws-sdk-bedrock-agent-runtime
aws-sdk-bedrock-agentcore
aws-sdk-bedrock-runtime
aws-sdk-connecthealth
aws-sdk-lambda
aws-sdk-lex-runtime-v2
aws-sdk-polly
aws-sdk-qbusiness
aws-sdk-sagemaker-runtime-http2
aws-sdk-transcribe-streaming
Important
AIOHTTPClient does not support HTTP/2 or bidirectional event streams. Applications that require either must install the awscrt optional extra and explicitly configure the CRT transport.
For example, install the Bedrock Runtime client with CRT support:
Applications that do not require HTTP/2, bidirectional event streams, or other CRT-specific functionality do not need to override the transport.
Client resource cleanup
Clients are now asynchronous context managers. Exiting the context automatically closes the underlying transport and cleans up HTTP resources such as sessions and connection pools.
A client cannot be reused after its context exits or after close() is called.
Migrating existing applications
Update client usage as follows:
Replace affected unprefixed client names with the corresponding Async<ServiceId>Client name.
If your application requires the CRT transport, install the client package with its awscrt optional extra, resolve an Async<ServiceId>Config with transport=AWSCRTHTTPClient(), and pass that configuration to the client.
Use the client as an asynchronous context manager or call await client.close() when the client is no longer needed.
# 0.11.0 and laterfromsmithy_http.aio.crtimportAWSCRTHTTPClientfromaws_sdk_bedrock_runtime.clientimportAsyncBedrockRuntimeClientfromaws_sdk_bedrock_runtime.configimportAsyncBedrockRuntimeConfigconfig=awaitAsyncBedrockRuntimeConfig.resolve(
region="us-west-2",
transport=AWSCRTHTTPClient(),
)
asyncwithAsyncBedrockRuntimeClient(config=config) asclient:
...
The explicit CRT transport in this example is only required for applications that need HTTP/2, bidirectional event streams, or other CRT-specific functionality.
To avoid unexpected breaking changes when installing or deploying your application, we recommend pinning aws-sdk-* client packages to a specific version or compatible version range.
Breaking changes in
0.11.0releaseStarting with version
0.11.0, theaws-sdk-*client packages include breaking changes to client names and default HTTP transports. This release also adds automatic cleanup of client HTTP resources.Async-prefixed client names
Seven clients currently expose both an
Async-prefixed client name and a deprecated unprefixed alias. Starting with version0.11.0, these deprecated aliases are removed and only theAsync<ServiceId>Clientnames remain. All other clients already expose only anAsync-prefixed name and are not affected by this change.The following deprecated aliases are removed:
BedrockRuntimeClientAsyncBedrockRuntimeClientConnectHealthClientAsyncConnectHealthClientLexRuntimeV2ClientAsyncLexRuntimeV2ClientPollyClientAsyncPollyClientQBusinessClientAsyncQBusinessClientSageMakerRuntimeHTTP2ClientAsyncSageMakerRuntimeHTTP2ClientTranscribeStreamingClientAsyncTranscribeStreamingClientFor example, for Bedrock Runtime:
must now be:
AIOHTTPClientis now the default transportAll clients now default to the
AIOHTTPClienttransport, which uses theaiohttplibrary to send HTTP requests. This changes the default transport for the following client packages, which previously usedAWSCRTHTTPClient:aws-sdk-bedrock-agent-runtimeaws-sdk-bedrock-agentcoreaws-sdk-bedrock-runtimeaws-sdk-connecthealthaws-sdk-lambdaaws-sdk-lex-runtime-v2aws-sdk-pollyaws-sdk-qbusinessaws-sdk-sagemaker-runtime-http2aws-sdk-transcribe-streamingImportant
AIOHTTPClientdoes not support HTTP/2 or bidirectional event streams. Applications that require either must install theawscrtoptional extra and explicitly configure the CRT transport.For example, install the Bedrock Runtime client with CRT support:
python -m pip install "aws-sdk-bedrock-runtime[awscrt]"Then pass an
AWSCRTHTTPClientto the service-specific configuration:Applications that do not require HTTP/2, bidirectional event streams, or other CRT-specific functionality do not need to override the transport.
Client resource cleanup
Clients are now asynchronous context managers. Exiting the context automatically closes the underlying transport and cleans up HTTP resources such as sessions and connection pools.
We recommend using clients as asynchronous context managers. Applications that manage the client lifecycle directly can instead call
close():A client cannot be reused after its context exits or after
close()is called.Migrating existing applications
Update client usage as follows:
Async<ServiceId>Clientname.awscrtoptional extra, resolve anAsync<ServiceId>Configwithtransport=AWSCRTHTTPClient(), and pass that configuration to the client.await client.close()when the client is no longer needed.For example:
becomes:
The explicit CRT transport in this example is only required for applications that need HTTP/2, bidirectional event streams, or other CRT-specific functionality.
Installing the latest version
Upgrade an existing client package with
pip:For example:
To install the optional CRT transport:
python -m pip install --upgrade "aws-sdk-bedrock-runtime[awscrt]"To explicitly require version
0.11.0or later:python -m pip install "aws-sdk-bedrock-runtime>=0.11.0"Pinning versions
To avoid unexpected breaking changes when installing or deploying your application, we recommend pinning
aws-sdk-*client packages to a specific version or compatible version range.To pin to an exact version:
python -m pip install "aws-sdk-bedrock-runtime==0.11.0"To allow compatible patch releases while avoiding newer minor releases:
python -m pip install "aws-sdk-bedrock-runtime~=0.11.0"This is important while the SDK is pre-
1.0.0, when minor releases may include breaking changes.