Engineering • Infrastructure

How I Deploy AI Agents on a VPS

Solo dev. No platforms. Full ownership.

AI Agents FastAPI systemd Infrastructure

Most AI agent tutorials stop at notebooks, local scripts, or cloud abstractions.

This one doesn’t.

This post walks through how I deploy real AI agents on my own VPS using FastAPI, Uvicorn, systemd, and Python virtual environments — with zero managed platforms.

No hype. No magic. Just infrastructure.


Why I Chose a VPS (Instead of “AI Platforms”)


High-Level Architecture

This is boring infrastructure — which is exactly what you want.


Server Overview (Dev Playground)


Domain:        appaveli.dev
SSH User:      appavelidev
App Directory: /home/appavelidev/my-agent
Python venv:   /home/appavelidev/my-agent/venv
Service Name:  my-agent
Internal Port: 9000
        

Running the Agent 24/7 with systemd


sudo nano /etc/systemd/system/my-agent.service
        

[Unit]
Description=My Agent FastAPI Service
After=network.target

[Service]
User=appavelidev
Group=appavelidev
WorkingDirectory=/home/appavelidev/my-agent
Environment="PATH=/home/appavelidev/my-agent/venv/bin"
ExecStart=/home/appavelidev/my-agent/venv/bin/uvicorn \
  my_agent.web_api.sample_api:app \
  --host 127.0.0.1 \
  --port 9000
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
        

If you can start, stop, and inspect this service, you are operating AI — not demoing it.

Quiet. Owned. Intentional.