> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pipecat Cloud Media over QUIC

> Pipecat Cloud agents over Media over QUIC: /start with transport moq, the JavaScript MoqTransport, and MOQSessionArguments in the bot.

Media over QUIC (MoQ) connects a browser to your Pipecat Cloud agent through the MoQ relays in the agent's region. The browser's audio and RTVI messages travel over WebTransport, with a WebSocket fallback, and your agent reaches the region's relays from inside Pipecat Cloud. Pipecat Cloud runs the relays and issues each session's credentials, so there is no relay to deploy and no token to mint.

MoQ is a browser transport. For telephony and server-to-server links, use the [generic WebSocket endpoint](https://docs.pipecat.ai/pipecat-cloud/guides/generic-websocket.md); for Daily rooms, see [Daily WebRTC](https://docs.pipecat.ai/pipecat-cloud/guides/daily-webrtc.md).

## Requirements

Your agent image needs:

* `pipecat-ai[moq]` 1.13.0 or newer.
* The Pipecat Cloud base image `dailyco/pipecat-base` 0.2.7 or newer. Name the version in your Dockerfile's `FROM` rather than relying on `latest`: a cloud build can get the previous base image for up to a day after a release.
* `pipecatcloud` 1.3.0 or newer, if your image installs its own rather than using the one the base image provides.

Your browser client needs `@pipecat-ai/client-js` 1.16 and `@pipecat-ai/moq-transport` 0.3.3 or newer.

> [!NOTE]
>
> 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](#errors).

## Bot code

Add the `moq` extra to your requirements:

```text requirements.txt theme={null}
pipecat-ai[moq]>=1.13.0
```

For a MoQ session, the base image passes your `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:

```python bot.py theme={null}
from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport
from pipecat.transports.moq.transport import MOQParams

transport_params = {
    "moq": lambda: MOQParams(
        audio_in_enabled=True,
        audio_out_enabled=True,
    ),
}


async def bot(runner_args: RunnerArguments):
    transport = await create_transport(runner_args, transport_params)
    # Build and run your pipeline with `transport`, as with any other transport.
```

The relay URL the bot dials carries the session's credential. `MOQSessionArguments` keeps it out of its `repr`; keep it out of your own logs too. See [Session arguments](https://docs.pipecat.ai/api-reference/pipecat-cloud/sdk-reference/session-arguments.md#moqsessionarguments) for the fields.

## Starting a session

Start a session with `transport: "moq"`. As with the other transports, `body` reaches your bot as `runner_args.body`:

```bash theme={null}
curl -X POST "https://api.pipecat.daily.co/v1/public/my-agent/start" \
  -H "Authorization: Bearer pk_your_public_key" \
  -H "Content-Type: application/json" \
  -d '{"transport": "moq", "body": {"greeting": "hello"}}'
```

The response carries everything the browser transport needs under a `moq` key:

```json theme={null}
{
  "sessionId": "639f91d8-d511-4677-a83b-bd7564d5d92f",
  "moq": {
    "relayUrl": "https://us-west.moq.pipecat.daily.co/?jwt=eyJhbGciOiJFUzI1NiIs...",
    "certHash": null,
    "namespace": "pcc/639f91d8-d511-4677-a83b-bd7564d5d92f",
    "clientId": "request",
    "botId": "response",
    "transcriptTrack": "transcript.json.z"
  }
}
```

* `relayUrl` reaches 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.
* `certHash` is `null`: the relays use publicly trusted certificates, so there is nothing to pin.
* `namespace`, `clientId` and `botId` place the browser and the bot in the session: the browser publishes under `<namespace>/<clientId>` and subscribes to `<namespace>/<botId>`, and the bot the reverse.

A MoQ session has no Daily room and no ICE servers, so `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's `MoqTransport` reads the `/start` response's `moq` block itself, so `startBotAndConnect()` can call `/start` and connect in one step:

```javascript theme={null}
import { PipecatClient } from "@pipecat-ai/client-js";
import { MoqTransport } from "@pipecat-ai/moq-transport";

const client = new PipecatClient({
  // relayUrl is required by the type; the /start response replaces it
  transport: new MoqTransport({ relayUrl: "" }),
});

await client.startBotAndConnect({
  endpoint: "https://api.pipecat.daily.co/v1/public/my-agent/start",
  headers: new Headers({ Authorization: "Bearer pk_your_public_key" }),
  requestData: { transport: "moq", body: { greeting: "hello" } },
});
```

See the [MoQ transport reference](https://docs.pipecat.ai/api-reference/client/js/transports/moq.md) for its options and events.

## 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-base` 0.2.7, its `pipecat-ai` is older than 1.13.0, or the `moq` extra isn't installed. Rebuild on the [requirements](#requirements) above and deploy again.
* The request also sets `createDailyRoom` or `enableDefaultIceServers` to `true`.
* MoQ isn't offered in the agent's region. Deploy the agent to a Daily-hosted [region](https://docs.pipecat.ai/pipecat-cloud/guides/regions.md).

## Related

> [card] [MoQ transport (JavaScript)](https://docs.pipecat.ai/api-reference/client/js/transports/moq.md)
>
> The JavaScript `MoqTransport`: options, events and connection states.

> [card] [MoQ transport (server)](https://docs.pipecat.ai/api-reference/server/services/transport/moq.md)
>
> `MOQTransport` and `MOQParams` in the Pipecat framework.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.