Metadata-Version: 2.4
Name: blockwatch
Version: 0.1.1
Summary: Lightweight telemetry for Amazon Bedrock multi-agent collaboration and orchestration
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: boto3>=1.26.0
Requires-Dist: requests>=2.28.0
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# BlockWatch Python SDK

Non-blocking telemetry for **Amazon Bedrock Agent** `invoke_agent` calls. Traces are collected in the background and sent to BlockWatch — your app code stays unchanged.

**Install:** `pip install blockwatch` · **PyPI:** https://pypi.org/project/blockwatch/

## Quick start

1. Install the package.
2. Call `init()` **once**, before any Bedrock client.
3. Use `bedrock-agent-runtime` as usual.

```bash
pip install blockwatch
```

```python
import os
import blockwatch
import boto3

blockwatch.init(
    api_key=os.environ["BLOCKWATCH_API_KEY"],
    endpoint="https://api.blockwatch.ai/telemetry",
)

client = boto3.client("bedrock-agent-runtime", region_name="us-east-1")

response = client.invoke_agent(
    agentId="YOUR_AGENT_ID",
    agentAliasId="YOUR_ALIAS_ID",
    sessionId="your-session-id",
    inputText="Hello",
)

for event in response.get("completion", []):
    if "chunk" in event:
        print(event["chunk"]["bytes"].decode(), end="")
```

`enableTrace=True` is set for you automatically.

## AWS Lambda

**`requirements.txt`**

```text
blockwatch==0.1.0
```

Call `blockwatch.init(...)` at module load (use env vars for the API key and endpoint). Build your layer on Amazon Linux:

```bash
pip install -r requirements.txt -t python/
```

## API

| Function | Description |
|----------|-------------|
| `blockwatch.init(api_key, endpoint)` | Start telemetry and patch boto3. Safe to call once per process. |

## Notes

- Python **3.9+**
- Requires **boto3** and **requests** (installed with the package)
- SDK errors never crash your app (failures are silent)
