Skip to content

agno-agi/agentos-railway

Repository files navigation

AgentOS on Railway

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 ⭐️

Get Started

Follow these steps to run your AgentOS:

Clone the repo

git clone https://github.com/agno-agi/agentos-railway.git
cd agentos-railway

Configure API keys

We'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.

Install Docker

We'll use docker to run the application locally and deploy it to Railway. Please install Docker Desktop if needed.

Run AgentOS Locally

Run the application using docker compose:

docker compose up --build -d

This 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:

Connect the AgentOS UI to the AgentOS server

  • Open the AgentOS UI
  • Login and add http://localhost:8000 as a new AgentOS. You can call it Local AgentOS (or any name you prefer).

Load Knowledge Base for the Agno Knowledge Agent

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_agent

Load data for the SQL Agent

To load the data for the SQL Agent, run:

docker exec -it agentos-railway-agent-os-1 python -m agents.sql.load_f1_data

To populate the knowledge base, run:

docker exec -it agentos-railway-agent-os-1 python -m agents.sql.load_sql_knowledge

Load Knowledge Base for the Deep Knowledge Agent

The 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_agent

Stop the application

When you're done, stop the application using:

docker compose down

Deploy AgentOS to Railway

To deploy the application to Railway, run the following commands:

  1. Install Railway CLI:
brew install railway

More information on how to install Railway CLI can be found here.

  1. Login to Railway:
railway login
  1. Deploy the application:
./scripts/railway_up.sh

This 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.

Adding Knowledge on Railway

To add knowledge to the Agno Knowledge Agent, run the following command:

railway ssh --service agent_os

This 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_agent

Updating the application

To update the application, run the following command:

railway up --service agent_os -d

This rebuilds and redeploys the Docker image to your Railway service.

Deleting the application

To delete the application, run the following command:

railway down --service agent_os
railway down --service pgvector

Careful: This command will delete the AgentOS and PgVector database services from your Railway project.

Connecting the AgnoUI to the AgentOS server

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 Connect button.
  • 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.

Development Setup

Follow these steps to setup your local development environment:

Install uv

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 | sh

Create Virtual Environment & Install Dependencies

Run the dev_setup.sh script. This will create a virtual environment and install project dependencies:

./scripts/dev_setup.sh

Activate Virtual Environment

Activate the created virtual environment:

source .venv/bin/activate

(On Windows, the command might differ, e.g., .venv\Scripts\activate)

Managing Python Dependencies

If you need to add or update python dependencies:

Modify pyproject.toml

Add or update your desired Python package dependencies in the [dependencies] section of the pyproject.toml file.

Generate requirements.txt

The requirements.txt file is used to build the application image. After modifying pyproject.toml, regenerate requirements.txt using:

./scripts/generate_requirements.sh

To upgrade all existing dependencies to their latest compatible versions, run:

./scripts/generate_requirements.sh upgrade

Rebuild Docker Images

Rebuild your Docker images to include the updated dependencies:

docker compose up -d --build

Community & Support

Need 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •