inter-agent-bus 0.15.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. inter_agent_bus-0.15.0/LICENSE-APACHE +176 -0
  2. inter_agent_bus-0.15.0/LICENSE-MIT +21 -0
  3. inter_agent_bus-0.15.0/PKG-INFO +414 -0
  4. inter_agent_bus-0.15.0/README.md +384 -0
  5. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/PKG-INFO +414 -0
  6. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/SOURCES.txt +38 -0
  7. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/dependency_links.txt +1 -0
  8. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/entry_points.txt +3 -0
  9. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/requires.txt +12 -0
  10. inter_agent_bus-0.15.0/inter_agent_bus.egg-info/top_level.txt +1 -0
  11. inter_agent_bus-0.15.0/pyproject.toml +49 -0
  12. inter_agent_bus-0.15.0/servers/shared_memory/__init__.py +6 -0
  13. inter_agent_bus-0.15.0/servers/shared_memory/access.py +66 -0
  14. inter_agent_bus-0.15.0/servers/shared_memory/admin.py +99 -0
  15. inter_agent_bus-0.15.0/servers/shared_memory/attest.py +454 -0
  16. inter_agent_bus-0.15.0/servers/shared_memory/attest_test.py +245 -0
  17. inter_agent_bus-0.15.0/servers/shared_memory/authz.py +250 -0
  18. inter_agent_bus-0.15.0/servers/shared_memory/cli.py +601 -0
  19. inter_agent_bus-0.15.0/servers/shared_memory/dialect.py +374 -0
  20. inter_agent_bus-0.15.0/servers/shared_memory/hub.py +756 -0
  21. inter_agent_bus-0.15.0/servers/shared_memory/hub_test.py +907 -0
  22. inter_agent_bus-0.15.0/servers/shared_memory/join.py +341 -0
  23. inter_agent_bus-0.15.0/servers/shared_memory/pairing.py +315 -0
  24. inter_agent_bus-0.15.0/servers/shared_memory/pairwords.py +46 -0
  25. inter_agent_bus-0.15.0/servers/shared_memory/pki.py +332 -0
  26. inter_agent_bus-0.15.0/servers/shared_memory/registry.py +689 -0
  27. inter_agent_bus-0.15.0/servers/shared_memory/remote.py +357 -0
  28. inter_agent_bus-0.15.0/servers/shared_memory/review.py +195 -0
  29. inter_agent_bus-0.15.0/servers/shared_memory/server.py +248 -0
  30. inter_agent_bus-0.15.0/servers/shared_memory/softtpm.py +149 -0
  31. inter_agent_bus-0.15.0/servers/shared_memory/store.py +1679 -0
  32. inter_agent_bus-0.15.0/servers/shared_memory/store_test.py +1413 -0
  33. inter_agent_bus-0.15.0/servers/shared_memory/testdb.py +25 -0
  34. inter_agent_bus-0.15.0/servers/shared_memory/tpm.py +207 -0
  35. inter_agent_bus-0.15.0/servers/shared_memory/tpm_roots.pem +820 -0
  36. inter_agent_bus-0.15.0/servers/shared_memory/tpm_test.py +199 -0
  37. inter_agent_bus-0.15.0/servers/shared_memory/tpmtls.py +92 -0
  38. inter_agent_bus-0.15.0/servers/shared_memory/wake.py +353 -0
  39. inter_agent_bus-0.15.0/servers/shared_memory/worker.py +144 -0
  40. inter_agent_bus-0.15.0/setup.cfg +4 -0
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eric Lemesre
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,414 @@
1
+ Metadata-Version: 2.4
2
+ Name: inter-agent-bus
3
+ Version: 0.15.0
4
+ Summary: Coordination bus between heterogeneous AI agents: task queues with claim/ack leases, shared result store (SQLite), roster-driven routing — the mechanism, never the cast.
5
+ License-Expression: MIT OR Apache-2.0
6
+ Project-URL: Homepage, https://github.com/eric-lemesre/inter-agent-bus
7
+ Project-URL: Repository, https://github.com/eric-lemesre/inter-agent-bus
8
+ Project-URL: Issues, https://github.com/eric-lemesre/inter-agent-bus/issues
9
+ Keywords: agents,mcp,multi-agent,orchestration,task-queue,claude
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE-MIT
20
+ License-File: LICENSE-APACHE
21
+ Provides-Extra: server
22
+ Requires-Dist: mcp>=2.0; extra == "server"
23
+ Provides-Extra: hub
24
+ Requires-Dist: cryptography>=42; extra == "hub"
25
+ Provides-Extra: postgres
26
+ Requires-Dist: psycopg>=3.2; extra == "postgres"
27
+ Provides-Extra: tpm
28
+ Requires-Dist: tpm2-pytss>=2.1; extra == "tpm"
29
+ Dynamic: license-file
30
+
31
+ # inter-agent-bus
32
+
33
+ 🇬🇧 English · 🇫🇷 [Français](README.fr.md)
34
+
35
+ An **[Agent Plugins](https://agent-plugins.org/) v1.0.0** plugin: a
36
+ coordination bus between heterogeneous AI agents (Claude Code, Kimi,
37
+ DeepSeek, local models…). The plugin provides the **mechanism** — task
38
+ queues under lease (claim/ack), a shared result store, an event
39
+ journal, an observable state — and **never the cast**: agents and
40
+ their roles are declared by the consuming project in its roster.
41
+
42
+ ## Two layers, one bus
43
+
44
+ - **stdio is the transport**: each agent client spawns **its own
45
+ instance** of the MCP server (one subprocess per client). Nothing is
46
+ shared at this layer.
47
+ - **SQLite is the bus**: all server instances read and write the
48
+ **same database** (WAL mode, immediate transactions). *This* is
49
+ where sharing happens. No daemon to start or supervise.
50
+
51
+ ## Task lifecycle
52
+
53
+ `queued → claimed (lease) → done`, with two terminal side exits:
54
+ `dead` (dead-lettered after `max_attempts` expired leases —
55
+ `requeue_task` revives it) and `cancelled`. An expired lease re-offers
56
+ the task, so an agent dying after `claim_task` does not lose it.
57
+ Delivery is therefore **at-least-once**: tasks should be idempotent.
58
+ Settling is **fenced**: the claim response carries an attempt number,
59
+ and `publish_result` refuses a staler token — a slow worker whose
60
+ lease expired cannot overwrite the result of the worker that took the
61
+ task over. Every transition is journaled (`get_events`, `iab log`).
62
+
63
+ ## Installation (operator)
64
+
65
+ Run the bus from a dedicated venv installed from a **published release** (PyPI),
66
+ never from a working tree:
67
+
68
+ ```bash
69
+ python3 -m venv ~/.local/venvs/inter-agent-bus
70
+ ~/.local/venvs/inter-agent-bus/bin/pip install \
71
+ 'inter-agent-bus[server]==0.15.0'
72
+ ~/.local/venvs/inter-agent-bus/bin/iab install --scope user
73
+ ```
74
+
75
+ `iab install` registers the MCP server in Claude Code (through
76
+ `claude mcp add-json`) as the `iab-server` executable of that venv —
77
+ no repository path involved. A newly added server only loads in the
78
+ **next** session: reopen, then call `whoami()` (it returns the
79
+ identity, the resolved bus database and how it was chosen). To
80
+ upgrade: `pip install -U` with the next tag, then reopen sessions.
81
+ The baked value is the **harness** (`--agent-name`, default `claude`);
82
+ each session completes it with the workspace it is launched in (see
83
+ *Identity* below), so one user-scope install serves every project
84
+ (`--print` to inspect the JSON without applying, `--scope project|local`
85
+ for narrower scopes, `--agent-name harness@workspace` to pin both).
86
+
87
+ ### Identity: one instance = `harness@workspace`
88
+
89
+ An agent on the bus is an **instance**: a harness (the client carrying
90
+ the model — `claude`, `kimi`, `codewhale`, `opencode`…) on a workspace
91
+ (the repository or folder it works in — `homelab`, `infra`…), written
92
+ `harness@workspace`. Queue, presence and notification cursors are per
93
+ instance, so two Claude Code sessions on two repositories no longer
94
+ share one mailbox. `whoami()` tells how the name was built:
95
+
96
+ - harness: `IAB_AGENT_NAME` (legacy `ORCHESTRATOR_AGENT_NAME` honored);
97
+ a value already holding an `@` is the full name;
98
+ - workspace: `IAB_WORKSPACE` if set, else derived from the server's
99
+ launch directory — operator alias table first (`IAB_WORKSPACES`, a
100
+ JSON `{path: name}`, default `<data dir>/workspaces.json`, longest
101
+ prefix wins), then the name of the enclosing git repository (a
102
+ submodule yields its own name), else the folder's own name;
103
+ - model: `IAB_MODEL` is echoed; an instance declares the real one with
104
+ `register_agent(..., model=)` or `heartbeat(..., model=)` — session
105
+ state, kept in the presence row, never guessed by the plugin.
106
+
107
+ A connected client named by its environment is **registered on its
108
+ first tool call** (description empty, launch directory recorded). A bare
109
+ harness is accepted as a target only while it designates a single
110
+ instance; otherwise the bus refuses and lists the candidates — a legacy
111
+ bare row counts as one, `rename_agent` (CLI `iab rename`) moves it, with
112
+ its queue, results, mailbox, cursors and journal, to its composed name.
113
+ Authors and readers must be registered: `announce`, `notify`, `poll`,
114
+ `heartbeat` and cursor reads refuse an unknown name instead of returning
115
+ an empty, misleading result.
116
+
117
+ ### Other agent clients (Kimi, DeepSeek, …)
118
+
119
+ Emit the registration block with the client's roster identity and
120
+ paste it under `mcpServers` in the client's MCP configuration (e.g.
121
+ `~/.kimi/mcp.json`, `~/.codewhale/mcp.json`):
122
+
123
+ ```bash
124
+ ~/.local/venvs/inter-agent-bus/bin/iab install --print --agent-name kimi
125
+ ```
126
+
127
+ Use **absolute paths** with generic MCP clients — the `cwd` =
128
+ plugin-root convention only binds clients implementing the Agent
129
+ Plugins spec. Baking `IAB_AGENT_NAME` into each registration is the
130
+ reliable identity mechanism: some clients announce only a generic SDK
131
+ name in the MCP handshake. Note: several agent CLIs load MCP servers
132
+ in interactive sessions only — headless mode goes through
133
+ `iab worker` below, which needs no MCP at all.
134
+
135
+ ### Native executables (Rust, preview)
136
+
137
+ `rust/` builds two standalone executables, no Python needed on the
138
+ machine: `iab`, the command line (every bus subcommand, `worker`, `wake`
139
+ and `supervise` included; the hub, pairing, `review` and `install` stay
140
+ Python-only), and `iab-server`, the MCP server
141
+ with the same 23 tools. Both speak to the same SQLite file or PostgreSQL
142
+ server (over TLS) as the Python implementation, at the same time;
143
+ `IAB_HUB` is refused. No archive is published yet: build with
144
+ `cargo build --release --manifest-path rust/Cargo.toml`, then register
145
+ the server by its absolute path, for instance:
146
+
147
+ ```bash
148
+ claude mcp add-json --scope user inter-agent-bus \
149
+ '{"type": "stdio", "command": "/path/to/iab-server", "env": {"IAB_AGENT_NAME": "claude"}}'
150
+ ```
151
+
152
+ ## Project setup (consumer side)
153
+
154
+ Copy `skills/pipeline-router/references/roster.example.json` to
155
+ `roster.json` in the project, adapt the cast, set `IAB_ROSTER` (and
156
+ `IAB_DB` if the resolved default does not suit). The orchestrating
157
+ session uses the `pipeline-router` skill; each worker session uses
158
+ `worker-loop` with an identity given by the operator.
159
+
160
+ **Rendezvous rule**: all participants of one project must resolve the
161
+ same database. `IAB_DB` set per project is the authority; without it,
162
+ resolution is: an existing global or pre-rename database is kept,
163
+ otherwise **one database per project**, derived from the launch
164
+ working directory (realpath-normalized) under the platform data
165
+ directory. `whoami()` returns the resolved path, its source and the
166
+ project key — a mismatch is diagnosable in one call.
167
+
168
+ ## MCP tools
169
+
170
+ `whoami` · `register_agent` · `rename_agent` · `push_task` · `claim_task` (head of
171
+ one's queue, or one specific task via `task_id`) · `publish_result`
172
+ (settles the task; pass the claim's `attempt` token — lease fencing) ·
173
+ `cancel_task` · `requeue_task` · `extend_lease` · `read_result` ·
174
+ `get_system_state` · `get_events` (transition journal, filterable by
175
+ task and/or agent) · `heartbeat` · `list_presence` · `announce` ·
176
+ `read_channel` · `notify` / `poll` (directed signals, point-to-point;
177
+ `reply_to` answers a broadcast) · `broadcast` / `replies` (one question
178
+ or signal to many, see below) · `wait_task` (blocking wait until a task
179
+ lands in one's queue) · `wait_signal` / `pending_signals` (tasks and
180
+ notifications, see *Wake-up*).
181
+
182
+ ### Broadcast: one question, many mailboxes
183
+
184
+ `broadcast(author, message, scope)` writes one channel entry (topic
185
+ `broadcast`, its seq is the broadcast id) **and** one directed
186
+ notification per recipient in the same transaction: recipients read it
187
+ with the `poll()` they already have (field `broadcast_id`) and answer
188
+ with `notify(..., reply_to=<id>)`; the asker collects with
189
+ `replies(<id>)`. Scopes: `*` (everyone), `claude@*` (every instance of
190
+ a harness), `*@homelab` (every agent of a workspace), `model:qwen*`
191
+ (declared model glob) or a comma-separated list — one unresolvable
192
+ entry refuses the whole broadcast. The answer says who is `delivered`
193
+ (alive) and who is `asleep`; `alive_only` skips the latter, `wake=True`
194
+ marks them for a supervisor (`to_wake`, see *Wake-up*). A broadcast is a
195
+ question or a signal, **never a work order**: work still goes through
196
+ `push_task` to one named queue — the same payload in N queues is N
197
+ executions.
198
+
199
+ ### Wake-up: open sessions and asleep agents
200
+
201
+ The bus stays passive — nothing in it generates a wake event. Two paths
202
+ close the gap, both clients of the bus:
203
+
204
+ - **An open interactive session** wakes itself: `wait_signal(agent,
205
+ kinds="any")` (CLI `iab watch <agent> --on any`) blocks until a task
206
+ is queued or an unread notification/broadcast waits, without moving
207
+ any cursor. Run it as a **background task** of the session: the
208
+ harness hands control back to the model when it returns (Claude Code
209
+ does; any client with background commands works the same), the
210
+ session then polls and claims as usual.
211
+ - **An asleep agent** is launched by `iab wake <agent>` from the
212
+ `launch` block of its roster entry (or of its harness's entry):
213
+
214
+ ```json
215
+ "launch": {
216
+ "cwd": "~/Dev/git/eric-lemesre/HomeLab",
217
+ "command": ["codewhale", "exec", "--auto", "-"],
218
+ "prompt": "worker-wake",
219
+ "wake_on": ["task", "broadcast"],
220
+ "max_wakes_per_hour": 4,
221
+ "lease_seconds": 10800,
222
+ "timeout": 21600
223
+ }
224
+ ```
225
+
226
+ The prompt (built-in strict template, a file path, or literal text with
227
+ `{agent}`, `{iab}`, `{cwd}`, `{lease}`, `{task_ids}`, `{signals}`
228
+ placeholders) goes to the command **on stdin** — or to a 0600 temp
229
+ file when an argument contains `{prompt_file}` — never in argv. A lock
230
+ **in the database** (`wake_locks`, leased like tasks: no flock, no
231
+ state file) keeps two supervisors from launching the same instance;
232
+ start, end and refusals are journaled as `wake` events (`iab log -a
233
+ <agent>`). `iab supervise [--interval 60]` is the single watcher that
234
+ replaces one timer per agent: it loops over every roster entry with a
235
+ `launch` block and wakes in a thread per agent (a review can run for
236
+ hours without blocking the others); start it from a systemd user
237
+ timer, a Windows scheduled task or a terminal — its death loses
238
+ nothing, signals wait in the database.
239
+
240
+ **Wake policy**: a queued task always wakes; a notification or a
241
+ broadcast wakes only when the sender set `wake=True` **and** the
242
+ roster lists `notification` / `broadcast` in `wake_on` — a paid agent
243
+ is never launched for an acknowledgement. `max_wakes_per_hour` breaks
244
+ loops (a woken agent broadcasting a question that wakes the others),
245
+ `timeout` kills a hung worker (its claim lease then expires and the
246
+ bus re-offers the task). `--dry-run` prints the decision and launches
247
+ nothing.
248
+
249
+ `push_task` also drops a directed notification in the target's mailbox
250
+ ("task queued") unless called with `notify=False` — so a watcher or a
251
+ `poll()` wakes the worker instead of a human relaunching it. The hint
252
+ follows at-least-once discipline: a woken worker may still find an
253
+ empty queue (lease expiry, cancellation) and must tolerate it.
254
+
255
+ ## CLI
256
+
257
+ The `iab` console script mirrors the MCP tools — the bus can be driven
258
+ without MCP and without `python -c`:
259
+
260
+ ```
261
+ iab register <agent> [-d DESC] [--cwd DIR] [--model M]
262
+ iab rename <old> <new> iab result <task_id>
263
+ iab push <agent> <task_id> [payload|-] iab state
264
+ iab claim <agent> [--lease S] [--task-id ID]
265
+ iab publish <agent> <task_id> [content|-] [--attempt N] [--force]
266
+ iab cancel|requeue <task_id> iab log [task_id] [-a AGENT]
267
+ iab extend <task_id> [--lease S] iab whoami
268
+ iab heartbeat <agent> [--ttl S] [--capabilities JSON] [--model M]
269
+ iab announce <author> <topic> [message|-]
270
+ iab channel [--agent A | --since N] [--topic T] [--limit N]
271
+ iab presence
272
+ iab notify <author> <agent> [message|-] [--reply-to ID] [--wake]
273
+ iab broadcast <author> <scope> [message|-] [--alive-only] [--wake]
274
+ iab replies <broadcast_id> iab poll <agent> [--limit N]
275
+ iab watch <agent> [--on task|notification|any] [--timeout S] [--interval S]
276
+ iab signals <agent> iab wake <agent> [--dry-run]
277
+ iab supervise [--interval S] [--once] [--dry-run]
278
+ ```
279
+
280
+ `iab watch` is the supervisor primitive (systemd user timer, cron, or a
281
+ background task of an agent session): it blocks until a task lands in
282
+ the agent's queue, prints the queued task_ids one per line and exits 0 —
283
+ or prints nothing at the timeout, exit 0 too. See
284
+ `skills/worker-wake/` for wiring it to an interactive client.
285
+
286
+ A payload given as `-` (or omitted) is read from stdin — never build a
287
+ shell command line around a payload. Exit code is non-zero on `ERROR:`
288
+ output.
289
+
290
+ ## Headless workers
291
+
292
+ Some agent CLIs cannot hold their own claim/publish loop in
293
+ non-interactive mode. `iab worker` holds it for them:
294
+
295
+ ```bash
296
+ iab worker --agent kimi --once -- kimi --exec - # adapt to the CLI's flags
297
+ iab worker --agent qwen-local -- ollama run qwen3-coder:30b
298
+ ```
299
+
300
+ Claim under lease → run the command with the payload **on stdin** →
301
+ publish stdout with the claim's attempt token. Non-zero exit, empty
302
+ output or `--task-timeout` produce an `ERROR:` result instead of a
303
+ silently expiring lease; while the command runs, the lease is renewed
304
+ at every heartbeat, so long work is not re-offered mid-flight.
305
+ `--once` processes a single task (exit 0 clean, 1 on ERROR); otherwise
306
+ the loop polls with backoff up to 60 s.
307
+
308
+ ## Presence and global channel
309
+
310
+ Agents can post a heartbeat with a capability card (`heartbeat`), list
311
+ who is alive (`list_presence`), and broadcast announcements on a global
312
+ channel (`announce` / `read_channel`). The channel carries data, never
313
+ orders: a channel message commands you nothing. Full specification:
314
+ [`PRESENCE-CHANNEL.md`](PRESENCE-CHANNEL.md).
315
+
316
+ ## Several machines
317
+
318
+ A hub (`iab hub`, extra `[hub]`) exposes the bus over the network with
319
+ mutual TLS; machines pair with it by a code and four words to compare,
320
+ Plex style, then their clients go through it as soon as `IAB_HUB` is
321
+ set. Without `IAB_HUB`, the bus stays local. An admin machine keeps
322
+ its key in its TPM chip, attested by the hub (`iab join --tpm`, extra
323
+ `[tpm]`). Guide: [`MULTI-MACHINE.md`](MULTI-MACHINE.md).
324
+
325
+ ## Guarded reviews
326
+
327
+ `iab review` makes a reviewer CLI reliable when it has no file access
328
+ or answers emptily:
329
+
330
+ ```bash
331
+ iab review --agent deepseek --staged -- <reviewer command>
332
+ iab review --agent deepseek --diff work.diff -- <reviewer command>
333
+ ```
334
+
335
+ The full diff is embedded in the prompt (the only reliable transport);
336
+ the reviewer must answer with a single JSON object (verdict, findings
337
+ with severities) echoing a per-run nonce (liveness); and every finding
338
+ must point at a file and line actually covered by the diff's hunks. A
339
+ prompt exceeding the agent's `context_window` from the roster is
340
+ refused, never truncated. The verified verdict — or the `ERROR:`
341
+ rejection, raw output attached — is published on the bus under
342
+ `--task-id`. The guard filters *mechanical* failures only; keep
343
+ cross-reviewing with another agent (router rule).
344
+
345
+ ## Configuration
346
+
347
+ - `IAB_DB` — bus database path; the rendezvous authority.
348
+ - `IAB_ROSTER` — roster path (default: `roster.json` in the project).
349
+ - `IAB_AGENT_NAME` — harness of the session/registration (or a full
350
+ `harness@workspace`).
351
+ - `IAB_WORKSPACE` — workspace of the session, when the derivation from
352
+ the launch directory does not suit.
353
+ - `IAB_WORKSPACES` — path of the operator alias table `{path: workspace}`
354
+ (default: `workspaces.json` in the data directory).
355
+ - `IAB_MODEL` — model carrying the session, echoed on the bus until the
356
+ agent declares one itself (`iab worker --model`).
357
+
358
+ The legacy `ORCHESTRATOR_*` names and the pre-rename default database
359
+ remain honored.
360
+
361
+ ## Security / trust model
362
+
363
+ The bus assumes a single-user machine. Anything that can write the
364
+ database can steer autonomous, tool-wielding agents: treat write
365
+ access as prompt-injection-adjacent — hence code-execution-adjacent.
366
+ The database file is forced to owner-only permissions (0600) on POSIX
367
+ at every connection; on Windows it inherits the user profile's ACLs —
368
+ keep the data directory private. The drivers keep payloads off the
369
+ command line (stdin only) and out of their logs. SQLite in WAL mode
370
+ needs a local filesystem: do not put the bus on NFS/SMB shares.
371
+
372
+ ## Development
373
+
374
+ ```bash
375
+ git clone git@github.com:eric-lemesre/inter-agent-bus.git && cd inter-agent-bus
376
+ python3 -m venv .venv # py -m venv .venv on Windows
377
+ .venv/bin/pip install -r requirements.txt -e . # .venv\Scripts\pip on Windows
378
+ .venv/bin/python servers/shared_memory/store_test.py # core tests, no MCP SDK needed
379
+ python3 scripts/smoke.py # end-to-end, CLI only
380
+ python3 conformance/run.py # conformance suite (CONTRAT.md)
381
+ cargo build --release --manifest-path rust/Cargo.toml # native `iab` and `iab-server` (Rust)
382
+ python3 conformance/mcp_server.py --impl rust='["/path/to/iab-server"]' # MCP server vs server.py
383
+ ```
384
+
385
+ Every implementation sharing a database — Python, and the native Rust
386
+ client and server ([study](docs/AMELIORATIONS-2026-11-04-client-rust.md)) — obeys
387
+ the common contract [`CONTRAT.md`](CONTRAT.md), checked by the
388
+ conformance suite. Continuous integration plays every suite on Linux and
389
+ Windows, Python 3.10 and 3.14, on SQLite and on a PostgreSQL server
390
+ reached over TLS with a client certificate (`scripts/pg_tls.py`, also
391
+ usable locally: `IAB_TEST_POSTGRES=$(python3 scripts/pg_tls.py start
392
+ DIR)`).
393
+
394
+ Never register the working tree as the running plugin — install from a
395
+ tag (see Installation). Planned work and its invariants:
396
+ [`ROADMAP.md`](ROADMAP.md). Rules for contributors, human or agent:
397
+ [`AGENTS.md`](AGENTS.md).
398
+
399
+ ## License
400
+
401
+ Licensed under either of
402
+
403
+ - Apache License, Version 2.0 ([`LICENSE-APACHE`](LICENSE-APACHE) or
404
+ <https://www.apache.org/licenses/LICENSE-2.0>)
405
+ - MIT license ([`LICENSE-MIT`](LICENSE-MIT) or
406
+ <https://opensource.org/licenses/MIT>)
407
+
408
+ at your option (SPDX: `MIT OR Apache-2.0`). This license covers every
409
+ published version of the project, v0.14.1 and earlier included.
410
+
411
+ Unless you explicitly state otherwise, any contribution intentionally
412
+ submitted for inclusion in the work by you, as defined in the Apache-2.0
413
+ license, shall be dual licensed as above, without any additional terms or
414
+ conditions.