Deploy Your Agent To Production

In this guide, we'll walk you through deploying with different providers.

Step-by-Step Deployment Guides

Why Host Your OpenServ Agent?

In this context, "deployment" means making your AI agent accessible via the internet so it can communicate with the OpenServ platform. It's the process of taking your code from running locally on your computer to running on a server that's publicly available online.

Deployment involves setting up your agent on a hosting service that provides a stable URL endpoint. This endpoint becomes the communication channel between your agent and the OpenServ infrastructure, allowing your agent to receive requests, process them, and return responses 24/7 without requiring your personal computer to stay online.

Think of it like moving your agent from a private workshop (your local machine) to a public storefront (a hosted server) where it can serve customers (OpenServ users) at any time, even when you're not personally available to manage it.

Deployment Options

You can deploy your agent to any hosting platform you prefer or even set it up on your own server. Each hosting option comes with its own set of advantages and disadvantages that will match differently with your specific needs as a developer, your technical expertise, and what your production environment requires.

For instance, beginner-friendly platforms offer simplicity but may limit customization, while self-hosting gives you complete control but requires more technical knowledge to maintain. Some services provide generous free tiers ideal for testing, while others offer robust scaling capabilities essential for high-traffic agents. Your choice ultimately depends on factors like your budget, expected traffic, required reliability, and how much time you want to spend on server management versus agent development.

Beginner-Friendly

These platforms handle most of the deployment complexity for you. They offer simple user interfaces, automated setups, and handle infrastructure management behind the scenes. You typically just connect your GitHub repository, set a few configuration options, and the platform handles the rest.

Intermediate

These options require more technical knowledge about concepts like containers and cloud infrastructure. While they still provide managed services, they expose more configuration options and expect users to understand deployment concepts at a deeper level.

Advanced (Self-Hosted)

Self-hosted options put you in complete control of your infrastructure. You need to provision your own servers (either physical or virtual), handle all security concerns, manage scaling, and maintain uptime yourself.

Railway Deployment Guide

Create an account on Railway and choose a plan that fits you.

  1. Create a New Project

    • Navigate to your Railway Dashboard

    • Click the + New button

    • Select Deploy from GitHub repo option

    • Connect your GitHub/GitLab account and select your agent repository

  2. Configure Deployment Settings

    • Runtime Environment: *it will automatically selected based on your code's language, e.g.: Node.js

    If you are using Node.js, double check:

    • Build Command: npm install && npm run build

    • Start Command: npm run start

    • On the project's homepage, select the Settings tab. Verify if you have selected your wished branch (usually main).

  3. Set Environment Variables

    • Click on the Variables tab in your project

    • Add the following variables:

      • OPENSERV_API_KEY: Your secret key from the OpenServ agent details page

      • OPENAI_API_KEY: Your OpenAI API key (if required)

  4. Deploy and Connect

    • Your deployment will start automatically. You can track the deployment process in the Deployments tab.

    • Once deployed, go to SettingsNetworkingCreate Domain

    • Copy the generated URL (e.g., your-agent-production.up.railway.app)

    • Add https:// to the beginning of the URL

    • Paste this complete URL into the Endpoint URL field on the OpenServ agent details page. ❗️Make sure https:// is added.

Render Deployment Guide

Create an account on Render and choose a plan that fits you.

  1. Create a New Web Service

    • Go to your Render Dashboard

    • Click New +Web Service

    • Connect your git service platform account (GitHub/GitLab/Bitbucket) and select your agent repository

  2. Configure Service Details

    • Environment: node

    • Build Command: npm install && npm run build

    • Start Command: npm run start

    • Branch: main (or your preferred branch)

  3. Set Environment Variables

    • Add the following variables:

      • OPENSERV_API_KEY: Your secret key from the OpenServ agent details page

      • OPENAI_API_KEY: Your OpenAI API key (if required)

  4. Deploy and Connect

    • Click Deploy Web Service and wait for the deployment to complete

    • Copy your service/ agent URL (e.g., https://my-custom-openserv-agent.onrender.com/)

    • Paste this URL into the Endpoint URL field on the OpenServ agent details page

Fly.io Deployment Guide

Create an account on Fly.io and choose a plan that fits you.

  1. Create a New Project Go to your Fly.io Dashboard. Click the Launch An App button. Connect your GitHub account and select your agent repository.

  2. Fill in the Details You can change the app name if desired (this will be used in your URL). Click Customize Deploy and configure:

    • Preferred region

    • Port: Change to 7378 (OpenServ Agent default) if needed

    • Machine size: shared-cpu-1x or shared-cpu-2x (for simple agents)

    • RAM: 256MB or 512MB (scale up to 1GB and shared-cpu-4x for popular agents)

  3. Set Environment Variables Add the following environment variables:

    • PORT: 3000 (optional, only if you didn't change the exposed port)

    • OPENSERV_API_KEY: Your secret key provided on the OpenServ agent details page

    • OPENAI_API_KEY: Your OpenAI API key (if required)

    • Any additional environment variables your tools might need

  4. Deploy the Project Click on Confirm Settings and wait for deployment to complete.

  5. Prevent Auto-Shutdown (Important) After deployment, click Generate Pull Request. Go to your GitHub repository and merge this pull request. Find the new fly.toml file and make these changes:

    • Change auto_stop_machines = 'stop' to auto_stop_machines = 'off'

    • Change min_machines_running from 0 to 1 Commit these changes.

  6. Redeploy with Updated Settings Return to Fly.io dashboard, navigate to the Deployments tab, and click Deploy App. Once redeployed, go to Overview and copy your app URL (e.g., https: //your-agent.fly.dev). Paste this URL into the Endpoint URL field on the OpenServ agent details page.

All done! Your agent is now running on Fly.io with persistent availability!

Community Collaboration: This guide is a contributions of our community members. Huge thanks to Enes Susan, Mathieu Barber and Akash Mondal for sharing their knowledge!

Last updated

Was this helpful?