Skip to main content

bp-tunnel

Inter-agent messaging for the Blueprint ecosystem.

Lightweight tunnel system that lets AI agents (or any process) communicate through named channels with pluggable transport backends.

Install

pip install bp-tunnel

Quick Start

Python API

from bp_tunnel import Tunnel

# Agent 1: create and send
alice = Tunnel.create("alice", name="my-tunnel")
alice.send("hello everyone")           # broadcast
alice.send("hey bob", to="bob")        # direct message

# Agent 2: join and receive
bob = Tunnel.join("my-tunnel", "bob")
msg = bob.receive()                    # non-blocking, single message
msgs = bob.receive_all()              # drain all messages
msg = bob.wait_for(from_="alice")      # blocking wait
msg = bob.wait_for(timeout=10)         # with timeout

AI Tool Interface

Stateless dict-based functions for AI agent integration:

from bp_tunnel.tools import create_tunnel, join_tunnel, send_message, wait_for_message

result = create_tunnel("manager", name="team")
# {"tunnel_id": "team", "agent": "manager", "role": "admin"}

join_tunnel("team", "worker")
send_message("team", "manager", "build the feature", to="worker")

msg = wait_for_message("team", "worker", from_agent="manager", timeout=30)
# {"status": "message", "from": "manager", "message": "build the feature", "ts": ...}

CLI

# Set your identity once (or use --as every time)
export BP_TUNNEL_AGENT=alice

# Create a tunnel (named or random)
bp-tunnel create my-tunnel
bp-tunnel create                   # random hex ID

# Join from another terminal
bp-tunnel join my-tunnel --as bob

# Send messages
bp-tunnel send my-tunnel "hello"
bp-tunnel send my-tunnel "hey bob" --to bob

# Receive
bp-tunnel recv my-tunnel --as bob
bp-tunnel recv my-tunnel --as bob --all          # drain all
bp-tunnel recv my-tunnel --as bob --wait         # block until message
bp-tunnel recv my-tunnel --as bob --from alice

# Listen continuously
bp-tunnel listen my-tunnel --as bob

# JSON output for scripting
bp-tunnel ls --json
bp-tunnel recv my-tunnel --as bob --json

# Admin operations
bp-tunnel promote my-tunnel bob
bp-tunnel demote my-tunnel bob
bp-tunnel destroy my-tunnel

# Info
bp-tunnel info my-tunnel
bp-tunnel ls

Features

  • Multi-agent tunnels — any number of agents can join a channel
  • Named tunnels — human-readable names or auto-generated hex IDs
  • Broadcast & direct messaging — to=None broadcasts, to="agent" sends direct
  • Blocking patterns — wait_for(), send_wait(), receive_all() for workflows
  • Admin system — creator is auto-admin, can promote/demote/destroy
  • Pluggable transport — abstract Transport base class, file-based included
  • AI tool interface — stateless dict in/out functions for LLM tool calling
  • Selective filtering — from_ parameter filters without consuming other messages
  • Atomic writes — tempfile + rename for crash safety
  • File locking — fcntl locks for concurrent access
  • JSON output — --json flag for machine-readable CLI output
  • Env var identity — BP_TUNNEL_AGENT to avoid --as on every command

Architecture

Python API / AI Tools / CLI
         |
    Tunnel (agent-centric wrapper)
         |
    Transport (abstract interface)
         |
    FileTransport (/tmp/bp-tunnel/)
         |
    Message (YAML format)

License

MIT

Metadata

Release files for bp-tunnel 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bp-tunnel 0.3.1
File Size Uploaded Provenance Actions
bp_tunnel-0.3.1.tar.gz 10.0 kB Without provenance Details for bp_tunnel-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bp-tunnel 0.3.1
File Interpreter ABI Platform Actions
bp_tunnel-0.3.1-py3-none-any.whl Python 3 none any Details for bp_tunnel-0.3.1-py3-none-any.whl

Total release size: 23.1 kB

Release files / bp_tunnel-0.3.1.tar.gz

Download URL bp_tunnel-0.3.1.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
22a0a65dd68091e353f1edae10544c3c61e5d260c103e00a415dbcbdf638b1bd
BLAKE2b-256 checksum
How to use checksums
75c1a845ed833d6505565cc1ab70fdc22832ecad2d375cb999fb81f103039fb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / bp_tunnel-0.3.1-py3-none-any.whl

Download URL bp_tunnel-0.3.1-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f3937dd7f80f909af0f2785958fdfa3186ed568a5015820c78dad47f0f081b3
BLAKE2b-256 checksum
How to use checksums
aa097f240a58b26dd7c5882df96dbe659e88fd958fd7653949f15dda06e21bae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for bp-tunnel 0.3.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page