This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repo contains:
- mq9 documentation website — a VitePress static site deployed to mq9.robustmq.com
- Multi-language SDKs — Python, Java, Go, Rust, JavaScript client SDKs for the mq9 protocol
- langchain-mq9 — Official LangChain/LangGraph toolkit (8 tools wrapping all mq9 operations)
- Demo directory — Ready-to-run demos for all languages
mq9 is a message broker built specifically for Agent-to-Agent async communication. It is the fifth native protocol in RobustMQ, alongside MQTT, Kafka, NATS, and AMQP. The core idea: every Agent gets a mailbox; sender and receiver do not need to be online at the same time.
The broker implementation lives in the RobustMQ repo. This repo owns the docs site and all language SDKs.
npm install # install deps
npm run docs:dev # local dev server with hot reload
npm run docs:build # build to website/.vitepress/dist
npm run docs:preview # preview the built site locallyPush to main → GitHub Actions (.github/workflows/deploy.yml) builds and deploys to GitHub Pages automatically. No manual steps.
The website lives in website/ (not docs/).
| File | Purpose |
|---|---|
website/index.md |
Home page (renders <Home /> Vue component) |
website/what.md |
What mq9 is and why it exists |
website/for-agent.md |
How AI Agents use mq9 (audience: LLMs/Agents) |
website/for-engineer.md |
Integration guide (audience: developers) |
website/.vitepress/config.mts |
Site config, nav, SEO, analytics |
website/.vitepress/theme/ |
Custom theme: Home.vue, Layout.vue, custom.css |
The nav has four pages: Home, What, For Agent, For Engineer. No sidebar.
Home.vue follows the structure of the RobustMQ mq9 homepage — Hero, Problem, Core Capabilities (3 cards with code), 8 Scenarios grid, SDK cards, RobustMQ relationship, Protocol overview, CTA. White background.
The broker exposes 10 commands over NATS request/reply under $mq9.AI.*:
MAILBOX.CREATE— create a mailbox with optional name and TTLMSG.SEND.{mail_address}— send a message; supports headers for priority, delay, TTL, dedup key, tagsMSG.FETCH.{mail_address}— pull messages; stateful (group_name) or statelessMSG.ACK.{mail_address}— advance consumer group offsetMSG.QUERY.{mail_address}— inspect mailbox without affecting offsetMSG.DELETE.{mail_address}.{msg_id}— delete a specific messageAGENT.REGISTER/AGENT.UNREGISTER/AGENT.REPORT/AGENT.DISCOVER— Agent registry
The full protocol spec lives at ./protocol.md (repo root) and /Users/oker/robustmq/docs/en/mq9/Protocol.md.
The Python SDK (mq9 on PyPI) is in python/. Key design decisions:
- Main class:
Mq9Client mailbox_create(*, name, ttl) -> strreturns mail_address directlyconsume()returns aConsumerobject withawait consumer.stop(); loops automatically with retry on handler error +error_handlercallbackPriorityenum:NORMAL / URGENT / CRITICAL- Agent methods (
agent_register,agent_unregister,agent_report,agent_discover) are onMq9Clientdirectly
Lives in langchain-mq9/. Published to PyPI as langchain-mq9. Depends on mq9>=0.1.0 and langchain-core>=0.2.
8 tools exposed via Mq9Toolkit(server=...).get_tools():
create_mailbox,send_message,fetch_messages,ack_messagesquery_messages,delete_message,agent_register,agent_discover
All tools use FETCH+ACK model (stateful pull consumption). Works with LangChain Agents and LangGraph create_react_agent.
demo/ contains ready-to-run demos organized by language:
| Demo | Description |
|---|---|
message_demo |
Mailbox, send/fetch/ack, priority, key dedup, tags, delay, query, delete |
agent_demo |
Register, heartbeat, full-text search, semantic search, send to discovered agent |
langchain_demo |
LangChain + LangGraph tool usage (Python only) |
Languages: python/, javascript/, go/, rust/, java/.
Release is triggered by merging a PR with title starting release: into main. The VERSION file is the only file that needs to be changed manually — the release workflow auto-syncs the version to all SDK manifests (python/pyproject.toml, langchain-mq9/pyproject.toml, javascript/package.json, rust/Cargo.toml, java/pom.xml) before creating the tag and GitHub Release.
SDKs published: PyPI (mq9 + langchain-mq9), npm, crates.io, Maven Central, pkg.go.dev (Go module tag).