Skip to main content

Lightweight telemetry for multi-agent collaboration and orchestration

Project description

BlockWatch Python SDK

PyPI Python License: MIT

Agentic Trust Authority — instrument multi-agent handoffs, detect runtime failures (loops, leaks, token burn), and stream session telemetry to BlockWatch without blocking your agents.

Install

pip install blockwatch          # core telemetry (requests)
pip install blockwatch[bedrock] # adds boto3 for framework="bedrock"

Install the agent framework you use in the same environment (langgraph, crewai, boto3, etc.). BlockWatch does not pull them in automatically except via [bedrock].

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. enableTrace=True is injected automatically for bedrock-agent-runtime.

Copy .env.example for local runs. Runnable samples: examples/ (Bedrock, LangGraph, CrewAI).

Core pillars

Pillar What BlockWatch does
Privacy Captures Bedrock orchestration trace events (not raw app logs). Review what your traces contain before production; client-side field masking is on the roadmap.
Efficiency Surfaces loops, leaks, and stuck handoffs on the BlockWatch platform. The SDK batches up to 50 events or 1 second per upload.
Cost Correlates token usage and burn patterns from trace analytics so you can spot runaway agents early.

Framework support

Framework SDK status
Amazon Bedrock (bedrock-agent-runtime) Supported — install blockwatch[bedrock] or boto3; patches invoke_agent + trace stream
LangGraph Supportedpip install langgraph in your app env; patches invoke / stream (prefer streaming for handoff data)
CrewAI Supportedpip install crewai in your app env; patches Crew.kickoff
AutoGen Telemetry worker only; entry-point patches coming later

See ROADMAP.md for parity tiers and backend normalization.

LangGraph

import os
import blockwatch

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

# Call init before compile(); prefer stream() for step-level telemetry.
for chunk in compiled.stream(input, stream_mode="updates"):
    ...

How it works

  • Background daemon thread gzip-batches JSON to https://api.blockwatch.ai/telemetry
  • Short HTTP timeouts (connect 2s, read 5s) — network issues never crash your agent
  • API key sent via X-BlockWatch-Api-Key header (not query strings)
  • atexit best-effort flush (2s budget) on process exit

AWS Lambda

requirements.txt

blockwatch[bedrock]>=0.1.3
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 dependency: requests (always installed with blockwatch)
  • Bedrock: boto3 via pip install blockwatch[bedrock] or pip install boto3
  • LangGraph / CrewAI: install those packages in your app environment when using those frameworks

Contributing

  1. Open an issue or pull request.
  2. Do not commit API keys, PyPI tokens, or customer IDs — use environment variables only.
  3. Integration tests (optional): pytest tests/ -m integration with BLOCKWATCH_API_KEY, BEDROCK_AGENT_ID, and BEDROCK_AGENT_ALIAS_ID set.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blockwatch-0.1.3.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blockwatch-0.1.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file blockwatch-0.1.3.tar.gz.

File metadata

  • Download URL: blockwatch-0.1.3.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for blockwatch-0.1.3.tar.gz
Algorithm Hash digest
SHA256 488f87b39597b52f73002f769d32584832d79bcb5d690c082c11eea1e6961559
MD5 be5a8c59567f2cf68739b5f5a919de55
BLAKE2b-256 01f42d172f8ca6bc3cb264417d02ba186bcdd3c584908c4caa971fce37bdc118

See more details on using hashes here.

File details

Details for the file blockwatch-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: blockwatch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for blockwatch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fa279565d4433dc67915b7c80a7b85aa87d9c27b78015d8a8d58428155d28a28
MD5 509fbf5381811dce2b668abfae5d7cad
BLAKE2b-256 92a43b30f1ef556e3636d4f757e412035ead7b7f25c91b05bacc5a1c67b51aec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page