Railway

Deploy OpenHands — Autonomous GitHub Issue Resolver

Self-host OpenHands — assign a GitHub issue, get a pull request

Deploy OpenHands — Autonomous GitHub Issue Resolver

Just deployed

/.openhands

Deploy and Host OpenHands on Railway

OpenHands is an open-source autonomous coding agent that resolves GitHub issues end to end — assign it an issue, and it reads the context, writes the fix, runs the tests, and opens a pull request, without step-by-step direction. Built by All Hands AI and topping the SWE-bench Verified leaderboard among open systems, it's a self-hosted, model-agnostic engineer you fully control. This template deploys OpenHands with a persistent workspace and bring-your-own-key LLM configuration, so you can hand real engineering tasks to an AI agent on your own infrastructure in minutes.

What This Template Deploys

ServicePurpose
OpenHandsThe autonomous coding agent, web UI, and task runtime

A single service with a persistent volume for the agent's workspace and conversation history. OpenHands runs its observe-think-act loop — reading files, running shell commands, editing code, and opening pull requests — driven by the LLM you connect. Railway provides a public HTTPS URL for the web interface.


About Hosting

OpenHands is a genuinely autonomous engineer, and a couple of Railway specifics make it deploy cleanly for real work — both handled here.

Assign a GitHub issue, get a pull request — the core workflow. Connect a GitHub personal access token (repo scope), hand OpenHands an issue URL, and it clones the repo, creates a branch, reads the surrounding code, writes the fix, runs the tests, and pushes a pull request for your review. It plans and executes the whole task, iterating until tests pass. This autonomous issue-to-PR loop, backed by top SWE-bench scores, is what sets OpenHands apart.

Runs in local-runtime mode on Railway. OpenHands normally spawns a fresh Docker sandbox per task, which needs a Docker socket that Railway doesn't expose. This template runs the agent in local-runtime mode — the agent executes inside the Railway container itself — so it boots fast and works without Docker-in-Docker. This is ideal for trusted single-user or small-team use; because the agent runs in the app container, treat it as you would any tool with shell access and keep it access-controlled.

Bring your own model — any provider. OpenHands is model-agnostic through LiteLLM: set LLM_MODEL and LLM_API_KEY for Anthropic, OpenAI, Google, Bedrock, OpenRouter, or a local Ollama/vLLM endpoint via LLM_BASE_URL. Claude Sonnet is recommended for the strongest results, with cheaper models fine for simpler tasks. You bring your own key and pay the provider directly — no per-task subscription.

Your workspace and history persist. The agent's workspace and multi-conversation chat history live on the mounted volume, so tasks and context survive redeploys. Update by bumping the image tag and redeploying; your volume data is unaffected.

A code-native agent, not a chatbot. OpenHands has shell, file editor, web fetch, and git tools built in, plus GitHub PR creation, so it does real engineering work — refactors, migrations, feature scaffolding, test writing — rather than just answering questions, leading the open field on measured benchmarks.

Typical cost: ~$5–10/month on Railway for the agent, plus your LLM provider usage per task. OpenHands is MIT-licensed and free — versus Devin's subscription.


How It Compares

OpenHands (self-hosted)DevinCopilotCursor
AutonomyFull task → PRFull task → PRAutocomplete + chatAssisted edits
GitHub issue resolutionYesYesNoPartial
Model choiceAny (BYOK)VendorVendorSome
Cost modelAPI usage onlySubscriptionSubscriptionSubscription
Data ownershipFull — your infraVendorVendorVendor
Self-hostableYesNoNoNo

Devin resolves issues autonomously too but is a paid subscription on their infrastructure. Copilot and Cursor are excellent assistants but keep a human in the loop for each step and run in the vendor's cloud. OpenHands's edge is autonomous, end-to-end issue resolution — with your choice of model, your code on your infrastructure, and benchmark-leading open-source performance — at the cost of API usage rather than a subscription.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway — OpenHands builds with a persistent workspace volume (~3 minutes)
  2. Set LLM_MODEL (e.g. anthropic/claude-sonnet-4-6) and LLM_API_KEY in the Variables tab
  3. Open your Railway URL — the OpenHands web UI is live
  4. Add a GitHub personal access token (repo scope) in settings to enable issue resolution and PRs
  5. Paste a GitHub issue URL or describe a task, and let the agent work

