> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy to Railway

> Deploy AgentOS to Railway with PostgreSQL, automatic HTTPS, and a public domain.

This template deploys AgentOS and PostgreSQL to Railway. It includes example agents ready to use after deployment, automatic HTTPS, and a public domain.

## Prerequisites

* [Docker Desktop](https://docker.com/desktop)
* [OpenAI API key](https://platform.openai.com)

## Development

Run locally before deploying to Railway.

<Steps>
  <Step title="Clone the template">
    ```bash theme={null}
    git clone \
      https://github.com/agno-agi/agentos-railway-template.git \
      agentos

    cd agentos
    ```

    The template includes the following agents:

    | Agent           | Description                                              |
    | :-------------- | :------------------------------------------------------- |
    | Knowledge Agent | Answers questions from your documents using Agentic RAG. |
    | MCP Agent       | Connects to external tools via Model Context Protocol.   |
  </Step>

  <Step title="Set your API key">
    ```bash theme={null}
    cp example.env .env
    ```

    Edit `.env` and add your `OPENAI_API_KEY`.
  </Step>

  <Step title="Start AgentOS">
    ```bash theme={null}
    docker compose up -d --build
    ```
  </Step>

  <Step title="Load knowledge">
    ```bash theme={null}
    docker exec -it agentos-api python -m agents.knowledge_agent
    ```

    This loads the default documents into the Knowledge Agent's vector database. You can add your own documents as needed.
  </Step>

  <Step title="Confirm it's running">
    Navigate to [localhost:8000/docs](http://localhost:8000/docs) to see your AgentOS API.
  </Step>

  <Step title="Connect to the control plane">
    1. Go to [os.agno.com](https://os.agno.com)
    2. Click **Connect OS** → Select **Local**
    3. Enter `http://localhost:8000`
  </Step>
</Steps>

<Check>Your AgentOS is running locally.</Check>

## Production

Deploy to Railway when you're ready to go live.

### Prerequisites

* [Railway account](https://railway.app) (free tier works)
* [Railway CLI](https://docs.railway.com/cli#installing-the-cli)

<Steps>
  <Step title="Login to Railway">
    ```bash theme={null}
    railway login
    ```
  </Step>

  <Step title="Deploy">
    ```bash theme={null}
    ./scripts/railway_up.sh
    ```

    Takes \~2 minutes. The script creates your Railway project, provisions PostgreSQL with pgvector, and deploys AgentOS.
  </Step>

  <Step title="Load knowledge">
    ```bash theme={null}
    railway run python -m agents.knowledge_agent
    ```
  </Step>

  <Step title="Get your domain">
    ```bash theme={null}
    railway open
    ```

    Find your URL in the Railway dashboard (e.g., `my-agentos.up.railway.app`). Navigate to `<your-domain>/docs` to confirm the API is running.
  </Step>

  <Step title="Connect to the control plane">
    1. Go to [os.agno.com](https://os.agno.com)
    2. Click **Connect OS** → Select **Live**
    3. Paste your Railway domain

    <Frame>
      <img className="block dark:hidden" src="https://mintcdn.com/agno-v2/ACGFg1IKv6IfuEMR/images/agent-os-connection-railway-light.png?fit=max&auto=format&n=ACGFg1IKv6IfuEMR&q=85&s=60338a1404ecc414aa72dd8a0d71c024" alt="AgentOS connection dialog" width="1232" height="1478" data-path="images/agent-os-connection-railway-light.png" />

      <img className="hidden dark:block" src="https://mintcdn.com/agno-v2/ACGFg1IKv6IfuEMR/images/agent-os-connection-railway.png?fit=max&auto=format&n=ACGFg1IKv6IfuEMR&q=85&s=14f29c8dd1a884c11e9402b12dd72598" alt="AgentOS connection dialog" width="1232" height="1464" data-path="images/agent-os-connection-railway.png" />
    </Frame>
  </Step>
</Steps>

<Check>Your AgentOS is live on Railway.</Check>

## Next Steps

<CardGroup cols={2}>
  <Card title="Add apps" icon="grid-2" href="/deploy/apps">
    Browse agents, teams, and workflows for your deployment.
  </Card>

  <Card title="Connect interfaces" icon="comments" href="/deploy/interfaces">
    Expose your agents on Slack, Discord, WhatsApp, or MCP.
  </Card>
</CardGroup>
