- Deploy to Railway:
./scripts/railway/up.sh - Sync environment variables:
./scripts/railway/env-sync.sh - Redeploy the app:
./scripts/railway/redeploy.sh
Prerequisites
- A Railway account
- The Railway CLI installed and authenticated (
railway login)
Why JWT is on by default
Token-Based Authorization is ON by default. Without aJWT_VERIFICATION_KEY (or JWT_JWKS_FILE), the app refuses to serve traffic in production. This is why the deploy script stops and asks you for a key.
Token-Based Auth gives you three things:
- 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.
Deploy your agent platform to Railway
1
Configure your production environment
The deploy and sync scripts read Edit
.env.production. This keeps local and production values separate: different OpenAI keys with different budgets, production-only credentials, a different Slack workspace..env.production 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. - Pauses and asks for a JWT verification key.
- 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 and enter your Railway domain.
- Name it Live Agent Platform, turn on Token-Based Authorization (JWT) on the connection panel, and connect. The UI generates an RSA keypair, keeps the private key, and shows you the public key. If the OS is already connected, enable the setting under Settings → OS & Security.
- 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
https://<your-app>.up.railway.app/docs and you’re live.Auto-deploys from GitHub
By default every code update needs./scripts/railway/redeploy.sh. To auto-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.
Opting out of JWT (not recommended)
If you must run production without auth (inside a private VPC behind another auth layer), setauthorization=False in app/main.py and redeploy. Keep authorization on for any deploy holding real data. Without it, anyone who guesses your Railway domain can read your sessions and run your agents.
Scaling
The default deploy is one replica with 4 GiB of memory and 2 vCPU. ChangenumReplicas and limits in railway.json as your load and availability requirements grow.