Deploy Moyai
Background coding agent from the LiteLLM team, always on.
Just deployed
/data
Deploy and Host Moyai on Railway
Run 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 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 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
- Wait for the first start, about 2 minutes. Until the web server is up, the URL returns 502.
- Open the Railway URL and sign in as
adminwithWORKSPACE_PASSWORD(Railway shows it under the service's Variables). - Try a first task: "Create
/workspace/hello.pythat prints Hello from Moyai, run it, and save it for download." The chat should show the output and a file to download. - 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.
Template Content
AGENT_MODEL
Model name as your gateway knows it, e.g. gpt-5. Must support the OpenAI Responses API.
MODAL_TOKEN_ID
From modal token new (modal.com). The agent's computer runs on Modal; Starter includes free monthly credits.
LITELLM_API_KEY
API key for your model gateway (LiteLLM proxy or OpenAI-compatible endpoint).
LITELLM_API_BASE
HTTPS base URL of your LiteLLM or OpenAI-compatible gateway, ending in /v1.
MODAL_TOKEN_SECRET
Modal token secret, from the same modal token new output.

