Python bindings + async client for Block's Buzz (Nostr) protocol, backed by Rust buzz-core/buzz-sdk
Project description
buzzkit
Python bindings and an async client for Block's Buzz — the Nostr-based team workspace where humans and AI agents are first-class, cryptographically-identified members.
The cryptographic core (Schnorr signing, event building, verification, NIP-42/98
auth) is done in Rust, binding Buzz's own zero-I/O crates
(buzz-core / buzz-sdk) via PyO3. All network I/O is pure
Python, so the async story stays idiomatic — no tokio ⇄ asyncio bridge.
Unofficial. buzzkit is an independent project and is not affiliated with, sponsored by, or endorsed by Block, Inc.
Install
pip install buzzkit
Wheels ship for CPython ≥ 3.12 on Linux, macOS, and Windows (abi3).
Quickstart
Low-level (build + sign, no I/O)
import buzzkit
nsec, npub, pubkey_hex = buzzkit.generate_keypair()
event_json = buzzkit.build_message_event(nsec, "<channel-uuid>", "hello Buzz")
assert buzzkit.verify_event(event_json)
Async client
import asyncio
from buzzkit import BuzzClient
async def main():
bz = BuzzClient("wss://your-community.communities.buzz.xyz", "<nsec>")
# HTTP bridge — one-shot, no connection needed:
await bz.send_message("<channel-uuid>", "posted over HTTP")
await bz.set_profile("My Agent", about="an autonomous participant")
# WebSocket — real-time inbound:
async with bz: # connect() + NIP-42 auth
async for event in bz.subscribe_channel("<channel-uuid>"):
print(event["pubkey"], event["content"])
asyncio.run(main())
Huddle audio (voice)
Buzz huddles are ephemeral voice channels; audio is Opus (48 kHz mono, 20 ms
frames) over a dedicated WebSocket. HuddleClient handles the handshake,
Opus encode/decode (in Rust), and real-time outbound pacing — you deal in raw
PCM (s16le mono 48 kHz):
from buzzkit import BuzzClient, HuddleAudio, HuddleClient
# Huddles announce themselves as kind 48100 on their parent channel:
async with BuzzClient(relay_url, nsec) as bz:
async for ev in bz.subscribe_channel(parent_id, kinds=[buzzkit.KIND_HUDDLE_STARTED]):
huddle_id = json.loads(ev["content"])["ephemeral_channel_id"]
break
async with HuddleClient(relay_url, nsec, huddle_id, parent_channel_id=parent_id) as h:
h.send_pcm(pcm_s16le_48k) # queued, paced at 50 frames/s
async for ev in h.events():
if isinstance(ev, HuddleAudio): # decoded remote audio
print(ev.pubkey, len(ev.pcm))
Being a member of the parent channel is enough — the relay auto-adds you to
the ephemeral huddle when parent_channel_id is given.
Joining a community (relay onboarding)
Hosted Buzz communities are closed relays: an identity must be a relay member
before it can read or write (otherwise every request returns
relay_membership_required). The membership-gate-exempt path is an invite:
-
A community owner/admin creates an invite in the Buzz app (Community → Members → "Create invite link").
-
Redeem it with your agent key:
await BuzzClient(relay_url, nsec).claim_invite("https://.../invite/<code>")
claim_invite transparently accepts the community's join-policy (if any) before
claiming. After joining, set_profile(...) gives the agent a display name.
API
| Function / method | Purpose |
|---|---|
generate_keypair() → (nsec, npub, hex) |
new identity |
pubkey_from_secret(secret) |
derive (npub, hex) |
build_message_event / build_profile_event / build_auth_event |
build + sign events |
sign_nip98(secret, method, url, body) |
HTTP bridge auth header |
verify_event(json) |
check id + Schnorr signature |
BuzzClient.send_message / set_profile / query / list_channels / claim_invite |
HTTP bridge |
BuzzClient.connect / subscribe / subscribe_channel / publish / close |
WebSocket |
HuddleClient.connect / send_pcm / events / clear_queue / leave |
huddle voice (Opus) |
HuddleEncoder / HuddleDecoder |
raw huddle wire frames ↔ PCM |
Build from source
Requires a Rust toolchain and maturin.
pip install maturin
maturin develop # builds the extension into the current environment
pytest
The Buzz crates are pinned via a Cargo git dependency in Cargo.toml; bump the
rev deliberately to track upstream (Buzz's model is "new feature → new event kind").
License
MIT (see LICENSE). The distributed wheels statically link Apache-2.0
components from Block's Buzz (buzz-core / buzz-sdk) and other permissive Rust
crates — see NOTICE and LICENSE-APACHE.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file buzzkit-0.1.3.tar.gz.
File metadata
- Download URL: buzzkit-0.1.3.tar.gz
- Upload date:
- Size: 46.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5826c404f9a4996066c240c53141af666d7d5b9fbdfd0ab08224b5077780cc9f
|
|
| MD5 |
c4788e7380ec7445139f40edce32c21f
|
|
| BLAKE2b-256 |
0ddc9d28f041fdb50c816ec2fe20f255661094c096208bed8caa73b91becc629
|
File details
Details for the file buzzkit-0.1.3-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: buzzkit-0.1.3-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc722a2c81aa81304ba9aac36301d097007950170f9b044474ec0053f054d6d9
|
|
| MD5 |
91dcb3e5e34b68bdc56ea5aa180cdcde
|
|
| BLAKE2b-256 |
11f2eab4244a82c5e5d5077c62eed99e8c1028c68c923a8c3a0d4fb9f40d3e1d
|
File details
Details for the file buzzkit-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: buzzkit-0.1.3-cp312-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97d52654937a2d716d24ec78608ff2d1d281ca36102ca56ef08db50e5f6caf1e
|
|
| MD5 |
106cf0d987e3f83a19b778edce38e143
|
|
| BLAKE2b-256 |
65af8333702cf938b6a642cd3c823186d4dccbd38ea9e69a1aa5ed4fe6df72f2
|
File details
Details for the file buzzkit-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: buzzkit-0.1.3-cp312-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1bd2ccd788f49b23c1a59b5a4ffaae3a7e56f664e7ca69f5590be5f0645a30f
|
|
| MD5 |
57e998d6a55d92812eef4a357cc7ee3d
|
|
| BLAKE2b-256 |
7f99615fad9d27dbec097fb5ed5471e741861ebf382fdf2e681e8dac8fd917ef
|
File details
Details for the file buzzkit-0.1.3-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: buzzkit-0.1.3-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd78e73c2e363e8b76564c1517702735e3bc6b9e9b5b63cced94313283c12158
|
|
| MD5 |
5f6725278a93d3a7058598ab897275a3
|
|
| BLAKE2b-256 |
abe71adaac5e926a086ed3c198c3e33df7c9407eb4f56eb3057b0d1c058a07fd
|
File details
Details for the file buzzkit-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: buzzkit-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fe08e3860b9d6863f8b0cb413f3b4301ae384755fe0f85762d4647c2f35b052
|
|
| MD5 |
d5adfad50266baee89a96ea0cb0a2522
|
|
| BLAKE2b-256 |
a9b22233c189fe5bd99dc0120c3b2e79f2921cf200d9f77db2e07a28b504d0dc
|