Deploy OpenHands
OpenHands coding agents in the browser, plus Claude Code and Codex
Just deployed
Deploy and Host OpenHands on Railway
OpenHands is an open-source platform for AI coding agents. Its web app, Agent Canvas, runs conversations with the OpenHands agent or with Claude Code, Codex or Gemini CLI, schedules automations, and opens a VS Code editor on the agent's files. This template runs Agent Canvas 1.26.0 on Railway with its own login key, a volume, and the Claude Code and Codex CLIs installed.
About Hosting OpenHands
The agent edits files and runs shell commands inside the container, so the API and the UI need a key before anything works. LOCAL_BACKEND_API_KEY is generated at deploy; Canvas asks for it the first time you open CANVAS_URL. The start step refuses to run without it and passes it to the agent server itself. In my test the API answered 401 without the key and the key never appeared in the page.
The agent runs in the container, with no Docker sandbox, because Railway has no Docker socket. That's the "without a sandbox" mode from OpenHands' README: the agent has the whole container, and the container is all it has.
The home directory (/home/openhands) is a volume. Settings, saved API keys, conversations, automations, CLI logins and your projects (/projects points into it) survive redeploys.
Claude Code and Codex run as Agent Canvas agents through ACP. Give them an API key in Canvas's onboarding or as ANTHROPIC_API_KEY / OPENAI_API_KEY on the service. To use a Claude or ChatGPT subscription instead, open a conversation's VS Code editor (served under /vscode on the same domain), run claude or codex in its terminal and sign in. OpenHands' ACP docs say Canvas reuses a CLI login it finds in the home directory, and here that login stays on the volume.
Before publishing I tested it on Railway. I saved an LLM (gpt-5-mini through OpenRouter) in the settings the way onboarding does, started a conversation in /projects, and asked the OpenHands agent to create railway-test/hello.txt containing "Railway 42". The conversation finished, the agent answered "DONE." and the file held exactly that text. The conversation's VS Code editor opened through the same domain. After a restart the saved model and key, the conversation and the file were all still there. I didn't run the Claude Code or Codex agents end to end; I checked that both CLIs are installed (Claude Code 2.1.295, Codex 0.162.0).
Memory is the tradeoff. Agent Canvas runs an agent server, an automation server, a web server and the editor in one container: 0.63 GB after a fresh start and a first task, 0.9 GB later. That fits under the trial's 1 GB with little room; the Hobby plan is the comfortable one. At 0.9 GB it's about $9 a month in RAM, plus your LLM usage.
Common Use Cases
- An always-on coding agent you can hand a task from your phone and check on later
- Running Claude Code or Codex in a browser UI on a server instead of your laptop
- Scheduled automations, such as dependency updates or reports on a repo, that run while you're away
- Trying the OpenHands agent with any LLM provider, including OpenRouter
Dependencies for OpenHands Hosting
An LLM: an API key for the OpenHands agent (any provider LiteLLM supports), or a Claude or ChatGPT subscription for the Claude Code and Codex agents.
Deployment Dependencies
- OpenHands: https://github.com/OpenHands/OpenHands
- Image:
ghcr.io/openhands/agent-canvas:1.26.0 - Docs: https://docs.openhands.dev/openhands/usage/agent-canvas/backends
- The wrapper this template builds: https://github.com/dektionstudio/railway-template-images/tree/main/openhands
Implementation Details
CANVAS_URL # open this; paste LOCAL_BACKEND_API_KEY when it asks for the backend key
LOCAL_BACKEND_API_KEY # the key for the UI and the API (X-Session-API-Key header)
/home/openhands # the volume: settings, conversations, logins, /projects
Packages installed with apt go away on the next redeploy, because only the home directory persists. Anyone with the key controls the agent and everything in the container, so keep it like a password.
Why Deploy OpenHands on Railway?
You get the agent on HTTPS with a key in front, its files on a volume, and nothing running on your own machine. It keeps working on a task after you close the tab.
Template Content
