Metadata-Version: 2.4
Name: blockwatch
Version: 0.1.2
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 agent orchestration (Bedrock today; LangGraph, CrewAI, AutoGen planned). 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** with your API key and framework.
3. For Bedrock, use `bedrock-agent-runtime` as usual (before creating the client).

```bash
pip install blockwatch
```

```python
import os
import blockwatch
import boto3

blockwatch.init(
    api_key=os.environ["BLOCKWATCH_API_KEY"],
    framework="bedrock",
)

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 when `framework="bedrock"`.

## AWS Lambda

**`requirements.txt`**

```text
blockwatch>=0.1.2
```

Call `blockwatch.init(api_key=..., framework="bedrock")` at module load. Build your layer on Amazon Linux:

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

## API

| Function | Description |
|----------|-------------|
| `blockwatch.init(api_key, framework)` | Start telemetry. `framework`: `bedrock`, `langgraph`, `crewai`, or `autogen`. |

Telemetry is sent to `https://api.blockwatch.ai/telemetry` with header `X-BlockWatch-Framework` set to your framework value.

## Notes

- Python **3.9+**
- Requires **boto3** and **requests** (installed with the package)
- SDK errors never crash your app (failures are silent)
- Boto3 patching applies only when `framework="bedrock"`
