This repo contains code for running a production-grade multi-agent system on Railway. It's powered by Agno's AgentOS: a high-performance runtime for serving agents, multi-agent teams and agentic workflows.
This repo gives you:
- AgentOS runtime: for serving agents, multi-agent teams and agentic workflows.
- PostgreSQL database: for storing agent sessions, knowledge, and memories.
- A set of pre-built agents, teams and workflows to use as a starting point.
For more details, checkout Agno and give it a βοΈ
Follow these steps to run your AgentOS:
git clone https://github.com/agno-agi/agentos-railway.git
cd agentos-railwayWe'll use OpenAI, Anthropic and Parallel Search services. Please export the following environment variables:
export OPENAI_API_KEY="YOUR_API_KEY_HERE"
export ANTHROPIC_API_KEY="YOUR_API_KEY_HERE"
export PARALLEL_API_KEY="YOUR_API_KEY_HERE"Tip
You can copy the example.env file and rename it to .env to get started.
We'll use docker to run the application locally and deploy it to Railway. Please install Docker Desktop if needed.
Run the application using docker compose:
docker compose up --build -dThis command builds the Docker image and starts the application:
- The AgentOS server, running on http://localhost:8000.
- The PostgreSQL database for storing agent sessions, knowledge, and memories, accessible on
localhost:5432.
Once started, you can:
- View the AgentOS runtime at http://localhost:8000/docs.
- Open the AgentOS UI
- Login and add
http://localhost:8000as a new AgentOS. You can call itLocal AgentOS(or any name you prefer).
The Agno Knowledge Agent is a great example of building a knowledge agent using Agentic RAG. It loads the Agno documentation into pgvector and answers questions from the docs.
To populate the knowledge base, run the following command:
docker exec -it agentos-railway-agent-os-1 python -m agents.agno_knowledge_agentTo load the data for the SQL Agent, run:
docker exec -it agentos-railway-agent-os-1 python -m agents.sql.load_f1_dataTo populate the knowledge base, run:
docker exec -it agentos-railway-agent-os-1 python -m agents.sql.load_sql_knowledgeThe Deep Knowledge Agent is a great example of building a deep knowledge agent using Agno.
To populate the knowledge base, run the following command:
docker exec -it agentos-railway-agent-os-1 python -m agents.deep_knowledge_agentWhen you're done, stop the application using:
docker compose downTo deploy the application to Railway, run the following commands:
- Install Railway CLI:
brew install railwayMore information on how to install Railway CLI can be found here.
- Login to Railway:
railway login- Deploy the application:
./scripts/railway_up.shThis command will:
- Create a new Railway project.
- Deploy a PgVector database service to your Railway project.
- Build and deploy the docker image to your Railway project.
- Set environment variables in your AgentOS service.
- Create a new domain for your AgentOS service.
To add knowledge to the Agno Knowledge Agent, run the following command:
railway ssh --service agent_osThis command will open a ssh session to the AgentOS service.
Once you are in the ssh session, you can run the following command to add knowledge to the Agno Knowledge Agent:
python -m agents.agno_knowledge_agentTo update the application, run the following command:
railway up --service agent_os -dThis rebuilds and redeploys the Docker image to your Railway service.
To delete the application, run the following command:
railway down --service agent_os
railway down --service pgvectorCareful: This command will delete the AgentOS and PgVector database services from your Railway project.
To connect the AgentOS UI to the AgentOS server:
- Open the AgentOS UI
- Create a new AgentOS by clicking on the
+button in the top left corner. - Enter the AgentOS URL and click on the
Connectbutton. - You can add a local endpoint from your dev setup. To add the railway endpoint, you will be provided with a coupon code during the workshop.
Follow these steps to setup your local development environment:
We use uv for python environment and package management. Install it by following the the uv documentation or use the command below for unix-like systems:
curl -LsSf https://astral.sh/uv/install.sh | shRun the dev_setup.sh script. This will create a virtual environment and install project dependencies:
./scripts/dev_setup.shActivate the created virtual environment:
source .venv/bin/activate(On Windows, the command might differ, e.g., .venv\Scripts\activate)
If you need to add or update python dependencies:
Add or update your desired Python package dependencies in the [dependencies] section of the pyproject.toml file.
The requirements.txt file is used to build the application image. After modifying pyproject.toml, regenerate requirements.txt using:
./scripts/generate_requirements.shTo upgrade all existing dependencies to their latest compatible versions, run:
./scripts/generate_requirements.sh upgradeRebuild your Docker images to include the updated dependencies:
docker compose up -d --buildNeed help, have a question, or want to connect with the community?
- π Read the Agno Docs for more in-depth information.
- π¬ Chat with us on Discord for live discussions.
- β Ask a question on Discourse for community support.
- π Report an Issue on GitHub if you find a bug or have a feature request.