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: Hosting an AI agent is simpler than it sounds. You don’t need a GPU: your agent calls LLM APIs remotely. The quickest path is Docker + Railway: write a Dockerfile, set API keys as environment variables, deploy with a git push. Costs $5-20/month.

So you built an AI agent on your laptop. It works. Now you want it live so you can access it from anywhere, share it with a team, or point a webhook at it. Hosting is the step between “works on my machine” and “works for other people.”

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+

Option 1: Railway (simplest)

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.

Option 2: VPS (more control)

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.

Keeping it running

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.


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

Newsletter

Get the brief on AI agents

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

Contact: [email protected]