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

# pipecat pipeline over livekit transport

> use livekit purely as the webrtc transport while pipecat runs the stt to llm to rumik tts pipeline.

want livekit just for transport (WebRTC rooms, web and mobile SDKs, telephony) but
pipecat to run the pipeline? **pipecat ships a livekit transport**, so the whole agent
is one pipecat pipeline that sends and receives audio over a livekit room. no glue
code needed.

## which livekit setup is this?

| approach                        | you write                | rumik via                              | owns the loop |
| ------------------------------- | ------------------------ | -------------------------------------- | ------------- |
| livekit agents                  | a livekit `AgentSession` | [`livekit-plugins-rumik-ai`](/livekit) | livekit       |
| **pipecat + livekit transport** | a pipecat `Pipeline`     | [`pipecat-rumik`](/pipecat)            | pipecat       |

this guide is the second row: **livekit is transport only.**

## what you'll build

one pipecat pipeline, with the livekit transport at both ends:

**livekit** `transport.input()` → STT → LLM → rumik TTS → **livekit** `transport.output()`

## before you start

* **python 3.10+**
* a [livekit](https://cloud.livekit.io) project (URL, API key, secret)
* a [rumik key](https://playground.rumik.ai/api-keys)
* an STT and LLM (this guide uses deepgram + openai, both swappable)

## step 1 · install

```bash theme={null}
pip install "pipecat-ai[livekit,deepgram,openai,silero]" pipecat-rumik
```

the `livekit` extra adds pipecat's transport; `pipecat-rumik` is the voice.

## step 2 · keys

```bash .env theme={null}
LIVEKIT_URL=wss://your-project.livekit.cloud
RUMIK_API_KEY=rk_live_•••••••••
RUMIK_GATEWAY_URL=https://silk-api.rumik.ai
DEEPGRAM_API_KEY=•••••••••
OPENAI_API_KEY=sk-•••••••••
```

## step 3 · build the pipeline

the transport is the only livekit-specific line. the rest is plain pipecat with
`RumikTTSService` as the voice.

```python agent.py theme={null}
import os

from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask
from pipecat.transports.livekit.transport import LiveKitParams, LiveKitTransport
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat_rumik import RumikTTSService

# muga is steered by a [tone] tag, so the LLM must add one. give your LLM this
# system prompt (see /prompting-muga).
SYSTEM_PROMPT = "Start every reply with one tone tag ([happy], [sad], ...). Romanised Hinglish, 1-2 sentences."


async def run_agent(url: str, token: str, room_name: str):
    # livekit is ONLY the transport, pipecat owns the pipeline
    transport = LiveKitTransport(
        url=url,
        token=token,
        room_name=room_name,
        params=LiveKitParams(audio_in_enabled=True, audio_out_enabled=True),
    )

    stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
    llm = OpenAILLMService(api_key=os.environ["OPENAI_API_KEY"], model="gpt-4o-mini")
    tts = RumikTTSService(
        api_key=os.environ["RUMIK_API_KEY"],
        gateway_url=os.environ["RUMIK_GATEWAY_URL"],
        settings=RumikTTSService.Settings(model="muga"),
    )

    # livekit in → stt → llm → rumik tts → livekit out
    pipeline = Pipeline([transport.input(), stt, llm, tts, transport.output()])

    await PipelineRunner().run(PipelineTask(pipeline))
```

<Note>
  the transport import path and runner API track your pipecat version, see the
  [pipecat docs](https://docs.pipecat.ai/). `RumikTTSService` is the same as the
  [pipecat integration](/pipecat) reference.
</Note>

## step 4 · connect a caller

mint a livekit token per participant (see livekit's
[token docs](https://docs.livekit.io/home/get-started/authentication/)), start
`run_agent` in the room, and join from your client or the
[agents playground](https://agents-playground.livekit.io). once both are in the room
you talk to the bot, pipecat handles turn-taking over livekit's WebRTC.

## next steps

* want a described voice? set `model="mulberry"` with a `description`, see
  [prompting mulberry](/prompting-mulberry).
* want livekit to own the loop instead? use the
  [livekit agents plugin](/livekit).
* [pipecat integration](/pipecat) for every `RumikTTSService` setting.
