Railway

Deploy Mastra Voice Agent with LiveKit

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

Deploy Mastra Voice Agent with LiveKit

Just deployed

/data

Deploy and Host Mastra Voice Agent with LiveKit on Railway

Mastra 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

Implementation Details

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

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.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
56