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

# Migrate from LiveKit

> Step-by-step guide to moving your LiveKit Agents codebase (Python or TypeScript) and LiveKit SIP trunks to Bolna.

Unlike hosted platforms where everything lives behind an API, LiveKit Agents live in your **code** (and optionally LiveKit Cloud for SIP trunks). The Bolna Migration Kit scans your local Python or TypeScript repo, extracts your prompts, models, multi-agent handoffs, and tools, and scaffolds HTTP webhook wrappers for your local tool logic.

> [!TIP]
>
> **Using Claude Code, Cursor, or Codex?** Installing the `migrate-to-bolna` skill (`npx skills add bolna-ai/skills`) is the smoothest way to migrate LiveKit — your coding agent can run the scan **and** automatically refactor your local `@function_tool` Python/TS functions into deployable HTTP endpoints.

## What you'll need

* **Bolna API key** — from [platform.bolna.ai](https://platform.bolna.ai) -> **Developers -> API Keys** (`bn-...`)
* **Your local LiveKit Agents repo** (Python or TypeScript)
* **Optional (only if you use LiveKit SIP trunks)**: `LIVEKIT_URL`, `LIVEKIT_API_KEY`, and `LIVEKIT_API_SECRET`

***

## Step-by-step migration

**1. Set your Bolna API key**

```bash theme={"system"}
export BOLNA_API_KEY="bn-xxxxxxxxxxxxxxxx"
```

If you also want to import LiveKit Cloud SIP trunks and phone numbers, export your LiveKit SIP credentials too:

```bash theme={"system"}
export LIVEKIT_URL="https://your-project.livekit.cloud"
export LIVEKIT_API_KEY="APIxxxxxxxx"
export LIVEKIT_API_SECRET="xxxxxxxxxxxxxxxx"
```

**2. Scan your repo (dry run)**

Point `--path` at your LiveKit project folder. Nothing is created on Bolna yet:

```bash theme={"system"}
npx -y @bolna/migrate --from livekit --path ./my-livekit-agent --dry-run
```

The scanner reads your `.py`, `.ts`, `.js`, and `.env` files to find `Agent` classes, `AgentSession` configs (STT/LLM/TTS), `on_enter` greetings, `@function_tool` definitions, and multi-agent handoffs.

**3. Apply the migration**

```bash theme={"system"}
npx -y @bolna/migrate --from livekit --path ./my-livekit-agent --apply
```

This creates your Bolna agent (or **Graph Agent** if you have multi-agent handoffs), imports any LiveKit SIP trunks, and writes cutover files to `./bolna-migration-out/`:

* `tool-webhook-scaffold.ts` — starter HTTP server for your local `@function_tool` handlers
* `sip-cutover.md` — exact Bolna SIP edge IPs and URI to update at your carrier
* `sdk-cutover.md` — drop-in replacement for LiveKit Client SDK using `@bolna/web-call`

**4. Host your tool functions & test in Bolna**

Because Bolna runs your voice pipeline in the cloud, local `@function_tool` business logic runs as HTTPS webhooks:

1. Move your tool logic into `tool-webhook-scaffold.ts` (or your existing backend) and deploy it.
2. Paste the deployed URLs into the **Tools** tab of your agent in [platform.bolna.ai](https://platform.bolna.ai).
3. Run a test call in Agent Studio.

To undo a test migration cleanly:

```bash theme={"system"}
npx -y @bolna/migrate --rollback ./bolna-migration-out/manifest.json
```

***

## Where everything lands in Bolna

| What you had in LiveKit | Where it lands in Bolna | Notes |
| - | - | - |
| `Agent(instructions=...)` & `on_enter()` | **Agent tab** (`system_prompt`, `agent_welcome_message`) | Extracted from Python and TypeScript files |
| `AgentSession(stt, llm, tts)` | **Transcription, LLM & Voice tabs** | Maps Deepgram, OpenAI, ElevenLabs, Cartesia, Sarvam, etc. |
| Multiple `Agent` classes / handoffs | **Graph Agent** (`graph_agent`) | Each agent becomes a graph node with transition edges |
| `@function_tool` schemas | **Tools tab** + `tool-webhook-scaffold.ts` | Tool parameter schemas imported; host the handler as an HTTPS webhook |
| `.env` provider keys | **Providers** (`/providers`) | Detected from `.env` (never committed) |
| LiveKit SIP trunks & dispatch rules | **SIP Trunks** (`/trunk/*`) | Imported via LiveKit Twirp API when `LIVEKIT_*` vars are set |

## Things to handle manually

* **Local tool execution**: Deploy your `@function_tool` business logic behind HTTPS (use the generated `tool-webhook-scaffold.ts`).
* **LiveKit-hosted phone numbers**: Cannot be ported out automatically — [buy a number on Bolna](https://www.bolna.ai/docs/buying-phone-numbers) or connect your carrier via [SIP trunk](https://www.bolna.ai/docs/sip-trunking/overview).
* **WebRTC video / avatars / `MCPServerHTTP`**: Flagged in the gap report; Bolna focuses on voice pipelines (use `@bolna/web-call` for browser/mobile voice).


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