BUILD · Jun 10, 2026

How to host an AI agent: a beginner's guide

A simple guide to hosting your first AI agent. from running it locally to deploying on a VPS or cloud server. Covers the basics of Docker, API keys, and keeping your agent running.

Agent-ready: drop this post into Claude Code or Codex

TL;DR: I built my first agent on a Friday. By Saturday it was running on a $6/month server with a live URL. You don’t need a GPU: your agent calls LLM APIs remotely. The quickest path is Docker + Railway. Here is exactly how.

I built an agent on my laptop. It worked. I wanted it live so I could access it from anywhere. That weekend I went from “works on my machine” to “works for other people.” The total cost: ₹500/month ($6) for the server plus API usage.

This guide covers the simplest path to getting your agent on a server. For a deeper dive into production infrastructure, see the detailed deployment server guide.

Key takeaways:

  • No GPU needed: your agent calls LLM APIs, not runs them
  • Docker + Railway is the quickest path: 5 minutes from repo to live URL
  • Store API keys as environment variables, never in code
  • Add health checks so you know when your agent goes down
  • Start with a platform, graduate to a VPS when you outgrow it

What you need

An AI agent is just code that calls LLM APIs. It doesn’t need a GPU or specialized hardware. Any server that can run Python or Node.js can host it.

RequirementMinimumRecommended
RAM256 MB1 GB
CPU1 core2 cores
Storage1 GB10 GB
OSLinuxUbuntu 22.04+

How do I deploy an agent on Railway?

Railway is the fastest way to get an agent online. It auto-detects your project type and handles Docker builds, networking, and SSL.

  1. Create a Railway account and install the CLI
  2. Connect your GitHub repo
  3. Add API keys as environment variables in the dashboard
  4. Run railway up or connect the repo for auto-deploy
  5. Get a yourapp.railway.app URL

Railway handles restart on crash, logs, and basic monitoring out of the box. For a personal agent or prototype, this is all you need.

How do I deploy an agent on a VPS?

For production workloads or when you need full control over the environment, a VPS from DigitalOcean, Hetzner, or Linode gives you a Linux server to work with.

# After SSHing into your VPS
apt update && apt install -y docker.io
git clone https://github.com/you/your-agent.git
cd your-agent
export ANTHROPIC_API_KEY=sk-ant-..
docker build -t my-agent .
docker run -d -p 8080:8080 --name my-agent my-agent

Your agent is now live on http://your-server-ip:8080. Add Nginx as a reverse proxy for SSL and a custom domain.

How do I keep my agent running reliably?

Two things matter after deployment:

Health checks. Add a /health endpoint to your agent that returns 200. Your hosting platform can ping this every minute and restart the agent if it stops responding.

Restart policy. Docker’s --restart unless-stopped flag ensures your agent comes back up after a crash or server reboot. Always use it.

docker run -d --restart unless-stopped -p 8080:8080 --name my-agent my-agent

That’s it. Your agent is live. For more advanced setup, Nginx reverse proxy, custom domains, monitoring dashboards, and zero-downtime deploys, check the detailed deployment server guide.

FAQ

What’s the easiest way to host an AI agent? The simplest path is Railway or Fly.io. Both support Docker deployments with minimal configuration: push your agent code, set up environment variables for API keys, and get a public URL. No server management needed.

Do I need a GPU to host an AI agent? No. Your agent calls LLM APIs. The GPU is on the provider’s side. You just need a server with enough memory to run your agent code and handle concurrent requests. A ₹400-800/month VPS ($5-10) is enough for a personal agent.

How much does it cost to host an AI agent? Server costs are low: ₹400-1,600/month ($5-20) depending on your provider. The main cost is LLM API calls, which can range from ₹800/month ($10) for light use to tens of thousands for production workloads.

What’s the fastest way to get an agent online? Use Railway. Create an account, connect your GitHub repo, add your API keys as environment variables, and deploy. Railway auto-detects Docker or Node.js and gives you a URL in under 5 minutes.


This article was published on Agentic Up (https://agenticup.dev): practical guides for developers and founders building with AI agents. Reach me at hello@agenticup.dev.

Newsletter

Get the brief on AI agents

Practical posts on shipping agents, automating work, and building in public. No hype, no fluff.

Contact: hello@agenticup.dev