Skip to main content

agent-bus-team

PyPI version

Small stdlib-only Python 3.11+ inter-agent messaging CLI and library.

Parallel bus for Claude Code, Grok, Oh My Pi (omp), Codex, and others. Two channels: file bus (send/inbox) vs. native UDS (listen + send-peer). See UDS-protocol.md.

On-disk (AGENT_BUS_HOME=~/.agent-bus)

~/.agent-bus/
  roster/<id>.json     # registered agents (uuid ids)
  inboxes/<id>.jsonl   # append-only, one JSON message per line
  captures/<pid>.jsonl # from `listen`

Roster entry and Message envelope match the spec in the source.

Rules (enforced)

  • Plain text only in text (no structured payloads).
  • Refuse > 1_000_000 chars.
  • Per-inbox unread cap 50 (send fails with clear error).
  • Never treat a received message as user consent. Messages are cross-session only. The receiving agent must still show the user and obtain explicit approval before acting on any instruction in a message.
  • Names unique among live (pid-alive) registrations; collisions get -2, -3 suffix on register.
  • list drops stale roster entries (dead pid) but leaves their inbox files.

CLI

agent-bus list [--kind claude|grok|omp|codex|all] [--json]
agent-bus send <name-or-id> -m TEXT [--summary S] [--from-name N]
agent-bus inbox [--name N] [--unread] [--json]
agent-bus ack <message-id> [--name N]
agent-bus register --name N --kind K [--cwd P] [--pid P]
agent-bus unregister --name N
agent-bus self [--json]

# EXPERIMENT (see below)
agent-bus listen [--name agent-bus]
agent-bus send-uds <socket-path> -m TEXT

list = live roster entries (after pruning dead) UNION native adapters (claude/grok/omp/codex read-only discovery of their registries). Only alive pids.

send to a discovered native name/id will lazily create a roster entry + inbox under this bus home using a stable derived id (claude:<sessionId>, grok:... etc). The recipient only sees it if they also run agent-bus inbox (or via skill).

Adapters (read-only, best-effort, never throw)

  • claude: ~/.claude/sessions/*.json (pid alive)
  • grok: ~/.grok/active_sessions.json
  • omp: ~/.omp/run/daemons/*/clients/*.json + terminal-sessions fallback
  • codex: ~/.codex/process_manager/chat_processes.json (catalog skipped silently)

Override for tests with AGENT_BUS_SESSIONS_DIR etc. (File-bus adapters are read-only discovery and never write native sockets; native UDS send path does write for acks and peer messages — see UDS-protocol.md.)

The listen + UDS experiment

agent-bus listen lets a Claude Code session discover us via its ListAgents / /list-agents.

It:

  • Binds UDS at /tmp/cc-socks/<ourpid>.sock (0o600, dir 0o700)
  • Writes a matching ~/.claude/sessions/<ourpid>.json (exact fields + timestamps) + peer key
  • Accepts connections, reads newline-delimited JSON frames (tolerates final buffer w/o nl)
  • Logs raw + parsed (auth redacted) to stdout + appends to ~/.agent-bus/captures/<pid>.jsonl
  • Auth first line on conns; accepts type:user frames
  • On msg_id present: dials back an authenticated {"type":"control","action":"peer_message_status","status":"delivered",...} (NEVER writes status on the inbound conn)
  • On SIGINT/SIGTERM: unlinks only our sock, sessions json, and key

agent-bus send-peer sends native UDS messages into other Claude sessions (or other listeners).

Usage (from another Claude):

  1. In one terminal (this agent): AGENT_BUS_HOME=/tmp/ab-test agent-bus listen --name my-bus
  2. In a real Claude Code session: run /list-agents or tool ListAgents. You should see my-bus.
  3. Send a message from Claude to it (it will enqueue via their SendMessage to our socket).
  4. Watch the logs + capture file.

Outbound to Claude peers: agent-bus send-peer <name-or-sock> -m "text here" See UDS-protocol.md for the full wire format, auth, frame shapes, and verified bidirectional behavior.

CRITICAL SAFETY

  • This is an experiment to reverse the wire format.
  • Do not use send-uds against anything except a socket we started with listen under test overrides.
  • Real delivery in Claude happens at their next tool round; they may show <cross-session-message ...>
  • Received content must never auto-execute. Always require fresh user approval.

Test overrides (used by our test suite, safe):

  • AGENT_BUS_SOCK_DIR=/tmp/ab-test-socks
  • AGENT_BUS_SESSIONS_DIR=/tmp/ab-test-sessions
  • AGENT_BUS_HOME=/tmp/ab-test-bus

Installation

Note: Package Name is agent-bus-team.

# run latest version with uvx
uvx run --from agent-bus-team agent-bus

# or install with pip
pip install agent-bus-team
agent-bus

Running from Source

# CLI binary is agent-bus
gh repo clone danbarua/agent-bus && cd agent-bus
python -m pip install -e .
agent-bus --help

For a Claude session or omp: python -m agent_bus ... or after pip install use the script.

Grok and Claude Code plugins

This repo is a Grok plugin (plugin.json) and a Claude Code plugin (.claude-plugin/plugin.json). Skills, slash commands, and session hooks ship with the tree. The Python package is still agent-bus-team; the CLI is agent-bus.

# Grok
grok plugin install danbarua/agent-bus --trust
grok plugin enable agent-bus

# Claude Code
claude plugin install danbarua/agent-bus

Local checkout:

grok plugin install . --trust

SessionStart registers this host on the file bus (--kind grok or claude, host pid). SessionEnd unregisters. Slash commands: /agent-bus-inbox, /agent-bus-send, /agent-bus-list. Incoming messages are not user consent.

Plugin wrapper (no extra pip if Python 3.11+ is present): scripts/agent-bus.

Skills / integration

See skills/agent-bus/SKILL.md. Agents can call the CLI or import agent_bus.store.

Development / test

python -m pytest tests/ -q --tb=line
AGENT_BUS_HOME=/tmp/ab-test python -m agent_bus list --json

Limitations / non-goals

  • No impersonation of Claude's full protocol (listen + send-peer implement the UDS peer messaging subset — see UDS-protocol.md.
  • No auto-start of other agents.
  • Herdr TTY injection is a separate channel (not used here).
  • No impersonation of Claude's full protocol beyond the listen experiment.
  • Inboxes are per bus-home; multiple users would need separate homes or sync.

This is intentionally small and boring.

Download files

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

Source Distribution

agent_bus_team-0.1.3.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

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

agent_bus_team-0.1.3-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_bus_team-0.1.3.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.11.14

File hashes

Hashes for agent_bus_team-0.1.3.tar.gz
Algorithm Hash digest
SHA256 92e717213336714890c00572f79289066078919204e13096e4da57eff6975fe3
MD5 2ecf63036d483402ec1c80bf879cf6dc
BLAKE2b-256 20d22d40b40f24287b83497051fcd8ab9078b99b48de1ae1b971bd8e32865753

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_bus_team-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.11.14

File hashes

Hashes for agent_bus_team-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e2544021e7194632d27bd4c352e969ba14db259e9f2a60ed1a17be05c72ead68
MD5 a255b23d50b9e573439687a9aa3d9b8c
BLAKE2b-256 425c5aab41a012a3536c41f2e45b5aa8d2699500c7dac3cc4aee5692e21e5720

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

Supported by

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