You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/what.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,26 @@ Running multiple Agents? They need to talk to each other. mq9 handles it — rel
9
9
10
10
mq9 is async messaging infrastructure built specifically for Agent-to-Agent communication. Give each Agent a mailbox. Send messages to any Agent, online or not. Messages are stored and delivered when the recipient is ready. One binary to run, any NATS client to use.
11
11
12
+
## Why a mailbox?
13
+
14
+
Agents are not services. A service runs continuously and holds a stable address. An Agent spins up for a task, does its work, and disappears. Its identity is temporary. Its communication needs are temporary too.
15
+
16
+
This changes how you should think about addressing. A permanent address assigned to an ephemeral process is a mismatch — the address outlives the Agent, or worse, gets reused in ways that cause confusion. The right model is different: **communication should be scoped to the task, not the Agent.**
17
+
18
+
In mq9, an Agent requests a mailbox whenever it needs one. For each task, for each communication concern, create a mailbox. Share the `mail_id` with whoever needs to reach you. When the task ends, let the mailbox expire — it cleans itself up automatically via TTL. No deregistration, no cleanup code, no lingering state.
19
+
20
+
This means:
21
+
22
+
- An Agent handling five parallel tasks can have five mailboxes — one per task, completely isolated.
23
+
- An Agent can have separate mailboxes for task assignments, status broadcasts, and capability announcements.
24
+
- When an Agent restarts, it creates a fresh mailbox. Old messages don't bleed into a new execution context.
25
+
26
+
Mailboxes are cheap. Request as many as you need. The lifecycle is automatic. This is not a workaround — it's a design decision built around how Agents actually behave.
27
+
12
28
## The eight scenarios mq9 solves
13
29
30
+
> The subjects below omit the `$mq9.AI.` prefix for readability. Full subjects: `$mq9.AI.INBOX.{mail_id}.{priority}`, `$mq9.AI.BROADCAST.{domain}.{event}`, etc.
31
+
14
32
### 1. Sub-Agent sends result to parent {#scenario-1}
15
33
16
34
**Today:** Parent opens an HTTP server and waits. Sub-Agent calls back when done. If the parent restarts mid-task, the callback has nowhere to go. If the sub-Agent finishes while the parent is restarting, the result is lost.
@@ -41,7 +59,7 @@ mq9 is async messaging infrastructure built specifically for Agent-to-Agent comm
41
59
42
60
**The problem:** Pub/sub with no persistence is fire-and-forget. Adding persistence adds complexity.
43
61
44
-
**With mq9:** Publish to `BROADCAST.system.anomaly`. Any Agent subscribed with a wildcard (`BROADCAST.system.*`) receives it. Handlers that were offline get the message when they reconnect via `MAILBOX.QUERY`. Persistence is built in — no extra configuration.
62
+
**With mq9:** Publish to `BROADCAST.system.anomaly`. Any Agent subscribed with a wildcard (`BROADCAST.system.*`) receives it in real time. Note: BROADCAST is fire-and-forget — if a handler is offline when the alert fires, it misses it. For critical alerts that must survive offline handlers, send to their `INBOX` directly instead.
45
63
46
64
### 5. Cloud sends command to offline edge device {#scenario-5}
47
65
@@ -75,22 +93,6 @@ mq9 is async messaging infrastructure built specifically for Agent-to-Agent comm
75
93
76
94
**With mq9:** Agent publishes to `BROADCAST.system.capability` on startup with its skill list and `reply_to` address. Orchestrators subscribed to this channel build a live index. When an Agent goes offline (TTL expires), it disappears from the index naturally. No registry to maintain.
77
95
78
-
## Why a mailbox?
79
-
80
-
Agents are not services. A service runs continuously and holds a stable address. An Agent spins up for a task, does its work, and disappears. Its identity is temporary. Its communication needs are temporary too.
81
-
82
-
This changes how you should think about addressing. A permanent address assigned to an ephemeral process is a mismatch — the address outlives the Agent, or worse, gets reused in ways that cause confusion. The right model is different: **communication should be scoped to the task, not the Agent.**
83
-
84
-
In mq9, an Agent requests a mailbox whenever it needs one. For each task, for each communication concern, create a mailbox. Share the `mail_id` with whoever needs to reach you. When the task ends, let the mailbox expire — it cleans itself up automatically via TTL. No deregistration, no cleanup code, no lingering state.
85
-
86
-
This means:
87
-
88
-
- An Agent handling five parallel tasks can have five mailboxes — one per task, completely isolated.
89
-
- An Agent can have separate mailboxes for task assignments, status broadcasts, and capability announcements.
90
-
- When an Agent restarts, it creates a fresh mailbox. Old messages don't bleed into a new execution context.
91
-
92
-
Mailboxes are cheap. Request as many as you need. The lifecycle is automatic. This is not a workaround — it's a design decision built around how Agents actually behave.
93
-
94
96
## How it works
95
97
96
98
Every Agent gets a **mailbox** — temporary, task-scoped, built for how Agents actually work.
0 commit comments