Skip to main content
Starter Template ships one Railway script. It provisions Postgres, the app service, and a public domain. Any Docker-capable host works, but Railway is the fast path.

Prerequisites

  • A Starter Template repo set up locally (setup)
  • A Railway account
  • The Railway CLI installed and authenticated (railway login)
  • OPENAI_API_KEY exported in your shell (the script reads it from there)

Step 1: Provision and deploy

./scripts/railway_up.sh
This script:
  1. Creates a Railway project called agent-os.
  2. Deploys a pgvector Postgres service from the public template.
  3. Creates the agent-os application service and forwards the database connection vars plus OPENAI_API_KEY and PORT.
  4. Builds and deploys the app from the current directory.
  5. Issues a public Railway domain.
The script prints the assigned URL right away. The domain takes ~5 minutes to start resolving.

Step 2: Load the Knowledge Agent in production

The local index doesn’t carry over. Run the loader against the deployed service:
railway run python -m agents.knowledge_agent
This connects to the Railway Postgres via the project’s env vars and seeds the pgvector index with the default documents.

Step 3: Verify

Once the domain resolves:
curl https://your-agent-os.up.railway.app/health
# {"status":"ok"}
Then connect the AgentOS UI:
  1. Open os.agno.com.
  2. Click Add OS, choose Live, paste your Railway URL.
  3. Click Connect.

Add more env vars

The deploy script only forwards OPENAI_API_KEY and the database vars. To add more (Anthropic, Google, custom MCP secrets), set them on the service directly:
railway variables --service agent-os --set "ANTHROPIC_API_KEY=sk-ant-***"
railway variables --service agent-os --set "GOOGLE_API_KEY=***"
Railway redeploys automatically when variables change.

Redeploys

After code changes:
railway up --service agent-os -d
The -d flag detaches so the CLI doesn’t tail logs. Use railway logs --service agent-os to follow them.

What you get

ResourcePurpose
agent-os serviceThe AgentOS app, FastAPI on port 8000
pgvector servicePostgres with the pgvector extension, used for sessions, memory, and the knowledge index
Railway-issued domainPublic HTTPS endpoint

Operations

TaskCommand
Tail logsrailway logs --service agent-os
Open the dashboardrailway open
Run a command in the containerrailway run <command>
Stop the apprailway down --service agent-os
Stop Postgresrailway down --service pgvector
Adjust replicas, CPU, and memory in railway.json.

Next

Next Steps →