Deploy pi
Run the Pi AI coding agent on Railway — browser terminal or SSH
Just deployed
/workspace
Deploy and Host Pi on Railway
Pi is an open-source AI coding agent — a terminal-native assistant (think
Claude Code, but open and provider-agnostic) that reads your repo, writes and edits code, runs
commands, and opens pull requests. This template gives it a persistent home in the cloud you can
reach two ways: open the Railway public URL to use Pi in a browser terminal, or railway ssh
in and run pi from a shell. Your auth, sessions, settings, and cloned repos live on a Railway
volume, so they survive redeploys.
About Hosting Pi
This template builds a small Node 24 image with the Pi CLI (@earendil-works/pi-coding-agent),
ripgrep (which Pi's search tools require), git, the GitHub CLI, and ttyd — a tiny server
that exposes the Pi TUI over HTTP. The container's main process is ttyd, listening on $PORT, so
opening the service's public URL drops you straight into Pi in your browser. Because that terminal
runs as root with your provider keys, it is always protected by HTTP basic auth (WEB_USERNAME /
WEB_PASSWORD) over Railway's HTTPS; you can also railway ssh in independently. A /workspace
volume holds your repositories and Pi's entire ~/.pi/agent directory (auth, sessions, settings,
installed packages), and your provider API keys come from Railway variables. Railway handles the
build, restarts on failure, and persists the volume across deploys.
Why Deploy Pi on Railway?
- Use it from any browser — no local CLI required; open the URL, log in, and Pi's TUI is right
there.
railway sshis available too when you want a real shell. - Your laptop can sleep — the agent and its session live in the cloud; reconnect anytime and pick up where you left off.
- Persistent by default — repos and Pi's auth/sessions sit on a Railway volume, so a redeploy never logs you out or loses your working tree.
- Secured by default — the web terminal is always behind basic auth over HTTPS; nothing is exposed without your password.
- Provider-agnostic — bring an Anthropic, OpenAI, Google, or OpenRouter key (or
/loginto a Claude/ChatGPT/Copilot subscription); switch models without rebuilding. - Real dev tooling included —
git,ripgrep, and the GitHub CLI ship in the image, so the agent can search, clone, commit, and open PRs from inside the box.
Common Use Cases
- A remote coding-agent workstation you SSH into from any machine to run Pi interactively.
- Long-running refactors or migrations that should keep going regardless of your local machine.
- A shared, reproducible agent environment with pinned tooling for working across repositories.
Dependencies for Pi Hosting
- A provider API key for at least one model backend —
ANTHROPIC_API_KEY,OPENAI_API_KEY,GEMINI_API_KEY, orOPENROUTER_API_KEY(or run/loginafter connecting). - A
WEB_PASSWORDfor the browser terminal (WEB_USERNAMEdefaults topi). If left unset, a random password is generated on boot and printed to the deploy logs.
Deployment Dependencies
- Pi — the open-source AI coding agent
(
@earendil-works/pi-coding-agenton npm). - ttyd — serves the Pi TUI in the browser over HTTP.
- GitHub CLI — bundled so the agent can manage issues and pull requests.
Why This Template?
It packages Pi as a one-click, persistent remote agent box you can drive from a browser or over SSH, with credentials and repos that outlive every redeploy. Source and docs: github.com/yuting1214/pi-railway.
Template Content
WEB_PASSWORD
WEB_USERNAME
