---
title: "Deploy Mastra Voice Agent with LiveKit"
description: "Call-center voice agent on LiveKit with Mastra memory and replies."
category: "AI/ML"
url: https://railway.com/deploy/mastra-voice-agent-with-livekit
---

# Deploy Mastra Voice Agent with LiveKit

Call-center voice agent on LiveKit with Mastra memory and replies.

**[Deploy Mastra Voice Agent with LiveKit on Railway](https://railway.com/template/mastra-voice-agent-with-livekit)**

- **Creator:** leodev
- **Category:** AI/ML

## Template content

### Mastra Voice Agent https://unpkg.com/mastra/dist/studio/mastra.svg

- **Source:** https://github.com/leoisadev1/mastra-template-voice-agent
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Mastra Voice Agent with LiveKit on Railway

[Mastra](https://mastra.ai) is the open-source TypeScript framework for building AI agents and workflows. This template deploys "Jordan", a call-center voice agent for a fictional trades contractor, built on `@mastra/livekit`. LiveKit runs the WebRTC audio, speech-to-text, semantic turn detection, barge-in, and text-to-speech; Mastra generates every reply with three memory layers (working, semantic recall, observational), a mock CRM, a service-area gate, and end-of-call intake reconciliation.

## About Hosting Mastra Voice Agent with LiveKit

One Railway service runs both processes: the Mastra HTTP server (which issues LiveKit room tokens) and the LiveKit agent worker that joins calls. Both share a LibSQL database on an attached volume, and the public domain serves Mastra Studio, so you can read call memory and transcripts in the browser. Bring LiveKit Cloud credentials (or your own LiveKit server) and an OpenAI API key, deploy, then open Studio on the public domain and press the phone button in the Meridian Trades Front Desk agent chat. Your own frontend calls `POST /voice/livekit/connection-details` for a token instead. The worker uses explicit dispatch, so a plain LiveKit client token does not reach the agent. The token route ships unauthenticated so the demo works out of the box. Anyone with the URL can start a call against your LiveKit project, so put the route behind auth before you share the deployment.

## Common Use Cases

- Ship a phone-grade voice agent with real barge-in and turn detection
- Study a production-style voice architecture: worker + server + shared memory
- Prototype voice intake, triage, or support flows against your own backend

## Dependencies for Mastra Voice Agent Hosting

- LiveKit project (URL, API key, API secret)
- OpenAI API key (replies and embeddings)

### Deployment Dependencies

- [LiveKit Cloud](https://cloud.livekit.io/)
- [Mastra voice docs](https://mastra.ai/docs)

### Implementation Details

Get a token that carries the explicit `mastra-voice` dispatch:

```bash
curl -X POST https://YOUR-DOMAIN.up.railway.app/voice/livekit/connection-details \
  -H "Content-Type: application/json" \
  -d '{"resourceId": "caller-demo"}'
```

Join the call with that token. A room joined without it has no agent, because the worker
registers a named agent and LiveKit dispatches it only from this token.

The HTTP server reports healthy even when the worker cannot reach LiveKit. If nobody answers
the call, read the service logs and look for the `[worker]` lines.

## Why Deploy Mastra Voice Agent with LiveKit on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Mastra Voice Agent with LiveKit on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/mastra-voice-agent-with-livekit
