Metadata-Version: 2.4
Name: swarmauri_transport_aws_eventstream
Version: 0.1.0.dev1
Summary: Amazon Bedrock bidirectional EventStream transport for Swarmauri live models.
License: Copyright 2024 Jacob Stewart
         
         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at
         
             http://www.apache.org/licenses/LICENSE-2.0
         
         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
License-File: LICENSE
Keywords: swarmauri,transport,aws,amazon bedrock,eventstream,bidirectional,nova sonic,smithy,http2
Author: Jacob Stewart
Author-email: jacob@swarmauri.com
Requires-Python: >=3.10,<3.13
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: aws-sdk-bedrock-runtime (>=0.2.0,<0.3.0) ; python_version >= "3.12"
Requires-Dist: botocore (>=1.35)
Requires-Dist: swarmauri_base (>=0.11.0.dev5)
Requires-Dist: swarmauri_core (>=0.11.0.dev5)
Project-URL: Documentation, https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_transport_aws_eventstream#readme
Project-URL: Homepage, https://github.com/swarmauri/swarmauri-sdk
Project-URL: Repository, https://github.com/swarmauri/swarmauri-sdk
Project-URL: Source, https://github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_transport_aws_eventstream
Description-Content-Type: text/markdown

![Swarmauri](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)

[![PyPI version](https://img.shields.io/pypi/v/swarmauri_transport_aws_eventstream.svg)](https://pypi.org/project/swarmauri_transport_aws_eventstream/) [![Python](https://img.shields.io/pypi/pyversions/swarmauri_transport_aws_eventstream.svg)](https://pypi.org/project/swarmauri_transport_aws_eventstream/) [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE) [![Downloads](https://static.pepy.tech/badge/swarmauri_transport_aws_eventstream)](https://pepy.tech/project/swarmauri_transport_aws_eventstream) [![Hits](https://hits.sh/github.com/swarmauri/swarmauri-sdk.svg?path=pkgs%2Fstandards%2Fswarmauri_transport_aws_eventstream)](https://hits.sh/github.com/swarmauri/swarmauri-sdk/)

# swarmauri_transport_aws_eventstream

`swarmauri_transport_aws_eventstream` adapts Amazon Bedrock's Smithy
bidirectional EventStream operation to Swarmauri's
`IBidirectionalStreamClient` and `IBidirectionalStreamConnection` contracts.
The AWS SDK owns HTTP/2 framing, credential-chain resolution, and SigV4 request
and message signing; this package owns the Swarmauri lifecycle and JSON event
mapping.

## Features

- Sends and receives JSON events over `InvokeModelWithBidirectionalStream`.
- Supports explicit temporary credentials, the default AWS credential chain,
  and named profiles.
- Exposes synchronous and asynchronous Swarmauri connection APIs.
- Converts AWS stream exception events into `AwsEventStreamError`.
- Keeps credentials out of serialized component state.

The codec and package metadata support Python 3.10 through 3.12. Amazon's
official `aws-sdk-bedrock-runtime` currently requires Python 3.12, so opening a
live Bedrock connection requires Python 3.12.

## Installation

```bash
uv add swarmauri_transport_aws_eventstream
```

```bash
pip install swarmauri_transport_aws_eventstream
```

## Usage

Use the client directly when you already have a Bedrock model ID:

```python
from swarmauri_transport_aws_eventstream import AwsEventStreamClient

client = AwsEventStreamClient(region="us-east-1")
connection = await client.aconnect(
    "https://bedrock-runtime.us-east-1.amazonaws.com",
    model_id="amazon.nova-sonic-v1:0",
)

await connection.asend({"event": {"sessionStart": {}}})
async for event in connection.aiter_events():
    print(event)
await connection.aclose()
```

`NovaSonicLiveModel` configures this transport automatically. Pass an
`AmazonNovaProvider` when you need a named profile, explicit temporary
credentials, a different region, or a custom Bedrock runtime endpoint.

