Skip to main content

Inter-agent messaging for Blueprint ecosystem

Project description

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 messagingto=None broadcasts, to="agent" sends direct
  • Blocking patternswait_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 filteringfrom_ 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 identityBP_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

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

bp_tunnel-0.3.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

bp_tunnel-0.3.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file bp_tunnel-0.3.1.tar.gz.

File metadata

  • Download URL: bp_tunnel-0.3.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bp_tunnel-0.3.1.tar.gz
Algorithm Hash digest
SHA256 22a0a65dd68091e353f1edae10544c3c61e5d260c103e00a415dbcbdf638b1bd
MD5 67bda94fc43e29dd29cd5ce4a5496eef
BLAKE2b-256 75c1a845ed833d6505565cc1ab70fdc22832ecad2d375cb999fb81f103039fb8

See more details on using hashes here.

File details

Details for the file bp_tunnel-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: bp_tunnel-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bp_tunnel-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f3937dd7f80f909af0f2785958fdfa3186ed568a5015820c78dad47f0f081b3
MD5 cec17791c882dc1eca97b2e0698dd190
BLAKE2b-256 aa097f240a58b26dd7c5882df96dbe659e88fd958fd7653949f15dda06e21bae

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