Railway

Deploy Monty Server

Monty Server is an REST API in front of Pydantic's Monty.

Deploy Monty Server

Just deployed

Deploy and Host monty-server on Railway

monty-server is an HTTP API in front of monty, Pydantic's sandboxed Python interpreter written in Rust. It runs untrusted Python — typically code an LLM wrote — with no filesystem or network access, hard memory and time limits, and microsecond startup. Any language that speaks JSON over HTTP can use it.

About Hosting monty-server

monty-server is a single Rust binary in a small distroless container. There is no database, no Redis, and no external services to wire up — sessions live in process memory. The /v1/run endpoint is fully stateless; "code mode" sessions are process-local, so a single Railway instance is the simplest setup. Set MONTY_API_TOKENS to require a bearer token (this template generates one for you), tune ceilings like MONTY_MAX_TIMEOUT_MS if needed, and point Railway's healthcheck at /health. The container runs as a non-root user and shuts down cleanly on SIGTERM.

Common Use Cases

  • Running Python that an LLM agent writes, with your real tools exposed as host functions through the session ("code mode") API.
  • Evaluating user-supplied formulas or short scripts inside a SaaS without spinning up a container per request.
  • A safe Python execution backend for playgrounds, notebooks, or coding-challenge tools.

Dependencies for monty-server Hosting

  • None at runtime — no database, queue, or external service is required.
  • The deploy uses the project's Dockerfile (or the prebuilt image at ghcr.io//), so Docker is the only build-time dependency.

Deployment Dependencies

Implementation Details

After deploying, the bearer token to use is the part after the colon in MONTY_API_TOKENS (the template default is railway:).

Verify the service is up and authenticated:

curl -s https://YOUR-APP.up.railway.app/health
# {"status":"ok"}

curl -s https://YOUR-APP.up.railway.app/v1/run \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"code":"x * 2 + 1","inputs":{"x":20}}'
# {"status":"completed","result":41,"stdout":"","stderr":"","stats":{...}}

The full API reference and a dependency-free Python client live in the project README.

Why Deploy monty-server 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 monty-server 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
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-improving AI agent with memory, skills, and web dashboard 🤖

codestorm
View Template
EchoDeck
Generate a mp4 from powerpoint with TTS

Fixed Scope