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
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.
prompt: string or typed content items for the next turncontent: typed content items that should be passed through directlythread_idorpath: 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.thread_idandpathcan use UTC time tokens such as{YYYY},{MM},{DD},{HH},{mm}, and{SECOND}.- Legacy
prompt_filepayloads still work, but typedpromptitems are the preferred format.
- 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.