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”)
- Ownership — my code, my infra, my data
- Cost control — predictable monthly spend
- Persistence — agents run continuously
- Flexibility — CLI, API, cron, internal tools
- No vendor lock-in
High-Level Architecture
- VPS (WHM / cPanel based)
- One FastAPI app per agent
- Uvicorn bound to
127.0.0.1 - systemd keeps the agent alive
- Public access handled later via reverse proxy
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.