Review the pull request the agent opens, then merge or send it back for another iteration.


Common Use Cases

  • Autonomous issue resolution — assign a GitHub issue and receive a tested pull request
  • Bug fixing — point the agent at a failing test or bug report and let it diagnose and fix
  • Feature scaffolding — describe a feature in plain English and get tested starter code
  • Test writing — have the agent add test coverage to existing modules

Configuration

VariableRequiredDescription
LLM_MODELRequiredThe model, e.g. anthropic/claude-sonnet-4-6 (LiteLLM format)
LLM_API_KEYRequiredYour provider API key — you pay the provider directly
LLM_BASE_URLOptionalEndpoint for a local model (Ollama, vLLM, or OpenAI-compatible)
GitHub tokenIn UIPersonal access token (repo scope) for issue resolution and PRs
Storage volumePre-setPersistent volume for the workspace and conversation history
PORTAuto-injectedRailway injects the port for the web UI

Set your model and key, then add a GitHub token. LLM_MODEL and LLM_API_KEY power the agent; add a repo-scoped GitHub token in the UI to enable autonomous issue resolution and pull requests.

Local-runtime mode, so keep it private. The agent runs in the Railway container (no Docker sandbox), which is fast and fine for trusted single-user use — but it has shell access, so keep the deployment access-controlled.


Dependencies for OpenHands Hosting

  • Railway account — ~$5–10/month for the agent, plus your LLM provider usage
  • An LLM provider API key (Anthropic, OpenAI, Google, OpenRouter, or a local endpoint)
  • A GitHub personal access token (repo scope) for issue resolution and pull requests
  • A persistent volume for the workspace and history (included)

Deployment Dependencies

Implementation Details

The template runs the official all-hands-ai/openhands image as a single service with a persistent volume for the agent's workspace and multi-conversation history, and the web UI on a Railway-injected port over automatic HTTPS. OpenHands operates an observe-think-act loop: it reads a task, calls a tool (read file, run shell command, apply patch, git operation), observes the result, and iterates until the task is complete, using shell, file-editor, web-fetch, git, and GitHub-PR tools.

Because Railway does not expose a Docker socket, the template runs the agent in local-runtime mode — the agent executes inside the Railway container rather than spawning a per-task Docker sandbox. This boots quickly and suits trusted single-user or small-team use; since the agent has shell access, the deployment should be access-controlled. The model is configured through LiteLLM via LLM_MODEL and LLM_API_KEY (with LLM_BASE_URL for local endpoints), supporting Anthropic, OpenAI, Google, Bedrock, OpenRouter, Ollama, and vLLM.

Connecting a repo-scoped GitHub personal access token enables the signature workflow: given an issue URL, the agent clones the repository, branches, implements and tests a fix, and opens a pull request. Updates are applied by bumping the image tag and redeploying, with workspace and history preserved on the volume, which is the component to back up.


Frequently Asked Questions

Can it really resolve GitHub issues on its own? Yes — connect a repo-scoped GitHub token, give it an issue URL, and OpenHands clones the repo, writes and tests a fix, and opens a pull request for your review. It leads open-source systems on SWE-bench issue-resolution benchmarks.

Which model should I use? Claude Sonnet is recommended for the strongest results — it resolves a majority of SWE-bench Verified issues. Cheaper models like GPT-4o-mini or Gemini Flash work for simpler tasks. Set it via LLM_MODEL.

Why local-runtime mode? Railway doesn't expose a Docker socket, so the agent runs in the container itself rather than a per-task Docker sandbox. It's fast and fine for trusted use; keep the deployment access-controlled since the agent has shell access.

How is this different from Copilot? Copilot assists you line by line in your editor; OpenHands works autonomously end to end — taking an issue or task and delivering a tested pull request — on your own infrastructure with your choice of model.


Why Deploy OpenHands 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 OpenHands on Railway you get an autonomous coding agent with the setup handled — a persistent workspace, BYOK model configuration, and automatic HTTPS. Assign it GitHub issues and get tested pull requests back, self-hosted on infrastructure you own, for the cost of your API usage.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
56