Deploy Hermes - Discord
Nous Research's Ai Agent Runtime Discord Supervised Gateway
Just deployed
/data
Deploy and Host Hermes Discord Agent on Railway
Hermes (Hermes Discord Bot) is an AI agent framework designed to connect large language models to Discord, leveraging OpenRouter for inference and supporting agent caching, memory persistence, and granular user permission controls. This Railway template deploys hermes-discord from the OpenSource-Templates/Hermes repository, paired with a daily-backed persistent storage volume at /data.
About Hosting Hermes Discord
Hosting Hermes on Railway deploys a single container service that runs the Hermes Discord agent background daemon. It connects to Discord via WebSocket/Gateway using DISCORD_BOT_TOKEN and delegates model inference to OpenRouter using OPENROUTER_API_KEY. Persistent agent memory, context cache, and state are saved to a dedicated storage volume mounted at /data with daily automated backup scheduling enabled.
Common Use Cases
- Autonomous Discord AI assistant: Interact with Hermes LLMs and custom agent workflows directly inside Discord channels or direct messages.
- OpenRouter model integration: Access top-tier open-source and proprietary language models (Claude, Llama, Mistral, GPT-4o) via OpenRouter API.
- Persistent agent memory: Retain conversation context, agent cache, and user memory across deployments in the
/datavolume. - Granular access control: Restrict bot usage to specific Discord user IDs (
DISCORD_ALLOWED_USERS) to prevent unauthorized API credit consumption.
Dependencies for Hermes Discord Hosting
- Hermes Source: Repository
OpenSource-Templates/Hermes(mainbranch) - OpenRouter API Key: API key from OpenRouter (
OPENROUTER_API_KEY) - Discord Bot Token: Bot token from the Discord Developer Portal (
DISCORD_BOT_TOKEN) - Authorized Discord User ID(s): Comma-separated Discord User Snowflake IDs (
DISCORD_ALLOWED_USERS) - One persistent volume mounted at
/datawith daily automated backups
Upstream: GitHub (OpenSource-Templates/Hermes)
Implementation Details
| Item | Value |
|---|---|
| Source Repo | OpenSource-Templates/Hermes (main) |
| Container Image Tag | Controlled via HERMES_IMAGE_VERSION (default latest) |
| Type | Background Discord Bot / Agent Daemon |
| Storage / Volume | /data (Daily automated backup schedule) |
| Primary Auth | Discord Bot Token + OpenRouter API Key |
| Access Control | Discord User ID Whitelist (DISCORD_ALLOWED_USERS) |
Topology
| Service | Role | Volume | Public | Notes |
|---|---|---|---|---|
| hermes-discord | Discord AI Bot & Agent Daemon | /data | No (Outbound Gateway) | Connects to Discord Gateway & OpenRouter API |
Volumes (drives) — what to mount
| Service | Mount path | What is stored |
|---|---|---|
| hermes-discord | /data | Agent conversation memory, local vector cache, state files, and workspace context |
Warning: Do not remove or detach the
/datavolume — deleting this volume will permanently wipe all stored agent memory, conversation cache, and workspace context during container redeployments.
Quick Start
- Click the Deploy on Railway button above.
- Sign in (or create a free Railway account).
- Obtain your Discord Bot Token:
- Go to the Discord Developer Portal.
- Create a New Application → Navigate to Bot.
- Click Reset Token and copy your token.
- Enable required Privileged Gateway Intents (specifically Message Content Intent) under the Bot tab.
- Under OAuth2 → URL Generator, select
botscope and required permissions (Send Messages, Read Message History, Embed Links), then use the generated URL to invite the bot to your Discord server.
- Obtain your OpenRouter API Key:
- Sign in to OpenRouter Keys and create a new API key.
- Retrieve your Discord User ID:
- Enable Developer Mode in Discord settings, right-click your profile avatar, and select Copy User ID.
- Fill in the required variables during Railway template deployment:
OPENROUTER_API_KEY: Your OpenRouter API key.DISCORD_BOT_TOKEN: Your Discord bot token.DISCORD_ALLOWED_USERS: Your Discord user ID (comma-separated for multiple users).
- Click Deploy.
- Monitor the deployment logs in Railway to confirm successful connection to Discord and OpenRouter.
Configuration
Container-level choices defined in the template:
| Variable | Default / Source | Description / Notes |
|---|---|---|
OPENROUTER_API_KEY | (Required) | OpenRouter API key used for LLM inference |
DISCORD_BOT_TOKEN | (Required) | Discord bot token from Discord Developer Portal |
DISCORD_ALLOWED_USERS | (Required) | Comma-separated Discord User IDs allowed to interact with the bot |
HERMES_IMAGE_VERSION | latest | Docker image tag version |
AGENT_CACHE_MEMORY_HIGH_MB | 750 | Optional agent cache memory threshold limit in MB |
DISCORD_ALLOW_ALL_USERS | "" | Set to true to allow any Discord user to query the bot (Not recommended) |
DISCORD_HOME_CHANNEL | "" | Optional Discord Channel ID for default bot announcements/context |
DISCORD_REQUIRE_MENTION | "" | Set to true to require @mention in server channels before responding |
Security & Memory Tuning
- Access Control (
DISCORD_ALLOWED_USERSvsDISCORD_ALLOW_ALL_USERS): By default,DISCORD_ALLOW_ALL_USERSis left empty. Keep access restricted viaDISCORD_ALLOWED_USERSto prevent unauthorized users from draining your OpenRouter API credits. - Server
@mentionRequirement (DISCORD_REQUIRE_MENTION): SettingDISCORD_REQUIRE_MENTION=trueprevents the bot from responding to every message in public Discord channels, ensuring it only triggers when explicitly tagged. - Agent Cache Tuning (
AGENT_CACHE_MEMORY_HIGH_MB): AdjustAGENT_CACHE_MEMORY_HIGH_MB(default750) based on your Railway service plan RAM allocation to prevent memory pressure or out-of-memory container restarts.
Updating Hermes Discord
- Open the hermes-discord service → Settings → Source.
- Trigger a rebuild or update
HERMES_IMAGE_VERSIONvariable to a specific release tag. - Click Redeploy.
All agent state and memory files inside /data will remain safe across updates and container restarts.
Traps
Common pitfalls and failure modes:
- Missing Message Content Intent in Discord Portal — Discord requires the Message Content Intent to be explicitly enabled under the Bot tab in the Discord Developer Portal. If disabled, the bot will join channels but fail to read incoming messages or prompt triggers.
- Empty
DISCORD_ALLOWED_USERSWhitelist — IfDISCORD_ALLOWED_USERSis omitted or left blank whileDISCORD_ALLOW_ALL_USERSis also empty, the bot will reject all incoming commands or ignore user messages. - OpenRouter API Credit Exhaustion — If your OpenRouter key runs out of credits or has rate limits imposed, Hermes will fail to generate responses and log API HTTP errors in Railway deployment logs.
- Missing
/dataVolume Mount — If the persistent/datavolume is detached, agent context, short-term memory, and conversation cache will reset every time Railway redeploys the container.
Why Deploy Hermes Discord on Railway?
Railway provides automated background worker execution with persistent storage backups and zero local server management. Hosting Hermes on Railway gives your Discord community or personal workspace an always-on, responsive AI agent with automatic daily volume backups and instant deployment controls.
Template Content
DISCORD_BOT_TOKEN
Discord bot token used to connect the application to your Discord bot.
OPENROUTER_API_KEY
OpenRouter API key used to authenticate requests to AI models through OpenRouter.
DISCORD_HOME_CHANNEL
Discord channel ID used as the bot's home or default channel.
DISCORD_ALLOWED_USERS
Comma-separated list of Discord user IDs allowed to interact with the bot.
DISCORD_ALLOW_ALL_USERS
Controls whether all Discord users are allowed to interact with the bot. Set to true or false.
DISCORD_REQUIRE_MENTION
Controls whether users must mention the bot before it responds. Set to true or false.
