inter-agent-bus
🇬🇧 English · 🇫🇷 Français
An Agent Plugins v1.0.0 plugin: a coordination bus between heterogeneous AI agents (Claude Code, Kimi, DeepSeek, local models…). The plugin provides the mechanism — task queues under lease (claim/ack), a shared result store, an event journal, an observable state — and never the cast: agents and their roles are declared by the consuming project in its roster.
Two layers, one bus
- stdio is the transport: each agent client spawns its own instance of the MCP server (one subprocess per client). Nothing is shared at this layer.
- SQLite is the bus: all server instances read and write the same database (WAL mode, immediate transactions). This is where sharing happens. No daemon to start or supervise.
Task lifecycle
queued → claimed (lease) → done, with two terminal side exits:
dead (dead-lettered after max_attempts expired leases —
requeue_task revives it) and cancelled. An expired lease re-offers
the task, so an agent dying after claim_task does not lose it.
Delivery is therefore at-least-once: tasks should be idempotent.
Settling is fenced: the claim response carries an attempt number,
and publish_result refuses a staler token — a slow worker whose
lease expired cannot overwrite the result of the worker that took the
task over. Every transition is journaled (get_events, iab log).
Installation (operator)
Run the bus from a dedicated venv installed from a published release (PyPI), never from a working tree:
python3 -m venv ~/.local/venvs/inter-agent-bus
~/.local/venvs/inter-agent-bus/bin/pip install \
'inter-agent-bus[server]==0.16.0'
~/.local/venvs/inter-agent-bus/bin/iab install --scope user
iab install registers the MCP server in Claude Code (through
claude mcp add-json) as the iab-server executable of that venv —
no repository path involved. A newly added server only loads in the
next session: reopen, then call whoami() (it returns the
identity, the resolved bus database and how it was chosen). To
upgrade: pip install -U with the next tag, then reopen sessions.
The baked value is the harness (--agent-name, default claude);
each session completes it with the workspace it is launched in (see
Identity below), so one user-scope install serves every project
(--print to inspect the JSON without applying, --scope project|local
for narrower scopes, --agent-name harness@workspace to pin both).
Identity: one instance = harness@workspace
An agent on the bus is an instance: a harness (the client carrying
the model — claude, kimi, codewhale, opencode…) on a workspace
(the repository or folder it works in — homelab, infra…), written
harness@workspace. Queue, presence and notification cursors are per
instance, so two Claude Code sessions on two repositories no longer
share one mailbox. whoami() tells how the name was built:
- harness:
IAB_AGENT_NAME(legacyORCHESTRATOR_AGENT_NAMEhonored); a value already holding an@is the full name; - workspace:
IAB_WORKSPACEif set, else derived from the server's launch directory — operator alias table first (IAB_WORKSPACES, a JSON{path: name}, default<data dir>/workspaces.json, longest prefix wins), then the name of the enclosing git repository (a submodule yields its own name), else the folder's own name; - model:
IAB_MODELis echoed; an instance declares the real one withregister_agent(..., model=)orheartbeat(..., model=)— session state, kept in the presence row, never guessed by the plugin.
A connected client named by its environment is registered on its
first tool call (description empty, launch directory recorded). A bare
harness is accepted as a target only while it designates a single
instance; otherwise the bus refuses and lists the candidates — a legacy
bare row counts as one, rename_agent (CLI iab rename) moves it, with
its queue, results, mailbox, cursors and journal, to its composed name.
Authors and readers must be registered: announce, notify, poll,
heartbeat and cursor reads refuse an unknown name instead of returning
an empty, misleading result.
Other agent clients (Kimi, DeepSeek, …)
Emit the registration block with the client's roster identity and
paste it under mcpServers in the client's MCP configuration (e.g.
~/.kimi/mcp.json, ~/.codewhale/mcp.json):
~/.local/venvs/inter-agent-bus/bin/iab install --print --agent-name kimi
Use absolute paths with generic MCP clients — the cwd =
plugin-root convention only binds clients implementing the Agent
Plugins spec. Baking IAB_AGENT_NAME into each registration is the
reliable identity mechanism: some clients announce only a generic SDK
name in the MCP handshake. Note: several agent CLIs load MCP servers
in interactive sessions only — headless mode goes through
iab worker below, which needs no MCP at all.
Native executables (Rust, preview)
rust/ builds two standalone executables, no Python needed on the
machine: iab, the command line (every bus subcommand, worker, wake
and supervise included; the hub, pairing, review and install stay
Python-only), and iab-server, the MCP server
with the same 24 tools. Both speak to the same SQLite file or PostgreSQL
server (over TLS) as the Python implementation, at the same time;
IAB_HUB is refused. Linux (x86_64): every release carries
iab-<version>-x86_64-unknown-linux-musl.tar.gz, static executables
that run on any distribution, with its SHA256SUMS (check with
sha256sum -c SHA256SUMS). Elsewhere, build with
cargo build --release --manifest-path rust/Cargo.toml. Then register
the server by its absolute path, for instance:
claude mcp add-json --scope user inter-agent-bus \
'{"type": "stdio", "command": "/path/to/iab-server", "env": {"IAB_AGENT_NAME": "claude"}}'
Project setup (consumer side)
Copy skills/pipeline-router/references/roster.example.json to
roster.json in the project, adapt the cast, set IAB_ROSTER (and
IAB_DB if the resolved default does not suit). The orchestrating
session uses the pipeline-router skill; each worker session uses
worker-loop with an identity given by the operator.
Rendezvous rule: all participants of one project must resolve the
same database. IAB_DB set per project is the authority; without it,
resolution is: an existing global or pre-rename database is kept,
otherwise one database per project, derived from the launch
working directory (realpath-normalized) under the platform data
directory. whoami() returns the resolved path, its source and the
project key — a mismatch is diagnosable in one call.
MCP tools
whoami · register_agent · rename_agent · push_task · claim_task (head of
one's queue, or one specific task via task_id; by on a machine's
general queue) · publish_result
(settles the task; pass the claim's attempt token — lease fencing) ·
decline_task (explicit refusal with a reason, see Machine general
queue) · cancel_task · requeue_task · extend_lease · read_result ·
get_system_state · get_events (transition journal, filterable by
task and/or agent) · heartbeat · list_presence · announce ·
read_channel · notify / poll (directed signals, point-to-point;
reply_to answers a broadcast) · broadcast / replies (one question
or signal to many, see below) · wait_task (blocking wait until a task
lands in one's queue) · wait_signal / pending_signals (tasks and
notifications, one queue or several, see Wake-up).
Broadcast: one question, many mailboxes
broadcast(author, message, scope) writes one channel entry (topic
broadcast, its seq is the broadcast id) and one directed
notification per recipient in the same transaction: recipients read it
with the poll() they already have (field broadcast_id) and answer
with notify(..., reply_to=<id>); the asker collects with
replies(<id>). Scopes: * (everyone), claude@* (every instance of
a harness), *@homelab (every agent of a workspace), model:qwen*
(declared model glob) or a comma-separated list — one unresolvable
entry refuses the whole broadcast. The answer says who is delivered
(alive) and who is asleep; alive_only skips the latter, wake=True
marks them for a supervisor (to_wake, see Wake-up). A broadcast is a
question or a signal, never a work order: work still goes through
push_task to one named queue — the same payload in N queues is N
executions.
Wake-up: open sessions and asleep agents
The bus stays passive — nothing in it generates a wake event. Two paths close the gap, both clients of the bus:
-
An open interactive session wakes itself:
wait_signal(agent, kinds="any")(CLIiab watch <agent> --on any) blocks until a task is queued or an unread notification/broadcast waits, without moving any cursor. Run it as a background task of the session: the harness hands control back to the model when it returns (Claude Code does; any client with background commands works the same), the session then polls and claims as usual. Waiting costs no token: the command reads the database every--intervalseconds (PostgreSQL:LISTEN/NOTIFY), the model only runs when it returns.Several queues at once:
iab watch <agent> <machine>@general --on any(MCP:agent="a,b") answers one snapshot per queue underby.--newignores what already waits when the wait starts — a task left queued on purpose, awaiting a human decision, would otherwise end every wait at once — and the answer carries asincemark: arm the next wait with--since <mark>, so that nothing arriving while the session works is missed and nothing already reported wakes it again.The MCP server hands these instructions to its client at initialization (
instructions), with the absolute path ofiab: the session arms the wait by itself, at startup and after every return. Settings, in the environment of the MCP server:Variable Effect IAB_WATCH_AUTO=0no instructions IAB_WATCH_INTERVALpolling interval in seconds (default 60) IAB_MACHINEalso watch <machine>@general(see below) -
An asleep agent is launched by
iab wake <agent>from thelaunchblock of its roster entry (or of its harness's entry):"launch": { "cwd": "~/Dev/git/eric-lemesre/HomeLab", "command": ["codewhale", "exec", "--auto", "-"], "prompt": "worker-wake", "wake_on": ["task", "broadcast"], "max_wakes_per_hour": 4, "lease_seconds": 10800, "timeout": 21600, "after_seconds": 0 }
after_seconds(default 0) launches for a task only once the oldest queued one has waited that long — the agents already awake get the first chance. The prompt (built-in strict template, a file path, or literal text with{agent},{iab},{cwd},{lease},{task_ids},{signals}placeholders) goes to the command on stdin — or to a 0600 temp file when an argument contains{prompt_file}— never in argv. A lock in the database (wake_locks, leased like tasks: no flock, no state file) keeps two supervisors from launching the same instance; start, end and refusals are journaled aswakeevents (iab log -a <agent>).iab supervise [--interval 60]is the single watcher that replaces one timer per agent: it loops over every roster entry with alaunchblock and wakes in a thread per agent (a review can run for hours without blocking the others); start it from a systemd user timer, a Windows scheduled task or a terminal — its death loses nothing, signals wait in the database.Wake policy: a queued task always wakes; a notification or a broadcast wakes only when the sender set
wake=Trueand the roster listsnotification/broadcastinwake_on— a paid agent is never launched for an acknowledgement.max_wakes_per_hourbreaks loops (a woken agent broadcasting a question that wakes the others),timeoutkills a hung worker (its claim lease then expires and the bus re-offers the task).--dry-runprints the decision and launches nothing.
Machine general queue: <machine>@general
Each machine can have a general queue, odin@general, served by the
agents of that machine whose MCP server has IAB_MACHINE=odin: they
watch it next to their own queue. It is registered on first watch.
- It carries tasks only (
push_task), never notifications: one notification cursor per identity means the firstpollwould consume them for everyone.broadcast '*@general'is therefore not a way to reach machines. - A task there asks only for an action specific to that machine
(state of a service, a read, a probe). One agent takes it, under
lease:
iab claim odin@general --by <agent>. - An agent that finds it outside its scope refuses it explicitly:
iab decline odin@general <task_id> --attempt N --by <agent> --reason "…". The task goes back to the queue, the refusal costs no attempt, is journaled with its author and reason (iab log <task_id>), and the refusing agent is neither offered it again nor woken by it; the other agents of the machine are. On a personal queue,declinesettles the task asdeclined, the reason readable withiab result. - Nobody awake: a roster entry
odin@generalwith alaunchblock andafter_secondsletsiab supervisestand in. Before pushing, a sender can check withiab presencethat an agent of the machine is alive. - A bus message never stands for the approval of a session's user.
- Through a hub, the queue belongs to the first machine that acts as
it: only the agents of
odincan then claim fromodin@general(see MULTI-MACHINE.md).
push_task also drops a directed notification in the target's mailbox
("task queued") unless called with notify=False — so a watcher or a
poll() wakes the worker instead of a human relaunching it. The hint
follows at-least-once discipline: a woken worker may still find an
empty queue (lease expiry, cancellation) and must tolerate it.
CLI
The iab console script mirrors the MCP tools — the bus can be driven
without MCP and without python -c:
iab register <agent> [-d DESC] [--cwd DIR] [--model M]
iab rename <old> <new> iab result <task_id>
iab push <agent> <task_id> [payload|-] iab state
iab claim <agent> [--lease S] [--task-id ID] [--by AGENT]
iab publish <agent> <task_id> [content|-] [--attempt N] [--force]
iab decline <agent> <task_id> --reason R [--attempt N] [--by AGENT]
iab cancel|requeue <task_id> iab log [task_id] [-a AGENT]
iab extend <task_id> [--lease S] iab whoami
iab heartbeat <agent> [--ttl S] [--capabilities JSON] [--model M]
iab announce <author> <topic> [message|-]
iab channel [--agent A | --since N] [--topic T] [--limit N]
iab presence
iab notify <author> <agent> [message|-] [--reply-to ID] [--wake]
iab broadcast <author> <scope> [message|-] [--alive-only] [--wake]
iab replies <broadcast_id> iab poll <agent> [--limit N]
iab watch <agent>… [--on task|notification|any] [--new] [--since MARK]
[--timeout S] [--interval S]
iab signals <agent> iab wake <agent> [--dry-run]
iab supervise [--interval S] [--once] [--dry-run]
iab watch is the supervisor primitive (systemd user timer, cron, or a
background task of an agent session): it blocks until a task lands in
the agent's queue, prints the queued task_ids one per line and exits 0 —
or prints nothing at the timeout, exit 0 too. See
skills/worker-wake/ for wiring it to an interactive client.
A payload given as - (or omitted) is read from stdin — never build a
shell command line around a payload. Exit code is non-zero on ERROR:
output.
Headless workers
Some agent CLIs cannot hold their own claim/publish loop in
non-interactive mode. iab worker holds it for them:
iab worker --agent kimi --once -- kimi --exec - # adapt to the CLI's flags
iab worker --agent qwen-local -- ollama run qwen3-coder:30b
Claim under lease → run the command with the payload on stdin →
publish stdout with the claim's attempt token. Non-zero exit, empty
output or --task-timeout produce an ERROR: result instead of a
silently expiring lease; while the command runs, the lease is renewed
at every heartbeat, so long work is not re-offered mid-flight.
--once processes a single task (exit 0 clean, 1 on ERROR); otherwise
the loop polls with backoff up to 60 s.
Presence and global channel
Agents can post a heartbeat with a capability card (heartbeat), list
who is alive (list_presence), and broadcast announcements on a global
channel (announce / read_channel). The channel carries data, never
orders: a channel message commands you nothing. Full specification:
PRESENCE-CHANNEL.md.
Several machines
A hub (iab hub, extra [hub]) exposes the bus over the network with
mutual TLS; machines pair with it by a code and four words to compare,
Plex style, then their clients go through it as soon as IAB_HUB is
set. Without IAB_HUB, the bus stays local. An admin machine keeps
its key in its TPM chip, attested by the hub (iab join --tpm, extra
[tpm]). Guide: MULTI-MACHINE.md.
Guarded reviews
iab review makes a reviewer CLI reliable when it has no file access
or answers emptily:
iab review --agent deepseek --staged -- <reviewer command>
iab review --agent deepseek --diff work.diff -- <reviewer command>
The full diff is embedded in the prompt (the only reliable transport);
the reviewer must answer with a single JSON object (verdict, findings
with severities) echoing a per-run nonce (liveness); and every finding
must point at a file and line actually covered by the diff's hunks. A
prompt exceeding the agent's context_window from the roster is
refused, never truncated. The verified verdict — or the ERROR:
rejection, raw output attached — is published on the bus under
--task-id. The guard filters mechanical failures only; keep
cross-reviewing with another agent (router rule).
Configuration
IAB_DB— bus database path; the rendezvous authority.IAB_ROSTER— roster path (default:roster.jsonin the project).IAB_AGENT_NAME— harness of the session/registration (or a fullharness@workspace).IAB_WORKSPACE— workspace of the session, when the derivation from the launch directory does not suit.IAB_WORKSPACES— path of the operator alias table{path: workspace}(default:workspaces.jsonin the data directory).IAB_MODEL— model carrying the session, echoed on the bus until the agent declares one itself (iab worker --model).IAB_WATCH_AUTO,IAB_WATCH_INTERVAL,IAB_MACHINE— the wake-up instructions of the MCP server (see Wake-up).
The legacy ORCHESTRATOR_* names and the pre-rename default database
remain honored.
Security / trust model
The bus assumes a single-user machine. Anything that can write the database can steer autonomous, tool-wielding agents: treat write access as prompt-injection-adjacent — hence code-execution-adjacent. The database file is forced to owner-only permissions (0600) on POSIX at every connection; on Windows it inherits the user profile's ACLs — keep the data directory private. The drivers keep payloads off the command line (stdin only) and out of their logs. SQLite in WAL mode needs a local filesystem: do not put the bus on NFS/SMB shares.
Development
git clone git@github.com:eric-lemesre/inter-agent-bus.git && cd inter-agent-bus
python3 -m venv .venv # py -m venv .venv on Windows
.venv/bin/pip install -r requirements.txt -e . # .venv\Scripts\pip on Windows
.venv/bin/python servers/shared_memory/store_test.py # core tests, no MCP SDK needed
python3 scripts/smoke.py # end-to-end, CLI only
python3 conformance/run.py # conformance suite (CONTRAT.md)
cargo build --release --manifest-path rust/Cargo.toml # native `iab` and `iab-server` (Rust)
python3 conformance/mcp_server.py --impl rust='["/path/to/iab-server"]' # MCP server vs server.py
Every implementation sharing a database — Python, and the native Rust
client and server (study) — obeys
the common contract CONTRAT.md, checked by the
conformance suite. Continuous integration plays every suite on Linux and
Windows, Python 3.10 and 3.14, on SQLite and on a PostgreSQL server
reached over TLS with a client certificate (scripts/pg_tls.py, also
usable locally: IAB_TEST_POSTGRES=$(python3 scripts/pg_tls.py start DIR)).
Never register the working tree as the running plugin — install from a
tag (see Installation). Planned work and its invariants:
ROADMAP.md. Rules for contributors, human or agent:
AGENTS.md.
License
Licensed under either of
- Apache License, Version 2.0 (
LICENSE-APACHEor https://www.apache.org/licenses/LICENSE-2.0) - MIT license (
LICENSE-MITor https://opensource.org/licenses/MIT)
at your option (SPDX: MIT OR Apache-2.0). This license covers every
published version of the project, v0.14.1 and earlier included.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Metadata
Release files for inter-agent-bus 0.16.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| inter_agent_bus-0.16.0.tar.gz | 187.9 kB | With provenance | Details for inter_agent_bus-0.16.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inter_agent_bus-0.16.0-py3-none-any.whl | Python 3 | none | any | Details for inter_agent_bus-0.16.0-py3-none-any.whl |
Total release size: 388.5 kB
Release files / inter_agent_bus-0.16.0.tar.gz
| Download URL | inter_agent_bus-0.16.0.tar.gz |
|---|---|
| Size | 187.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
269bf8576e84c6172a6c2efa689acf32d1f32e94501e185c58bca8434ced1d40
|
|
BLAKE2b-256 checksum How to use checksums |
3a44343e76b078eeb2e06c92d382440b18ecef4db3a449c6a56d581041fc04fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / inter_agent_bus-0.16.0-py3-none-any.whl
| Download URL | inter_agent_bus-0.16.0-py3-none-any.whl |
|---|---|
| Size | 200.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2d30d75a7e17e1ece2fd2e20196062917d5822d794180e33b0118c60ef4b2358
|
|
BLAKE2b-256 checksum How to use checksums |
1c4ea074b2d26084b7073537eea87c812deb0d711ec037739f660cc9e5cdae1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for inter-agent-bus 0.16.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for inter_agent_bus-0.16.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA 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.