Railway

Deploy Background Agent

Deploy and host coding agents (opencode/claude code/codex) on Railway

Deploy Background Agent

/var/lib/postgresql/data

Deploy and Host Background Agent on Railway

Background Agent is a small full-stack demo that provisions per-session "sandbox" services on Railway and routes traffic to them through a proxy.

It's inspired by Ramp's Background Agent architecture (https://builders.ramp.com/post/why-we-built-our-background-agent). You get an admin dashboard to create/retire ephemeral environments and a secure token-based link to open each sandbox in the browser.

About Hosting Background Agent

Hosting Background Agent on Railway involves deploying:

  • API service (Express + TypeScript)
  • Web dashboard (React + Vite)
  • Postgres database to track session state.

When a user creates a session, the API uses the Railway GraphQL API to spin up a new Railway service from a sandbox container image. The API then reverse-proxies HTTP + WebSocket traffic to the correct sandbox over Railway's internal network, using a signed token to authorize access.

You'll configure two public hostnames: one for the API/dashboard and one dedicated to proxying sandbox traffic.

Common Use Cases

  • Ephemeral dev/test environments per ticket, customer, or agent run
  • Secure "open in browser" sandboxes for demos, support, and onboarding
  • Multi-tenant workspaces where each session gets an isolated service container

Dependencies for Background Agent Hosting

Deployment Dependencies

  • Railway API token + Project/Environment IDs (to create/delete sandbox services)
  • GitHub personal acceses token (to clone the target repo and create branches/PRs)

Why Deploy Background Agent 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 Background Agent 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
openui
Deploy OpenUI: AI-powered UI generation with GitHub OAuth and OpenAI API.

zexd
View Template
firecrawl
firecrawl api server + worker without auth, works with dify

Rama