Files
mesh-configs/skills/devops/model-allocation/SKILL.md
T

4.5 KiB

name, description, related_skills
name description related_skills
model-allocation Kostenkontrollierte, verhältnismäßige Modell-Auswahl für Hermes-Agents. Drei Ebenen: tägliche Ausrichtung, stündliches Feintuning, Task-bezogenes Matching. Lokaler Fallback über VPS-Ollama (deepseek-r1:7b) mit 64k+ Kontext und Thinking. Budget: 1€/Tag/Agent, bei Überschreitung → postpone + lokaler Fallback.
multi-agent-mesh

Model-Allocation-Skill

Automatisierte Entscheidungslogik für Modell-Wahl pro Agent und Task.

Prinzipien

  • Kosten ~99% Gewicht, Zeit spielt keine Rolle
  • Kein Free-Only-Zwang, aber proportionaler Aufstieg erlaubt
  • Kein Ferrari-Sprung (>5x Kosten) ohne manual_override
  • Diversität als Ziel (min 3 Modell-Familien)

Die drei Ebenen

Ebene 1 — Täglich (grobe Ausrichtung)

  • scripts/daily_model_check.py
  • Holt Modell-/Preisliste (Mock → OpenRouter-API)
  • Filtert ≥64k Kontext, baut Prioritätsliste pro Agent
  • Prüft Diversität, schreibt state/model_priority.json

Ebene 2 — Stündlich (Feintuning)

  • scripts/hourly_finetune_check.py
  • Prüft Budget-Warnschwelle (1€/Tag/Agent), Verfügbarkeit, Rate-Limits
  • Bei Überschreitung: Tasks auf nächsten Tag verschieben
  • Einfache Anfragen → lokales VPS-Ollama (deepseek-r1:7b)

Ebene 3 — Task-bezogen (Feinauswahl)

  • scripts/task_agent_matcher.py
  • Input: Capability-Tag → findet günstigste passende Kombination
  • Eskaliert max eine Stufe bei Fehlschlag
  • Fallback auf lokales Ollama wenn kein Agent verfügbar
  • Max 3 Retries pro Task

Konfiguration

Siehe config/agents.yaml für die vollständige Config.
Siehe references/agents-config.md für eine kompakte Übersicht.

Pro Agent: Modell, Eskalationsleiter, Tags, Budget
Global: min_context=64000, max_escalation=5x, min_diversity=3
local_fallback.model: deepseek-r1:7b (Thinking + 128k Kontext)

Lokale Modelle auf dem VPS

Modell Größe Kontext Thinking Status
deepseek-r1:7b 4.7 GB 128k ✅ aktiv (Default)
deepseek-r1:14b 9.0 GB 128k ✅ runtergeladen, ungetestet

⚠️ WICHTIG: Ollama Bindungs-Address

Das Ollama-Installation auf dem VPS lauscht an 172.24.196.119:11434 (VPS-Externe IP), NICHT an localhost:11434.

Konsequenz: Das Config-base_url muss http://172.24.196.119:11434/v1 lauten, damit das Modell von anderen Mesh-Agenten (oder demselben Agenten im Netzwerk) darauf zugreifen kann.

Fehlgeschlagene Verbindungssymptome:

  • curl http://localhost:11434/api/tags → Connection refused (wenn Ollama nicht localhost-bound)
  • Modell kann lokalen Ollama-Fallback nicht erreichen
  • Task fällt auf nächstes teureren OpenRouter-Modell aus

Behebung: Config-Key ollama.base_url auf http://172.24.196.119:11434/v1 setzen. Siehe references/ollama-bind-address.md für Details.

Warum deepseek-r1:7b? Thinking + 128k Kontext in 4.7 GB — optimal für 16 GB RAM VPS.
deepseek-r1:14b ist Upgrade-Option sobald RAM-Puffer bestätigt ist.

Setup

pip install pyyaml --break-system-packages

Detailierte Modell-Vergleiche: references/local-model-comparison.md

Cron

Lokal (auf Hub/Agent A via Hermes-Cron)

hermes cron add --schedule '0 3 * * *' --name model-allocation-daily \
  --prompt 'cd ~/.hermes/skills/devops/model-allocation && python3 scripts/daily_model_check.py'
hermes cron add --schedule '0 * * * *' --name model-allocation-hourly \
  --prompt 'cd ~/.hermes/skills/devops/model-allocation && python3 scripts/hourly_finetune_check.py'

Auf Remote-Agents per SSH (crontab)

Verwende ein Setup-Script für mehrere Agenten gleichzeitig:

# setup_model_cron.sh
mkdir -p $HOME/.hermes/logs
if crontab -l 2>/dev/null | grep -q 'model-allocation'; then
    echo "Cron bereits da"; exit 0
fi
(crontab -l 2>/dev/null
 echo "# model-allocation: täglich 03:00"
 echo "0 3 * * * cd \$HOME/.hermes/skills/devops/model-allocation \\"
 echo "  && python3 scripts/daily_model_check.py >> \$HOME/.hermes/logs/model-allocation-daily.log 2>&1"
 echo "# model-allocation: stündlich"
 echo "0 * * * * cd \$HOME/.hermes/skills/devops/model-allocation \\"
 echo "  && python3 scripts/hourly_finetune_check.py >> \$HOME/.hermes/logs/model-allocation-hourly.log 2>&1"
) | crontab -
echo "Cron eingerichtet"

# Auf mehreren Remotes gleichzeitig:
for ip in 172.24.20.26 172.24.34.142 172.24.178.202; do
    sshpass -p 'PW' scp setup_model_cron.sh user@$ip:/tmp/
    sshpass -p 'PW' ssh user@$ip 'bash /tmp/setup_model_cron.sh'
done