Perseus is an AI orchestration platform that routes natural language commands to specialized agents across a self-hosted Proxmox homelab. It integrates multiple LLM providers (Grok/xAI, OpenAI, and local Ollama) with runtime model switching, SSH-based infrastructure management...
20-agent task routing system with multi-LLM integration, infrastructure management, and Discord command and control
Perseus is an AI orchestration platform that routes natural language commands to specialized agents across a self-hosted Proxmox homelab. It integrates multiple LLM providers (Grok/xAI, OpenAI, and local Ollama) with runtime model switching, SSH-based infrastructure management, web search, social media posting, and real-time health monitoring -- all controllable via Discord.
The system acts as a centralized command layer for homelab operations: from GPU monitoring and database backups to content generation and competitive analysis.
+------------------+ +------------------+
| Discord Bot | | FastAPI REST |
| (DM + Channel) | | (Port 3002) |
+--------+---------+ +--------+---------+
| |
+------------+-------------+
|
+-------v--------+
| Chat Router |
| (Intent Match) |
+-------+--------+
|
+----------------+----------------+
| | | | |
+----v--+ +---v--+ +--v---+ +-v-----+ +v---------+
|System | |Infra | |Agent | |Search | |General |
|Cmds | |SSH | |Route | |Brave | |Assistant |
+-------+ +------+ +--+---+ +------+ +----------+
|
+------------+------------+
| | | | |
social trend content comply revenue
post hunt curator scan track
Each agent has a designated LLM backend (cloud or local) and trigger phrases:
!model grok / !model gpt / !model ollama [name]!execThe AI can emit structured directives that Perseus interprets and executes:
EXECUTE:hostname:command -- runs SSH commands inline during conversationSEARCH:query -- triggers Brave web search and injects results| Component | Purpose |
|---|---|
| Python 3.11 | Core runtime |
| FastAPI | REST API (port 3002) |
| Discord.py | Bot interface with DM admin |
| PostgreSQL | Agent activity logging, cost analytics |
| Grok/xAI API | Primary AI brain with web + X search |
| OpenAI API (GPT-4o-mini) | Compliance scanning |
| Ollama | Free local LLM inference on GPU |
| Brave Search API | Web search integration |
| X/Twitter API | OAuth 1.0a social posting |
| Node.js + Express | Video library microservice API |
| SSH + subprocess | Cross-node command execution |
git clone https://github.com/YOUR_USERNAME/perseus-ai-platform.git
cd perseus-ai-platform
pip install fastapi uvicorn requests discord.py psycopg2-binary
# Set up PostgreSQL
createdb perseus
psql perseus -c "CREATE TABLE metadata (id SERIAL PRIMARY KEY, agent TEXT, timestamp TEXT, command TEXT, result TEXT, cost_usd REAL DEFAULT 0);"
# Configure environment
cp .env.example .env
# Edit .env with your API keys, IPs, and credentials
# For video API (optional)
cd video-api && npm install && cd ..
# Start Perseus (Discord + FastAPI + all agents)
uvicorn main:app --host 0.0.0.0 --port 3002
# Start video API (optional, separate process)
node video-api.js
See .env.example for all environment variables. Key settings:
| Variable | Description |
|---|---|
XAI_API_KEY |
Grok/xAI API key (primary brain) |
OPENAI_API_KEY |
OpenAI API key (compliance scanner) |
BRAVE_API_KEY |
Brave Search API key |
DISCORD_TOKEN |
Discord bot token |
OLLAMA_URL |
Ollama server URL |
PG_* |
PostgreSQL connection details |
NODE*_IP |
Infrastructure node IP addresses |
MONTHLY_BUDGET |
API spend ceiling (default $10) |