Requirements
Your agent image needs:pipecat-ai[moq]1.13.0 or newer.- The Pipecat Cloud base image
dailyco/pipecat-base0.2.7 or newer. Name the version in your Dockerfile’sFROMrather than relying onlatest: a cloud build can get the previous base image for up to a day after a release. pipecatcloud1.3.0 or newer, if your image installs its own rather than using the one the base image provides.
@pipecat-ai/client-js 1.16 and @pipecat-ai/moq-transport 0.3.3 or newer.
Pipecat Cloud starts a MoQ session only for an agent whose current deployment
can serve one. While a new deployment rolls out or reports what it can serve,
/start with transport: "moq" can return 409 Conflict: retry. An image
that can’t serve MoQ gets 400 Bad Request, with a message that says what to
rebuild. See Errors.Bot code
Add themoq extra to your requirements:
requirements.txt
bot() a MOQSessionArguments, which subclasses pipecat-ai’s MOQRunnerArguments. create_transport takes the "moq" entry for it and dials the relay, so one agent can serve MoQ beside its other transports:
bot.py
MOQSessionArguments keeps it out of its repr; keep it out of your own logs too. See Session arguments for the fields.
Starting a session
Start a session withtransport: "moq". As with the other transports, body reaches your bot as runner_args.body:
moq key:
relayUrlreaches the MoQ relays in your agent’s region, with the browser’s credential for this session in its query string. Treat it as a secret. It stays valid for the agent’s maximum session duration.certHashisnull: the relays use publicly trusted certificates, so there is nothing to pin.namespace,clientIdandbotIdplace the browser and the bot in the session: the browser publishes under<namespace>/<clientId>and subscribes to<namespace>/<botId>, and the bot the reverse.
createDailyRoom and enableDefaultIceServers can’t be set to true with transport: "moq". Sending either as false, its default, is fine.
Connecting from the browser
The JavaScript SDK’sMoqTransport reads the /start response’s moq block itself, so startBotAndConnect() can call /start and connect in one step:
Reconnects
Pipecat Cloud drains a relay before replacing it, so relay updates don’t interrupt sessions. If a relay fails, both sides reconnect to another relay in the region on their own, and the session normally continues: the browser transport keeps trying for up to 60 seconds by default (relayRetryTimeoutMs), and the bot’s transport for its connection_timeout. Audio stops until both sides are back, typically for around 15 seconds, and RTVI messages sent meanwhile are delivered once each, in order.
Errors
A/start with transport: "moq" can be refused before any session starts. The message says what to change.
409 Conflict means retry:
- The agent’s latest deployment hasn’t finished reporting what it can serve. This can take a few minutes after a deploy; retry with backoff.
- A new deployment is still rolling out, or the latest one failed while the previous one keeps serving. Retry once a deployment has completed.
400 Bad Request means change the agent or the request:
- The agent’s current deployment can’t serve MoQ: for example, its image is older than
pipecat-base0.2.7, itspipecat-aiis older than 1.13.0, or themoqextra isn’t installed. Rebuild on the requirements above and deploy again. - The request also sets
createDailyRoomorenableDefaultIceServerstotrue. - MoQ isn’t offered in the agent’s region. Deploy the agent to a Daily-hosted region.
Related
MoQ transport (JavaScript)
The JavaScript
MoqTransport: options, events and connection states.MoQ transport (server)
MOQTransport and MOQParams in the Pipecat framework.