Multi-language client SDK for RobustMQ — a unified messaging engine built for the AI era.
RobustMQ is a single-binary broker that natively supports MQTT, Kafka, NATS, AMQP, and mq9 on a shared storage layer.
mq9 gives every agent a durable mailbox. Messages persist until TTL expires — senders and receivers do not need to be online simultaneously. It is purpose-built for multi-agent systems where tasks, results, and signals must survive disconnections and be delivered in priority order.
| Concept | Description |
|---|---|
| Mailbox | Agent's address. Private (UUID) or public (user-defined name). TTL-driven, auto-cleaned. |
| Priority | critical / urgent / normal (default, no suffix). Cross-priority ordering guaranteed by storage. |
| Store-first | Subscriber gets all non-expired messages on connect, then real-time going forward. |
| Queue group | Multiple subscribers sharing a group receive each message exactly once. |
Protocol operations:
| Operation | Subject |
|---|---|
| Create mailbox | $mq9.AI.MAILBOX.CREATE |
| Send message (default) | $mq9.AI.MAILBOX.MSG.{mail_id} |
| Send message (urgent/critical) | $mq9.AI.MAILBOX.MSG.{mail_id}.{priority} |
| Subscribe | $mq9.AI.MAILBOX.MSG.{mail_id}.* |
| List metadata | $mq9.AI.MAILBOX.LIST.{mail_id} |
| Delete message | $mq9.AI.MAILBOX.DELETE.{mail_id}.{msg_id} |
Full spec: docs/mq9-protocol.md
| Language | Package | Version | Install |
|---|---|---|---|
| Python | robustmq |
1.0.1 | pip install robustmq |
| Go | github.com/robustmq/robustmq-sdk/go |
v1.0.1 | go get github.com/robustmq/robustmq-sdk/go |
| JavaScript | @robustmq/sdk |
1.0.1 | npm install @robustmq/sdk |
| Java | com.robustmq:robustmq |
1.0.1 | Maven / Gradle (see below) |
| Rust | robustmq |
1.0.1 | cargo add robustmq |
| C# | RobustMQ |
1.0.1 | dotnet add package RobustMQ |
| Package | Description | Install |
|---|---|---|
langchain-mq9 |
LangChain tools for mq9 — give your Agents a persistent async inbox | pip install langchain-mq9 |
Python
pip install robustmqfrom robustmq.mq9 import Client, Priority
async with Client("nats://demo.robustmq.com:4222") as client:
mailbox = await client.create(ttl=3600)
await client.send(mailbox.mail_id, b"hello", priority=Priority.NORMAL)
async def handler(msg):
print(msg.payload)
await client.subscribe(mailbox.mail_id, handler)Go
go get github.com/robustmq/robustmq-sdk/goimport "github.com/robustmq/robustmq-sdk/go/mq9"
c := mq9.NewMQ9Client("nats://demo.robustmq.com:4222")
c.Connect()
mailbox, _ := c.Create(3600)
c.Send(mailbox.MailID, []byte("hello"), mq9.Normal)JavaScript / TypeScript
npm install @robustmq/sdkimport { MQ9Client } from "@robustmq/sdk/mq9";
const client = new MQ9Client({ server: "nats://demo.robustmq.com:4222" });
await client.connect();
const mailbox = await client.create({ ttl: 3600 });
await client.send(mailbox.mailId, "hello", "normal");Java (Maven)
<dependency>
<groupId>com.robustmq</groupId>
<artifactId>robustmq</artifactId>
<version>1.0.1</version>
</dependency>import com.robustmq.mq9.*;
MQ9Client client = new MQ9Client("nats://demo.robustmq.com:4222");
client.connect();
Mailbox mailbox = client.create(3600).get();
client.send(mailbox.getMailId(), "hello".getBytes(), Priority.NORMAL).get();Java (Gradle)
implementation 'com.robustmq:robustmq:1.0.1'Rust
[dependencies]
robustmq = "0.3"
tokio = { version = "1", features = ["full"] }use robustmq::mq9::{MQ9Client, Priority};
let client = MQ9Client::connect("nats://demo.robustmq.com:4222").await?;
let mailbox = client.create(3600, false, "", "").await?;
client.send(&mailbox.mail_id, b"hello", Priority::Normal).await?;C#
dotnet add package RobustMQusing RobustMQ.Mq9;
await using var client = new MQ9Client("nats://demo.robustmq.com:4222");
await client.ConnectAsync();
var mailbox = await client.CreateAsync(3600);
await client.SendAsync(mailbox.MailId, "hello"u8.ToArray(), Priority.Normal);mq9 integrates with popular AI orchestration frameworks. Each Agent node gets a persistent mailbox — tasks and results survive disconnections and are delivered in priority order.
langchain-mq9 provides six LangChain tools covering all mq9 protocol
operations. Drop them into any LangChain Agent or LangGraph node.
from langchain_mq9 import Mq9Toolkit
tools = Mq9Toolkit(server="nats://demo.robustmq.com:4222").get_tools()
# CreateMailboxTool, CreatePublicMailboxTool, SendMessageTool,
# GetMessagesTool, ListMessagesTool, DeleteMessageToolEach LangGraph node can own a private mq9 mailbox and communicate with other nodes asynchronously — the graph edges carry state, while mq9 carries the payloads.
from langchain_mq9 import CreateMailboxTool, SendMessageTool
async def node_writer(state):
create = CreateMailboxTool(server="nats://demo.robustmq.com:4222")
mail_id = await create._arun(ttl=120)
...Full examples: demo/demo-langchain-mq9/ · demo/demo-langgraph/
| Language | Docs | Demo |
|---|---|---|
| Python | docs/python.md | demo/demo-python/ |
| Go | docs/go.md | demo/demo-go/ |
| JavaScript | docs/javascript.md | demo/demo-javascript/ |
| Java | docs/java.md | demo/demo-java/ |
| C# | docs/csharp.md | demo/demo-csharp/ |
| Rust | docs/rust.md | demo/demo-rust/ |
| langchain-mq9 | docs/langchain-mq9.md | demo/demo-langchain-mq9/ |
| Multi-agent (Python ↔ Go) | — | demo/demo-multi-agent/ |
| LangGraph workflow | — | demo/demo-langgraph/ |
Each demo is a standalone project that connects to nats://demo.robustmq.com:4222 and runs the same scenario:
- Create a private mailbox (TTL 60s)
- Send 3 messages (critical / urgent / normal priority)
- Subscribe and print received messages
- List mailbox metadata, delete one message
- Create a public mailbox
# Python
cd demo/demo-python && pip install -r requirements.txt && python demo.py
# Go
cd demo/demo-go && go run .
# JavaScript
cd demo/demo-javascript && npm install && npm start
# Java
cd demo/demo-java && mvn compile exec:java
# Rust
cd demo/demo-rust && cargo run
# C#
cd demo/demo-csharp && dotnet run
# langchain-mq9
cd demo/demo-langchain-mq9 && pip install -r requirements.txt && python demo.py
# Multi-agent (Python + Go, two terminals)
cd demo/demo-multi-agent && go run agent_b.go # terminal 1
cd demo/demo-multi-agent && python agent_a.py # terminal 2
# LangGraph workflow
cd demo/demo-langgraph && pip install robustmq langchain-core langgraph langchain-openai
export OPENAI_API_KEY=sk-...
python langgraph_mq9_demo.pypython/ # Python SDK
go/ # Go SDK
javascript/ # JavaScript/TypeScript SDK
java/ # Java SDK
csharp/ # C# SDK
rust/ # Rust SDK
langchain-mq9/ # LangChain integration package
docs/ # SDK docs + protocol spec
demo/
demo-python/ # Python standalone demo
demo-go/ # Go standalone demo
demo-javascript/ # JavaScript standalone demo
demo-java/ # Java standalone demo (Maven)
demo-rust/ # Rust standalone demo
demo-csharp/ # C# standalone demo
demo-langchain-mq9/ # langchain-mq9 demo
demo-multi-agent/ # cross-language multi-agent demo (Python + Go)
demo-langgraph/ # LangGraph workflow demo
VERSION # Canonical version (currently 1.0.1)
- RobustMQ — the broker
- mq9 Protocol Specification — full protocol reference