Overview
TheQueuesClient is the Room API for simple room-scoped work queues. Use it when one participant or service needs to hand off JSON work items to another participant or service asynchronously.
CLI commands
Start with the CLI help, then use a few common commands:bash
Why use the Queues API?
- Decouple producers and consumers when work should happen later.
- Build lightweight background workflows without adding another queueing system.
- Coordinate multi-agent jobs where one participant produces work and another consumes it.
How it works
A queue stores JSON messages until a consumer receives them. Senders and receivers can be different participants or services in the same room. SDKs can list, open, send, receive, drain, and close queues, while Python auto-creates queues duringsend or receive when create=True.
Permissions and grants
The Queues API is controlled by thequeues grant on the participant token.
In practice:
listcontrols queue discoverysendcan be narrowed to specific queue namesreceivecan be narrowed separately to specific queue names
HTTP callbacks (Python)
Useawait room.queues.create_webhook(name="crawl-results") to obtain a url,
token, and expires_at for a third-party callback. Configure the external service
to POST JSON to the returned URL with Authorization: Bearer <token>.
The server verifies the connection’s queue-send permission. The returned token
grants send-only access to that project, room, and queue, with no queue read/list
or other room API permissions. It inherits the source credential’s expiry, with no
expiration when the source has none. expires_at is a Unix timestamp, or None
when there is no expiration. Applicable session and API-key revocation bindings
are retained in either case. Callbacks recheck authorization on delivery.
A room recreated with the same name requires a new callback token.
This requires an updated router and bearer-authenticated room connection. The
router’s existing MESHAGENT_API_URL must be public HTTPS and reachable by the
external service. Callers need no new settings. The Firecrawl toolkit performs
this setup automatically when explicit callback settings are omitted.
Disconnecting the original connection does not invalidate an unexpired callback
token. Expired or revoked credentials are rejected, including late deliveries.
Requesting another credential does not update one already held by a provider;
reconfigure or resubmit the job as appropriate and handle duplicate results if
earlier callbacks were delivered. Firecrawl reports expiry while polling, and a
completed provider crawl is not proof that all callbacks arrived.
API reference
Use the methods below to inspect queues, send JSON work items, and receive them from another participant or service in the same room.list()
List the queues currently visible in the room.
- Returns: An array of queue objects, each with a
nameandsize.
open(name)
Create or reopen a queue explicitly.
- Parameters:
name: Queue name.
send(name, message, create=True)
Send one JSON message to a queue.
- Parameters:
name: Queue name.message: JSON-serializable payload.create: Whentrue, create the queue if it does not already exist.
Queue size from the CLI
Usemeshagent room queue size when you only need the current queue length:
bash
Send email-shaped work from the CLI
Usemeshagent room queue send-mail when a queue consumer expects an email payload instead of a generic JSON work item:
bash
prompt: string or typed content items for the next turncontent: typed content items that should be passed through directlypath: explicit thread path for the work itemmodel,instructions,tools,sender_name: optional turn settings
Structured agent payloads
For queue-backed MeshAgent agents,prompt and content can carry typed content instead of a plain string.
- Think of
promptas “text the agent should read”. - Think of
contentas “input items the agent should receive”. - Use
promptwhen you want aroom:///...text file read from room storage and inlined into the turn as text before the turn starts. - Use
contentwhen you want aroom:///...file passed through as a file item in the turn input instead of being converted into text. contentdoes not create or update room artifacts by itself. It only defines the turn input that the queue consumer receives.promptcan be plain text, typed content, or typed content that includesroom:///...files. You only need a room file when you want to pull existing room content into the prompt.pathcan use UTC time tokens such as{YYYY},{MM},{DD},{HH},{mm}, and{SECOND}.
- Plain text prompt
- Prompt that reads a room file and turns it into text
room:///prompts/support-summary.md from room storage and inserts that file’s UTF-8 text into the turn before the agent runs.
- Content that preserves the room file as a file input
room:///docs/report.md as a file item in the turn input. It does not inline the file into prompt text, and it does not create a new room artifact.
receive(name, create=True, wait=True)
Receive one JSON message from a queue.
- Parameters:
name: Queue name.create: Whentrue, create the queue if it does not already exist.wait: Whentrue, wait until a message is available.
- Returns: A JSON payload, or
nullif the queue is empty andwait=False.
drain(name)
Remove all messages from a queue.
- Parameters:
name: Queue name.
close(name)
Close a queue so it stops accepting sends or receives until reopened.
- Parameters:
name: Queue name.
Queue
Queue objects returned by list() include:
name: Queue name.size: Queue length at the time of retrieval.