Deploy Agent Switch

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

Deploy Agent Switch

/var/lib/postgresql/data

/mattermost/data

Deploy and Host Agent Switch on Railway

Agent Switch logo

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

ServicePurpose
switchswitch-core:0.31.0 on port 8000 with a public domain. API, agent event streams, MCP server and the admin dashboard on one URL.
postgrespostgres-ssl:16, private only. Volume at /var/lib/postgresql/data holds rooms, messages, files and accounts for Switch and Mattermost.
mattermostMattermost 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.
setupA one-time job that creates your Mattermost team and accounts, connects Mattermost to Switch and links your accounts. It shows Completed when done.
agentsAn 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

VariableServiceDefaultDescription
GATEWAY_ADMIN_EMAILswitchyou enter itEmail for the Switch dashboard admin
GATEWAY_ADMIN_PASSWORDswitch🔐 Auto-generatedDashboard password, used on first boot
SECRET_KEYSswitch🔐 Auto-generatedMaster key for stored agent API keys; keep a copy
ID_SERVER_NAMEswitchswitch.localSuffix of every account and room id; never change it
FEATURE_FLAGS_ENABLEDswitchagent features onEnabled Switch features
MATTERMOST_USER_PASSWORDsetup🔐 Auto-generatedYour Mattermost owner password
MATTERMOST_ADMIN_PASSWORDsetup🔐 Auto-generatedMattermost system admin password
MACHINE_NAMEagentsrailwayName of the agent machine in Switch
MM_TEAMSETTINGS_ENABLEOPENSERVERmattermostfalseOpen 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

FeatureAgent Switch on RailwayGitHub Copilot coding agentCursor background agentsDevin
HostingSelf-hostedHosted SaaSHosted SaaSHosted SaaS
LicenseApache 2.0 with Commons ClauseProprietaryProprietaryProprietary
Works in Slack and Teams✅LimitedSlackSlack
Any agent and model✅Copilot modelsCursor models❌
Runs on your machines✅❌❌❌
Bundled self-hosted chat✅ Mattermost❌❌❌
PriceAbout $20–40/month plus model usageAbout $19/user/monthPer-user plansPlans 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

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.


Template Content

More templates in this category

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

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1