A broker built for AI Agents
mq9 provides Agent registration, discovery, and reliable asynchronous messaging in a single broker — designed to scale to millions of agents. Agent-to-agent communication, just works.
Every multi-agent system encounters the same two foundational problems.
① How do agents find each other? Discovery by capability, not hardcoded addresses.
② How do agents reliably communicate? When Agent A sends, Agent B may be offline, busy, or not yet running. Messages cannot be lost.
mq9 solves exactly these two problems, so developers can focus on agent logic rather than infrastructure.
AgentCard · semantic vector search · full-text
# Register with capability description
nats request '$mq9.AI.AGENT.REGISTER' '{
"name": "agent.translator",
"mailbox": "agent.translator",
"payload": "Multilingual translation; EN/ZH/JA/KO"
}'
# Discover by semantic intent
nats request '$mq9.AI.AGENT.DISCOVER' '{
"semantic": "translate Chinese to English",
"limit": 5
}'
# Keyword search
nats request '$mq9.AI.AGENT.DISCOVER' '{
"text": "translator", "limit": 10
}'Persistent mailbox · pull+ACK · offline delivery
# Create a mailbox (Agent's persistent address)
nats request '$mq9.AI.MAILBOX.CREATE' '{"name":"agent.inbox","ttl":3600}'
# Send — message persists until fetched
nats request '$mq9.AI.MSG.SEND.agent.inbox' --header 'mq9-priority:critical' '{"task":"analyze","id":"t-001"}'
# FETCH when ready (broker tracks offset)
nats request '$mq9.AI.MSG.FETCH.agent.inbox' '{"group_name":"workers","deliver":"earliest"}'
# ACK to advance offset
nats request '$mq9.AI.MSG.ACK.agent.inbox' '{"group_name":"workers","msg_id":1}'critical → urgent → normal · dedup · delayed delivery
# Priority: critical messages fetched first
--header 'mq9-priority:critical'
--header 'mq9-priority:urgent'
# (no header = normal)
# Key dedup — only latest per key kept
--header 'mq9-key:task.status'
# Delay visibility by N seconds
--header 'mq9-delay:30'
# Per-message TTL (independent of mailbox TTL)
--header 'mq9-ttl:300'
# Tags — filterable via QUERY
--header 'mq9-tags:billing,critical'Sub-Agent writes results to the orchestrator's mailbox. Orchestrator FETCHes when ready — no blocking, no shared state.
Workers share a group_name — broker guarantees each task goes to exactly one worker. Workers join or leave freely.
Agents REGISTER capability descriptions. Others DISCOVER via natural language or keyword, then SEND tasks directly.
Cloud publishes commands to the edge mailbox. Messages persist during outage; on reconnect FETCH returns all pending in priority order.
Agent sends to approvals mailbox. Human FETCHes, reviews, SENDs result back — same protocol for both human and Agent.
Agent A creates a private reply mailbox, includes reply_to. Agent B SENDs results there. A FETCHes when ready — no blocking.
Workers REGISTER at startup, REPORT periodically, UNREGISTER at shutdown. Orchestrator uses DISCOVER to enumerate live workers.
Detectors publish critical alerts to a shared mailbox. Handlers FETCH — even if offline, alerts persist and are available on reconnect.
mq9 is built on NATS. Any NATS client in any language works out of the box — zero extra dependencies.
Official SDK — five languages, unified API, type-safe, async-first. Typed Priority, consume loop, Agent registry methods.
pip install mq9npm install mq9go get github.com/robustmq/mq9/gocargo add mq9Official LangChain toolkit — 8 tools covering all mq9 operations. Native A2A protocol support via mq9.a2a facade.
pip install langchain-mq9pip install mq9[a2a]All operations use NATS request/reply under $mq9.AI.*. Responses include an error field; empty string means success.
$mq9.AI.AGENT.REGISTERRegister Agent with AgentCard capability description$mq9.AI.AGENT.DISCOVERFull-text + semantic vector search for Agents$mq9.AI.AGENT.REPORTAgent status heartbeat$mq9.AI.AGENT.UNREGISTERUnregister Agent at shutdown$mq9.AI.MAILBOX.CREATECreate persistent mailbox, declare TTL$mq9.AI.MSG.SEND.{addr}Send message; priority via mq9-priority header$mq9.AI.MSG.FETCH.{addr}Pull messages; stateful or stateless$mq9.AI.MSG.ACK.{addr}ACK to advance offset, enable resume-from-offset$mq9.AI.MSG.QUERY.{addr}Query messages, offset unaffected$mq9.AI.MSG.DELETE.{addr}.{id}Delete a specific messagemq9-priority: critical|urgentPriority; normal is default (no header)mq9-key: {key}Keep only latest per key (dedup compaction)mq9-delay: {seconds}Delay visibility by N secondsmq9-ttl: {seconds}Per-message TTL, independent of mailbox TTLmq9-tags: tag1,tag2Tags, filterable via QUERYConnect to the public demo server — no local setup required.
export NATS_URL=nats://demo.robustmq.com:4222
# Register your Agent
nats request '$mq9.AI.AGENT.REGISTER' \
'{"name":"my.agent","mailbox":"my.inbox","payload":"My Agent capabilities"}'
# Create a mailbox
nats request '$mq9.AI.MAILBOX.CREATE' '{"name":"my.inbox","ttl":3600}'
# Send a message
nats request '$mq9.AI.MSG.SEND.my.inbox' \
--header 'mq9-priority:urgent' \
'{"task":"summarize dataset A"}'
# FETCH (resumes from last ACK)
nats request '$mq9.AI.MSG.FETCH.my.inbox' \
'{"group_name":"worker","deliver":"earliest"}'