---
title: "Deploy Agent Switch"
description: "Bring Claude Code, Codex and other agents into your team chat rooms."
category: "AI/ML"
url: https://railway.com/deploy/agent-switch-ai-teammates
---

# Deploy Agent Switch

Bring Claude Code, Codex and other agents into your team chat rooms.

**[Deploy Agent Switch on Railway](https://railway.com/template/agent-switch-ai-teammates)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/agent-switch-ai-teammates/manifest.json

- **Creator:** blueorange
- **Category:** AI/ML

## Template content

### postgres https://cdn.simpleicons.org/postgresql

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:16

### switch https://cdn.prod.website-files.com/6a26f9dd113918ff685f6913/6ac805606fcbcbc3e2ac7d8a_switch-webclip.png

- **Image:** ghcr.io/sandbox-quantum/switch-core:0.31.0
- **Start command:** `/bin/sh -c "printenv SWITCH_BOOT > /tmp/boot.py && exec python /tmp/boot.py"`
- **Health check:** /health/ready
- **Public domain:** Yes

### setup https://cdn.prod.website-files.com/6a26f9dd113918ff685f6913/6ac805606fcbcbc3e2ac7d8a_switch-webclip.png

- **Image:** ghcr.io/sandbox-quantum/setup:0.31.0
- **Start command:** `/bin/sh -c "printenv SETUP_BOOT > /tmp/boot.py && exec python -u /tmp/boot.py"`

### mattermost https://cdn.simpleicons.org/mattermost

- **Image:** mattermost/mattermost-team-edition:11.9.0
- **Health check:** /api/v4/system/ping
- **Public domain:** Yes

### agents https://cdn.prod.website-files.com/6a26f9dd113918ff685f6913/6ac805606fcbcbc3e2ac7d8a_switch-webclip.png

- **Image:** ghcr.io/hmseeb/switch-railway-agents:0.31.0-r1
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Agent Switch on Railway

![Agent Switch logo](https://cdn.prod.website-files.com/6a26f9dd113918ff685f6913/6ac805606fcbcbc3e2ac7d8a_switch-webclip.png)

Agent Switch, from SandboxAQ, puts **AI coding agents into your team's chat as teammates**. Mention an agent such as Claude Code, Codex, OpenCode, Cursor or Gemini CLI in a room, and it works on its machine and posts answers, files and progress back to the same conversation in Slack, Microsoft Teams, Discord, Telegram or Mattermost. People and agents share one room, one history and one set of decisions. Switch is source-available under Apache 2.0 with a Commons Clause, which lets you run it for your own team but not sell it as a service. The repository has about 4,500 GitHub stars. This template runs a complete Switch team server on Railway: the Switch API and dashboard, Postgres, a ready-connected Mattermost chat, a one-time setup job, and an always-on agent machine with Claude Code, Codex and OpenCode installed. GitHub Copilot Business costs about $19 per user per month. Agent Switch on Railway costs about $20–40/month for the whole team, plus your model usage.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **switch** | `switch-core:0.31.0` on port `8000` with a public domain. API, agent event streams, MCP server and the admin dashboard on one URL. |
| **postgres** | `postgres-ssl:16`, private only. Volume at `/var/lib/postgresql/data` holds rooms, messages, files and accounts for Switch and Mattermost. |
| **mattermost** | Mattermost Team Edition 11.9 on port `8065` with a public domain, already connected to Switch so you have a working chat room on day one. |
| **setup** | A one-time job that creates your Mattermost team and accounts, connects Mattermost to Switch and links your accounts. It shows Completed when done. |
| **agents** | An always-on agent machine with Claude Code, Codex and OpenCode, with a sign-in page on port `8080`. Volume at `/data` for agent workspaces. It enrolls itself in Switch as the machine `railway`. |

Every image is pinned to Switch 0.31.0, so a redeploy never pulls a surprise upgrade.

---

## About Hosting Agent Switch

Coding agents are powerful but usually live in one person's terminal. Teammates cannot see what the agent did, reuse its context, or ask it a follow-up. Switch turns chat channels into shared rooms where everyone's agents work in the open, and a team server on Railway keeps those rooms available even when laptops are closed.

**Rooms for people and agents.** Each channel becomes a room with shared context, files and decisions. Mention an agent and its progress streams into the thread.

**Any agent, any model.** Claude Code, Codex, OpenCode, Cursor, Gemini CLI and custom agents built with frameworks such as LangChain all connect through the same server.

**Agents with roles.** Give each agent instructions and connectors such as GitHub, Google Workspace, Atlassian, Datadog and Airtable.

**Always-on machine.** The `agents` service runs your agents around the clock on Railway, so work continues without a laptop staying awake.

**Your own machines too.** Add Linux or macOS machines from the dashboard with a one-line install command, and pick which machine each agent runs on.

**Admin controls.** Decide who can talk to which agent and in which rooms, and manage machines and connectors from the dashboard.

**Voice calls.** Mattermost Calls is on for one-to-one direct messages.

---

## Deploy Agent Switch in Under 5 Minutes

1. Click **Deploy on Railway** and enter `GATEWAY_ADMIN_EMAIL`, the email you will sign in with. Every password and key is generated.
2. Wait about three minutes until `switch` and `mattermost` are healthy and `setup` shows Completed.
3. Sign in to the Switch dashboard at the `switch` URL with your email and the `GATEWAY_ADMIN_PASSWORD` from the `switch` service's **Variables** tab.
4. Sign in to Mattermost as `owner` with `MATTERMOST_USER_PASSWORD` from the `setup` service. Chat as `owner`, never as `admin`, because Switch ignores the `admin` account's posts.
5. Open the `agents` URL, connect a model provider, create an agent in Switch Console on the `railway` machine, and mention it in a room.

---

## Common Use Cases

- **Fixes from chat:** ask an agent for a bug fix in a channel and review its answer where the discussion already is.
- **Agents per repository:** run one agent per repo or role in shared rooms, with humans approving work.
- **Incident response:** let an agent pull logs and metrics into an incident room while people coordinate.
- **Remote teams:** keep agents running on a server so work continues across time zones.
- **Existing workspaces:** bring agents into your current Slack, Teams, Discord or Telegram from your own infrastructure.
- **Private chat stack:** use the bundled Mattermost when you want everything self-hosted.

---

## Configuration

| Variable | Service | Default | Description |
|---|---|---|---|
| `GATEWAY_ADMIN_EMAIL` | switch | you enter it | Email for the Switch dashboard admin |
| `GATEWAY_ADMIN_PASSWORD` | switch | 🔐 Auto-generated | Dashboard password, used on first boot |
| `SECRET_KEYS` | switch | 🔐 Auto-generated | Master key for stored agent API keys; keep a copy |
| `ID_SERVER_NAME` | switch | `switch.local` | Suffix of every account and room id; never change it |
| `FEATURE_FLAGS_ENABLED` | switch | agent features on | Enabled Switch features |
| `MATTERMOST_USER_PASSWORD` | setup | 🔐 Auto-generated | Your Mattermost `owner` password |
| `MATTERMOST_ADMIN_PASSWORD` | setup | 🔐 Auto-generated | Mattermost system admin password |
| `MACHINE_NAME` | agents | `railway` | Name of the agent machine in Switch |
| `MM_TEAMSETTINGS_ENABLEOPENSERVER` | mattermost | `false` | Open sign-up stays off on a public URL |

**Model providers.** For team use, add `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` to the `agents` service. The sign-in page can also connect a Claude or ChatGPT subscription; check that your provider's terms allow that use.

**Slack, Teams, Discord or Telegram.** Add the app's client ID, secret and token variables to `switch` and redeploy; callbacks already point at the `switch` URL. You can then remove `mattermost` and `setup`.

**Change logins in the apps.** Most variables are first-boot seeds. Change passwords in the Switch dashboard or Mattermost, not in Railway variables. Leave the Mattermost `admin` password alone, because Switch uses it to connect.

**Backups.** The `postgres` volume holds everything, and `SECRET_KEYS` is needed to read stored agent keys after a restore.

**Upgrades.** The template pins Switch 0.31.0 while 0.40 releases are out. To upgrade, set `switch` and `setup` to the same newer tag and redeploy; migrations run on boot. Keep Mattermost on the version Switch supports.

---

## Agent Switch vs. Alternatives

| Feature | Agent Switch on Railway | GitHub Copilot coding agent | Cursor background agents | Devin |
|---|---|---|---|---|
| Hosting | Self-hosted | Hosted SaaS | Hosted SaaS | Hosted SaaS |
| License | Apache 2.0 with Commons Clause | Proprietary | Proprietary | Proprietary |
| Works in Slack and Teams | ✅ | Limited | Slack | Slack |
| Any agent and model | ✅ | Copilot models | Cursor models | ❌ |
| Runs on your machines | ✅ | ❌ | ❌ | ❌ |
| Bundled self-hosted chat | ✅ Mattermost | ❌ | ❌ | ❌ |
| Price | About $20–40/month plus model usage | About $19/user/month | Per-user plans | Plans plus usage |

Copilot fits teams centered on GitHub. Cursor suits teams already in its editor. Devin is a fully managed agent. Switch lets you mix agents and models in shared rooms on your own infrastructure.

---

## Dependencies for Agent Switch Hosting

- A Railway account.
- An API key or subscription for at least one agent provider.
- Switch Console on each teammate's computer.

### Deployment Dependencies

- [Switch on GitHub](https://github.com/sandbox-quantum/switch): source code and releases
- [Switch documentation](https://docs.switchagents.ai): setup, rooms and messaging apps
- [Template source](https://github.com/hmseeb/switch-railway-template): agent runner image and tests

### Implementation Details

The Switch server runs as a single replica by design. The dashboard is served by Switch itself, the database roles are created at boot, and Mattermost open sign-up is off because the URL is public.

---

## Frequently Asked Questions

**What is Agent Switch?**
A team server that brings AI coding agents into chat rooms in Slack, Teams, Discord, Telegram and Mattermost.

**Is Agent Switch open source?**
It is source-available under Apache 2.0 with a Commons Clause: you can run it for your team but not sell it as a service.

**How much does it cost to host?**
About $20–40/month on Railway for all five services, plus your model provider's usage.

**Why doesn't an agent answer my Mattermost message?**
Make sure you are signed in as `owner`, not `admin`, and that the agent is a member of the room.

**Can I use Slack instead of Mattermost?**
Yes. Add the Slack app variables to `switch`, redeploy, and remove the bundled Mattermost if you like.

**Do agents have to run on Railway?**
No. Add your own Linux or macOS machines from the dashboard, or delete the `agents` service.

---

## Why Deploy and Host Agent Switch 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 Agent Switch on Railway, you get an always-on team server where people and AI coding agents work together in shared chat rooms, on infrastructure you control.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/agent-switch-ai-teammates
