Skip to content

mq9 HTTP API

This document describes the HTTP management endpoints for the mq9 protocol. For common conventions, see COMMON.md.

Prerequisite: The following endpoints require the Broker to have the NATS/mq9 component enabled (roles contains broker and the nats-broker is running). If not enabled, the endpoint returns "nats-broker is not running".


1. Mailbox List

1.1 Query Mailbox List

  • Endpoint: GET /api/mq9/mail/list
  • Description: Query registered mq9 Mailboxes, with optional filtering by tenant or address, and pagination support.
  • Request Parameters (Query String):
ParameterTypeRequiredDescription
tenantstringNoExact filter by tenant name
mail_addressstringNoFuzzy match on Mailbox address
limitu32NoPage size, default 20
pageu32NoPage number, starting from 1
sort_fieldstringNoSort field: tenant, mail_address
sort_bystringNoSort direction: asc | desc
  • Response Example:
json
{
  "code": 0,
  "data": {
    "data": [
      {
        "tenant": "default",
        "mail_address": "agent.billing.001",
        "desc": "billing agent inbox",
        "ttl": 86400,
        "create_time": 1716451200000
      }
    ],
    "total_count": 1
  },
  "error": null
}

Response Fields:

FieldTypeDescription
tenantstringOwning tenant
mail_addressstringMailbox address, globally unique
descstringDescription
ttlu64Mailbox lifetime in seconds; 0 means no expiry
create_timeu64Creation timestamp (milliseconds)

2. Agent List

2.1 Query Agent List

  • Endpoint: GET /api/mq9/agent/list
  • Description: Query Agents registered to the mq9 registry, with optional filtering by tenant or name, and pagination support.
  • Request Parameters (Query String):
ParameterTypeRequiredDescription
tenantstringNoExact filter by tenant name
namestringNoFuzzy match on Agent name
limitu32NoPage size, default 20
pageu32NoPage number, starting from 1
sort_fieldstringNoSort field: tenant, name
sort_bystringNoSort direction: asc | desc
  • Response Example:
json
{
  "code": 0,
  "data": {
    "data": [
      {
        "tenant": "default",
        "name": "agent.billing.001",
        "agent_info": "{\"name\":\"agent.billing.001\",\"description\":\"Handles invoice and payment processing\",\"capabilities\":[\"billing\",\"invoice\"]}",
        "create_time": 1716451200000
      }
    ],
    "total_count": 1
  },
  "error": null
}

Response Fields:

FieldTypeDescription
tenantstringOwning tenant
namestringAgent name, unique within tenant
agent_infostringJSON string in A2A AgentCard format, describing Agent capabilities
create_timeu64Registration timestamp (milliseconds)

Notes

  1. Requires NATS Component: Both endpoints depend on nats_context. Returns an error if the Broker has not started the NATS component.
  2. Data Source: Data is read from the Broker's in-memory cache (cache_manager.mail_info / cache_manager.agent_info), reflecting currently loaded state.
  3. Mailbox Registration: Mailboxes are created via the mq9 protocol command AGENT.MAILBOX.CREATE. The HTTP endpoint provides query access only.
  4. Agent Registration: Agents are registered via the mq9 protocol command AGENT.REGISTER. The HTTP endpoint provides query access only.
🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