Skip to main content
AI Agent Infrastructure — Self-Hosted Multi-Model Orchestrator — cover image

AI Agent Infrastructure — Self-Hosted Multi-Model Orchestrator

Self-hosted AI agent infrastructure using Hermes Agent, 9router, n8n, and open-source models on a single VPS, with remote Claude Code access over Tailscale.

Client Personal
Completed
HermesAutomation9routerOpenRouterClaude CodeTailscaleVPSLLM

Overview

A self-hosted AI agent orchestration system running on a single VPS, combining Hermes Agent as the reasoning engine, 9router as a unified model gateway, n8n for workflow automation, and PostgreSQL/pgvector for semantic memory. This infrastructure powers daily workflows: coding assistance, content creation, Persian article research, automated news pipelines, and multi-agent translation systems.

The Problem

Cloud-dependent AI tools fragment the workflow. Each tool uses a different provider, a different API key, a different pricing model. Switching between OpenAI, Anthropic, and open-source models means managing multiple accounts, keys, and cost centers. For someone learning AI by building rather than by theory, this friction kills momentum. The goal was a single endpoint where every agent picks the right model automatically, with no per-provider account management, and one that I could also reach and drive from anywhere.

Architecture

The system uses a lightweight orchestration layer on a single VPS to route, execute, and persist AI operations:

Model Gateway Layer (9router) receives every LLM request through a single OpenAI-compatible endpoint and routes it to the optimal model: Anthropic for reasoning-heavy coding, DeepSeek for cost-efficient general tasks, GPT for structured output. Selection happens automatically based on the agent’s declared needs and context budget constraints.

Agent Runtime (Hermes Agent) hosts a growing set of skill-based agents that load their own context, knowledge base, and tool sets: content writing, Persian translation, code review, GitHub automation, and research synthesis. Each skill is a self-contained workflow with its own reference files and guardrails.

Workflow Engine (n8n) + Vector Store (pgvector) schedules and orchestrates long-running pipelines: RSS monitoring → summarization → translation → human approval → publishing. pgvector stores embeddings for semantic retrieval, powering both the CV chatbot and the news research agent.

Ingestion & Monitoring (FreshRSS + Caddy) — FreshRSS aggregates RSS feeds for the news pipeline while Caddy manages TLS, reverse proxying, and automatic certificate renewal across all services.

Remote Development Access (Claude Code + Tailscale) — Claude Code runs on the same VPS with browser-based terminal access, routed through 9router, so I can start an agentic coding session from any device without a local dev environment. Tailscale bridges the VPS securely with other machines on the network, keeping access private without exposing anything publicly.

Results

  • Single model gateway replaces 4+ provider dashboards
  • Sub-200ms model switching with no cold starts per request
  • Zero cloud vendor lock-in — models can be swapped or added via 9router config
  • All agents share a common memory and tool infrastructure
  • Full coding environment reachable from a browser on any device, with no local setup

Technical Challenges

The architecture decision (one VPS vs. distributed) was the first trade-off. Self-hosting a model gateway alongside n8n, pgvector, FreshRSS, and Caddy on a single machine required lightweight image choices and careful port management. The second challenge was semantic memory: ensuring pgvector embeddings stay fresh while the knowledge base grows requires scheduled re-indexing triggered via n8n cron jobs.

Stack

Hermes Agent, 9router, n8n, PostgreSQL/pgvector, FreshRSS, Caddy, Claude Code, Tailscale, Docker.