- Deploy to Railway:
./scripts/railway/up.sh - Sync environment variables:
./scripts/railway/env-sync.sh - Redeploy the app:
./scripts/railway/redeploy.sh - Tear down the Railway project:
./scripts/railway/down.sh
Prerequisites
- A Railway account
- The Railway CLI installed and authenticated (
railway login)
Why JWT is on by default
JWT authorization is enabled by default. Production startup requires aJWT_VERIFICATION_KEY or JWT_JWKS_FILE. During an interactive deploy, the script pauses for a verification key when neither value is configured.
JWT authorization provides:
- Protected application routes. Requests to agent, team, workflow, and data routes require a valid token.
- Per-request identity. Middleware parses the token and exposes
user_id,session_id, and custom claims to protected routes. - Granular permissions. A user token can be scoped to run a single agent. An admin token can read all sessions and test any agent.
/, /health, /info, /docs, /redoc, /openapi.json, and /docs/oauth2-redirect.
Per-user data isolation is opt-in. Set authorization_config=AuthorizationConfig(user_isolation=True) to limit non-admin users to their own sessions, memories, traces, and runs. See User Isolation.
Deploy your agent platform to Railway
1
Configure your production environment
The deploy and sync scripts read Skip this command if
.env.production. This keeps local and production values separate: different OpenAI keys with different budgets, production-only credentials, or a different Slack workspace.Create the file the first time you deploy:.env.production already exists. Edit the file with a production OpenAI key.2
Provision and deploy
- Creates a Railway project for your agent platform.
- Provisions a Postgres service (with pgvector) and a persistent volume.
- Creates the
agent-osservice and forwards the database connection vars. - Issues your public Railway domain and sets
AGENTOS_URLto it, on Railway and in.env.production. - Generates
MCP_CONNECT_SECRETfor hosted MCP clients and saves it to.env.productionand Railway. - Asks for a JWT verification key when neither JWT setting is configured.
- Builds and deploys from the current directory.
3
Mint your verification key
os.agno.com can generate the keypair while the script waits:You can also bring your own keypair. Generate an RSA keypair, sign tokens with the private key in your own auth service, and put the matching public key in
- Click Connect OS → Live, enter your Railway domain, and name it Live Agent Platform.
- Go to Settings → OS & Security and turn on Token-Based Authorization (JWT). The UI generates an RSA keypair, keeps the private key, and shows you the public key.
- Paste the public key into the script prompt. The script saves it to
.env.productionand sets it on Railway, then deploys.
Live AgentOS connections are a paid feature. Use code
PLATFORM30 for one month off.JWT_VERIFICATION_KEY. The middleware verifies RS256 by default. For another algorithm, set algorithm in authorization_config.4
Confirm it's live
/agents route should return 401 without a token. Open https://<your-app>.up.railway.app/docs to inspect the deployed API. Use railway logs --service agent-os if either check fails.5
Connect MCP clients
Register the deployed AgentOS with supported local clients:For ChatGPT or Claude on the web, add
https://<your-app>.up.railway.app/mcp as a custom connector. Enter the MCP_CONNECT_SECRET stored in .env.production on the consent page.Auto-deploys from GitHub
Until GitHub auto-deploy is connected, redeploy code changes with./scripts/railway/redeploy.sh. To deploy on every push to main:
- Open the Railway dashboard → your project → the
agent-osservice → Settings. - Under Source, click Connect Repo and pick your repo.
- Set the deploy branch to
main.
main now triggers a build and deploy. ./scripts/railway/env-sync.sh is still how you push env changes.
External authentication boundary
If a private network or trusted gateway already blocks unauthenticated traffic, setauthorization=False in app/main.py. JWT middleware still validates tokens while JWT_VERIFICATION_KEY or JWT_JWKS_FILE remains configured. Remove those values from .env.production and the Railway agent-os service, then redeploy. MCP_CONNECT_SECRET controls the separate OAuth flow for MCP clients. Remove it from both places too if the gateway should protect /mcp. Keep AgentOS authorization enabled for internet-accessible deployments and services that hold user data.
./scripts/railway/env-sync.sh updates variables present in .env.production; it does not remove variables you deleted from the file.
Scaling
The starter is configured for one replica with 4 GiB of memory and 2 vCPU. Adjust the resource limits inrailway.json as load grows. Validate schedules and long-lived MCP connections with your workload before increasing numReplicas.
Operations
See Railway Reference for environment variables, customization, and troubleshooting.