agent-bus
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_000chars. - 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,-3suffix on register. listdrops 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:userframes - On
msg_idpresent: 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):
- In one terminal (this agent):
AGENT_BUS_HOME=/tmp/ab-test agent-bus listen --name my-bus - In a real Claude Code session: run
/list-agentsor toolListAgents. You should seemy-bus. - Send a message from Claude to it (it will enqueue via their SendMessage to our socket).
- 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-udsagainst anything except a socket we started withlistenunder 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-socksAGENT_BUS_SESSIONS_DIR=/tmp/ab-test-sessionsAGENT_BUS_HOME=/tmp/ab-test-bus
Installation / running from source
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.
Also a skill copy lives at ~/.claude/skills/agent-bus/SKILL.md (and source skills/SKILL.md).
Skills / integration
See skills/SKILL.md. Agents can call the CLI or import agent_bus.store etc to register on start and poll inbox.
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
Built Distribution
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 agent_bus_team-0.1.2.tar.gz.
File metadata
- Download URL: agent_bus_team-0.1.2.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
753907d599c5ccf70ed1bb03c5c53e97b301a1bd233fa6aa3195280a0bf41f43
|
|
| MD5 |
d8651c9b5f998518b8e858f808077edd
|
|
| BLAKE2b-256 |
76ee3598744af879b54b6dfc17d398ba53dc4824e526cff7884823f6d4a07516
|
File details
Details for the file agent_bus_team-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agent_bus_team-0.1.2-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5dd5acca04034f9486782b12c9c57c570547f1fd41e2efcd0e21b5d4735f343
|
|
| MD5 |
2a53eb02b14da9a51c5fe5bd950ba58c
|
|
| BLAKE2b-256 |
8df9152efa2c79ce630d38e9672cec6df0ee719aeab49f45baf0e3bf123d310d
|