Skip to content
Agent Registry + Reliable Async Messaging

mq9

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.

NATS protocol · Python / Go / TypeScript / Java / Rust SDK · LangChain / LangGraph · MCP Server

Two Foundational Problems

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.

Today
etcd + Kafka + lots of glue code
Registry and messaging are separate systems, state diverges
HTTP cannot handle Agent offline scenarios
Every team rebuilds the same plumbing
mq9
Registry + messaging in one broker
Discover agents by capability semantics
Offline delivery — messages wait in mailbox
Designed to scale to millions of agents
mq9 architecture flow

Registry & Discovery + Reliable Async Messaging

🗂️

Agent Registry & Discovery

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
}'
📬

Reliable Async Messaging

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}'

Three-tier Priority + Message Attributes

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'

Eight real-world use cases

01

Sub-Agent result delivery

Sub-Agent writes results to the orchestrator's mailbox. Orchestrator FETCHes when ready — no blocking, no shared state.

02

Multi-worker competing task queue

Workers share a group_name — broker guarantees each task goes to exactly one worker. Workers join or leave freely.

03

Semantic capability discovery

Agents REGISTER capability descriptions. Others DISCOVER via natural language or keyword, then SEND tasks directly.

04

Cloud-to-edge command delivery

Cloud publishes commands to the edge mailbox. Messages persist during outage; on reconnect FETCH returns all pending in priority order.

05

Human-in-the-loop approval

Agent sends to approvals mailbox. Human FETCHes, reviews, SENDs result back — same protocol for both human and Agent.

06

Async Request-Reply

Agent A creates a private reply mailbox, includes reply_to. Agent B SENDs results there. A FETCHes when ready — no blocking.

07

Agent registration and health tracking

Workers REGISTER at startup, REPORT periodically, UNREGISTER at shutdown. Orchestrator uses DISCOVER to enumerate live workers.

08

Alert broadcasting

Detectors publish critical alerts to a shared mailbox. Handlers FETCH — even if offline, alerts persist and are available on reconnect.

Three ways to connect — pick what fits

🔌

Native NATS Client

mq9 is built on NATS. Any NATS client in any language works out of the box — zero extra dependencies.

GoPythonRustJavaJavaScriptC#RubyElixir
🤖

AI Framework Integration

Official LangChain toolkit — 8 tools covering all mq9 operations. Native A2A protocol support via mq9.a2a facade.

pip install langchain-mq9pip install mq9[a2a]
LangChainLangGraphA2AMCP Server

Complete Agent Communication Protocol

All operations use NATS request/reply under $mq9.AI.*. Responses include an error field; empty string means success.

Agent Registry
$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
Mailbox & Messaging
$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 message
Message Headers
mq9-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 seconds
mq9-ttl: {seconds}Per-message TTL, independent of mailbox TTL
mq9-tags: tag1,tag2Tags, filterable via QUERY

Start Building

Connect 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"}'