---
title: "Deploy Moyai"
description: "Background coding agent from the LiteLLM team, always on."
category: "AI/ML"
url: https://railway.com/deploy/moyai
---

# Deploy Moyai

Background coding agent from the LiteLLM team, always on.

**[Deploy Moyai on Railway](https://railway.com/template/moyai)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/moyai/manifest.json

- **Creator:** win-with-web's Projects
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### moyai https://raw.githubusercontent.com/ashutoshanand13/moyai-railway/main/icon.png

- **Source:** ashutoshanand13/moyai-railway
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Moyai on Railway

Run [Moyai](https://github.com/BerriAI/moyai), the self-hosted background coding agent from the LiteLLM team, on Railway. Give it a task in chat, then close your laptop. The agent keeps working in its own cloud computer, and you can steer it, answer its questions and download its files from any browser.

## About Hosting Moyai

Moyai is a shared AI workspace for coding and connected-service tasks. You chat with an agent, and it works on a real Linux computer: it writes and runs code, uses a browser and keeps the results. Pydantic AI runs the agent, Temporal makes each task durable, LiteLLM (or any OpenAI-compatible gateway) supplies the model, and [Modal](https://modal.com) provides the agent's computer.

This template runs Moyai's single-container mode on one Railway service. That's the web app, a worker and a local Temporal server, with SQLite and encrypted files on a Railway volume. It suits one person or a small team. For a larger team, Moyai's own guide covers a split deployment with PostgreSQL, S3 storage and Temporal Cloud.

## Common Use Cases

- Hand off coding tasks ("fix this failing test", "add an endpoint") and check back later from your phone.
- Run long agent tasks that would stop if your laptop slept.
- Give a small team one place to run and review agent work, with history and files kept.
- Try Moyai without installing Docker on your own machine.

## Dependencies for Moyai Hosting

- A Railway account.
- A model gateway with a Responses-capable model, either your own LiteLLM proxy or any OpenAI-compatible HTTPS endpoint, plus its API key.
- A [Modal](https://modal.com) account and a token pair (`modal token new`). Modal's Starter plan includes free monthly compute credits. Agent computers run there and are billed by Modal.

### Deployment Dependencies

- Moyai: https://github.com/BerriAI/moyai (MIT licence), image `ghcr.io/berriai/moyai:quickstart`
- LiteLLM: https://github.com/BerriAI/litellm
- Modal: https://modal.com

### Implementation Details

| Part | What it does |
| --- | --- |
| Moyai service | `moyai dev` on Railway's `PORT`: web app, embedded worker and local Temporal server. |
| Volume at `/data` | SQLite database, Temporal history, encrypted files and the generated encryption key. Keep it. |
| `/health` | Health check. It returns OK once the database answers. |
| Sign-in | Moyai's own login: user `admin` and a password generated for you at deploy. |

Variables:

| Variable | Required | Purpose |
| --- | --- | --- |
| `WORKSPACE_PASSWORD` | yes | Sign-in password for `admin`, generated at deploy. |
| `LITELLM_API_BASE` | yes | HTTPS base URL of your model gateway, ending in `/v1`. |
| `LITELLM_API_KEY` | yes | API key for that gateway. |
| `AGENT_MODEL` | yes | Model name as your gateway knows it. It must support the Responses API. |
| `MOYAI_MODELS` | no | Comma-separated models offered in the model picker. Defaults to `AGENT_MODEL`. |
| `MODAL_TOKEN_ID` | yes | Modal token ID for the agent's computer. |
| `MODAL_TOKEN_SECRET` | yes | Modal token secret. |
| `MOYAI_PUBLIC_URL` | set for you | Your Railway HTTPS address. Moyai checks it on every form submit. |
| `MOYAI_SECURE_COOKIES` | set for you | `true`, because Railway serves HTTPS. |

## How to Use Moyai After Deployment

1. Wait for the first start, about 2 minutes. Until the web server is up, the URL returns 502.
2. Open the Railway URL and sign in as `admin` with `WORKSPACE_PASSWORD` (Railway shows it under the service's **Variables**).
3. Try a first task: "Create `/workspace/hello.py` that prints Hello from Moyai, run it, and save it for download." The chat should show the output and a file to download.
4. Connect GitHub, Slack or other services under **Settings** when you need them.

If a task fails straight away, check `LITELLM_API_BASE`, `AGENT_MODEL` and the Modal token pair first. The service starts without them, but tasks can't run.

Resource use measured on Railway: about 520 MB of memory and almost no CPU when idle (roughly US$5–6 a month at Railway's list prices). Agent computers run on Modal and are billed there.

## Why Deploy Moyai 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 Moyai 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.

---

This template is a community wrapper and is not made by the Moyai or BerriAI team. Moyai is © its authors under the MIT licence.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/moyai
