BlockWatch Python SDK
Agentic Trust Authority — instrument multi-agent handoffs, detect runtime failures (loops, leaks, token burn), and stream session telemetry to BlockWatch without blocking your agents.
Built on OpenTelemetry and OpenInference: every framework integration is a standard OpenInference instrumentor, and every byte on the wire is a standard OTLP/HTTP span batch. BlockWatch does not invent a proprietary trace format — it is just one more OTLP-compliant destination for spans your agent framework already knows how to produce.
Install
pip install blockwatch[bedrock] # Amazon Bedrock Agents (boto3 + OpenInference Bedrock instrumentor)
pip install blockwatch[langgraph] # LangGraph (OpenInference LangChain instrumentor)
pip install blockwatch[crewai] # CrewAI (OpenInference CrewAI instrumentor)
pip install blockwatch[autogen] # AutoGen / AG2 (OpenInference AG2 instrumentor)
Install the agent framework you use in the same environment (langgraph, crewai, boto3, ag2, etc.) if it is not already a dependency of your project. Each extra above only adds the matching OpenInference instrumentation package.
Quick start (Bedrock)
pip install blockwatch[bedrock]
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=os.environ["BEDROCK_AGENT_ID"],
agentAliasId=os.environ["BEDROCK_AGENT_ALIAS_ID"],
sessionId="your-session-id",
inputText="Hello",
)
for event in response.get("completion", []):
if "chunk" in event:
print(event["chunk"]["bytes"].decode(), end="")
Call init() once, before creating the Bedrock client. The OpenInference Bedrock instrumentor patches boto3 client creation globally, so clients created afterward are automatically traced.
Copy .env.example for local runs. Runnable samples: examples/ (Bedrock, LangGraph, CrewAI, AutoGen/AG2).
Core pillars
| Pillar | What BlockWatch does |
|---|---|
| Privacy | Captures OpenInference spans (input.value / output.value / tool call attributes), not raw application logs. Review what your spans contain before production; server-side masking runs on every ingested trace. |
| Efficiency | Surfaces loops, leaks, and stuck handoffs on the BlockWatch platform using the full span parent/child tree. The SDK batches up to 50 spans or 1 second per export (standard OTel BatchSpanProcessor behavior). |
| Cost | Correlates token usage and burn patterns from OpenInference LLM span attributes (llm.token_count.*) so you can spot runaway agents early. |
Framework support
| Framework | SDK status | OpenInference instrumentor |
|---|---|---|
Amazon Bedrock (bedrock-agent-runtime) |
Supported — install blockwatch[bedrock] |
openinference-instrumentation-bedrock |
| LangGraph | Supported — install blockwatch[langgraph] + langgraph |
openinference-instrumentation-langchain (LangGraph runs on LangChain's runnable/callback stack) |
| CrewAI | Supported — install blockwatch[crewai] + crewai |
openinference-instrumentation-crewai |
| AutoGen | Supported — install blockwatch[autogen] + ag2 |
openinference-instrumentation-ag2 (AutoGen was renamed/forked to AG2 upstream) |
See ROADMAP.md for architecture details and backend normalization.
LangGraph
import os
import blockwatch
blockwatch.init(api_key=os.environ["BLOCKWATCH_API_KEY"], framework="langgraph")
# Call init() before compiling or invoking any graph.
for chunk in compiled.stream(input, stream_mode="updates"):
...
CrewAI
import os
import blockwatch
blockwatch.init(api_key=os.environ["BLOCKWATCH_API_KEY"], framework="crewai")
# Call init() before constructing Crew/Agent/Task objects.
result = crew.kickoff()
How it works
blockwatch.init(api_key, framework)builds one process-wide OpenTelemetryTracerProviderand registers the matching OpenInference instrumentor forframework.- The instrumentor patches your framework's own entry points (boto3 client creation for Bedrock, LangChain's callback manager for LangGraph,
Crew.kickofffor CrewAI, AG2's agent/chat hooks for AutoGen) so spans are produced automatically — there is no manual trace construction in this SDK. - A standard
BatchSpanProcessorbatches up to 50 spans or 1 second of wall time, whichever comes first. - A standard
OTLPSpanExporter(opentelemetry-exporter-otlp-proto-http) gzip-compresses and POSTs OTLP/HTTP protobuf span batches tohttps://api.blockwatch.ai/telemetry. - API key and framework identifier are sent as request headers (
X-BlockWatch-Api-Key,X-BlockWatch-Framework), never in the payload or query string. atexitregisters a best-effort flush (TracerProvider.force_flush+shutdown(), ~2s budget) on process exit so in-flight spans are not silently dropped.- Every internal operation is defensive:
init()failures, missing optional dependencies, and network errors are swallowed so BlockWatch can never crash or block your agent process.
AWS Lambda
requirements.txt
blockwatch[bedrock]>=2.0.0
import os
import blockwatch
blockwatch.init(
api_key=os.environ["BLOCKWATCH_API_KEY"],
framework="bedrock",
)
Build the layer on Amazon Linux:
pip install -r requirements.txt -t python/
API
| Function | Description |
|---|---|
blockwatch.init(api_key, framework) |
Start telemetry. framework: bedrock, langgraph, crewai, or autogen. |
Requirements
- Python 3.9+
- Core dependencies:
opentelemetry-sdk,opentelemetry-exporter-otlp-proto-http(always installed withblockwatch) - Bedrock:
boto3+openinference-instrumentation-bedrockviapip install blockwatch[bedrock] - LangGraph:
langgraph(install separately) +openinference-instrumentation-langchainviapip install blockwatch[langgraph] - CrewAI:
crewai(install separately) +openinference-instrumentation-crewaiviapip install blockwatch[crewai] - AutoGen:
ag2(install separately) +openinference-instrumentation-ag2viapip install blockwatch[autogen]
Contributing
- Open an issue or pull request.
- Do not commit API keys, PyPI tokens, or customer IDs — use environment variables only.
- Integration tests (optional):
pytest tests/ -m integrationwithBLOCKWATCH_API_KEY,BEDROCK_AGENT_ID, andBEDROCK_AGENT_ALIAS_IDset.
Security
Report vulnerabilities via GitHub Security Advisories (preferred) or a private channel to your BlockWatch contact. Rotate any key that may have been exposed in logs or commits.
License
MIT — see LICENSE. Copyright (c) 2026 INNOGINE.
Metadata
Release files for blockwatch 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blockwatch-2.0.0.tar.gz | 10.6 kB | Without provenance | Details for blockwatch-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blockwatch-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for blockwatch-2.0.0-py3-none-any.whl |
Total release size: 20.2 kB
Release files / blockwatch-2.0.0.tar.gz
| Download URL | blockwatch-2.0.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7420e2d070c87e70653f79c6da26ddb1a9a99c11eccbea4efd312e3f49fac255
|
|
BLAKE2b-256 checksum How to use checksums |
b955ea5b04417709263f7fa25ee03213884de68a3920ec6ffc03b1f1d4b9ef01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / blockwatch-2.0.0-py3-none-any.whl
| Download URL | blockwatch-2.0.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a458aab9ba647ac489071266bcbb5aff4a95ec95adfaf406a52531b4162b7599
|
|
BLAKE2b-256 checksum How to use checksums |
24a4df26c34f3cd517fd4d454bd5dd866a0e836f011cba48ce8740e40fc02654
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for blockwatch 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.