Using a self-hosted Hermes AI agent lets you run a private, customizable AI assistant on your own hardware—ideal for privacy-focused automation, local data processing, and tailored workflows without relying on external cloud services. You’ll need a capable machine (typically with a modern CPU and at least 8GB RAM), basic Linux/terminal familiarity, Docker installed, and access to a compatible open-weight LLM (like Llama 3 8B or Mistral 7B). Hermes is an open-agent framework built on top of models fine-tuned for tool use and reasoning, and self-hosting means full control over data, cost, and customization—but requires setup effort.
What You'll Need
- A computer or server (Linux or macOS recommended; Windows via WSL2 is possible but less common)
- Docker and Docker Compose installed
- At least 8GB RAM (16GB+ recommended for smooth local inference)
- At least 20GB free disk space (for model weights and cache)
- A compatible open-weight LLM (e.g., Nous-Hermes-2-Mistral-7B-DPO, Mistral-7B-Instruct-v0.2)
- Basic command-line proficiency (running Docker commands, editing YAML/JSON config files)
- A local vector database (optional but recommended for RAG—e.g., ChromaDB, Qdrant)
Step-by-Step
- Download and prepare the Hermes-compatible model Use Hugging Face to download a model explicitly tagged for Hermes or tool-use—such as `NousResearch/Nous-Hermes-2-Mistral-7B-DPO`. Place the model files (e.g., in GGUF format for llama.cpp or PyTorch for vLLM) in a dedicated folder, such as `~/hermes/models/`. Ensure the model supports function calling if you plan to use tools.
- Set up a Docker environment for inference
Create a `docker-compose.yml` file. For example, to use vLLM (recommended for Hermes due to OpenAI-compatible API):
version: '3.8' services: vllm: image: vllm/vllm-openai:latest runtime: nvidia environment: - MODEL=/models volumes: - ./models:/models ports: - "8000:8000" command: --model NousResearch/Nous-Hermes-2-Mistral-7B-DPO --dtype auto --api-key hermes-keyAdjust the model name to match your downloaded file (e.g., if using GGUF, switch to llama.cpp instead). Run `docker-compose up -d` to start the server on port 8000. - Install and configure Hermes Agent Clone the official Hermes GitHub repo (e.g., `git clone https://github.com/teknium/Hermes-2-Agent.git`). Inside the repo, copy `.env.example` to `.env` and set your local model endpoint: `OPENAI_API_BASE=http://localhost:8000/v1`, `OPENAI_API_KEY=hermes-key`, and `MODEL_NAME= NousResearch/Nous-Hermes-2-Mistral-7B-DPO`. Ensure `OPENAI_API_BASE` points to your vLLM or llama.cpp server.
- Define tools and functions
Hermes can call real-world actions via function calling. Create a `tools/` directory with Python files like `web_search.py` or `file_ops.py`. Each tool must be a Python function with a Pydantic schema. Example snippet:
from pydantic import BaseModel, Field class FileReadInput(BaseModel): path: str = Field(description="Absolute path to the file") def read_file(path: str) -> str: try: with open(path, 'r') as f: return f.read() except Exception as e: return f"Error: {e}"Register this tool in `tools/init.py` so Hermes can invoke it. - Start the agent From the Hermes repo root, run `python main.py`. The agent will load tools, connect to your local LLM, and enter an interactive chat. Type your request (e.g., “Summarize the notes in ~/docs/meeting.txt and save the result as summary.md”). Hermes will reason, call `read_file`, process the content, and invoke `write_file` (if you’ve defined it).
- Enable RAG for document grounding (optional) Install ChromaDB (`pip install chromadb`) and initialize it in your config. In `config.yaml`, set `rag_enabled: true` and point to your document directory. Run `python ingest_docs.py` to embed and store documents. Now, when you ask about your local files, Hermes will retrieve relevant chunks before generating answers.
- Run as a background service (production) Use `systemd` to run vLLM and Hermes as services. Create `/etc/systemd/system/hermes-agent.service` with `ExecStart=/usr/bin/python3 /path/to/Hermes-2-Agent/main.py`. Enable and start it with `sudo systemctl enable hermes-agent && sudo systemctl start hermes-agent`. Verify logs with `journalctl -u hermes-agent -f`.
Common Mistakes
- Using a model not fine-tuned for tool use—this causes Hermes to ignore function calls. Stick to Hermes-specific variants (e.g., `Nous-Hermes-2-Mistral-7B-DPO`, not base Mistral).
- Skipping `--dtype auto` or `--precision fp16` in vLLM, leading to OOM crashes on 8GB RAM systems.
- Not setting the correct `OPENAI_API_BASE` path (e.g., missing `/v1`), causing connection timeouts.
- Defining tools with incorrect Pydantic schemas (missing required fields or wrong types), which Hermes rejects silently.
- Running Hermes without installing `python-dotenv`, so `.env` variables aren’t loaded.
Tips
- Use quantized models (GGUF Q4_K_M or Q5_K_M) for faster inference on CPU-only setups—less accurate but far more efficient.
- Start with simple tools (e.g., calculator, date/time) before building complex integrations (email, APIs).
- Enable `verbose=True` in `main.py` to see Hermes’s internal reasoning steps when debugging tool calls.
- For file operations, always use absolute paths and add error handling (e.g., file existence checks) to avoid accidental overwrites.
- Limit tool permissions—run Hermes in a Docker container with restricted filesystem access to prevent unintended writes.
Troubleshooting
If Hermes fails to start, check Docker logs (`docker logs hermes-vllm-1`) for GPU memory errors—reduce batch size or switch to GGUF quantization. If not, the model may not support tool use—try a different checkpoint. For HTTP 422 errors when defining tools, validate your Pydantic model with `python -c "from mytool import *; print(MyTool.schema())"` to catch schema issues. If RAG returns no results, ensure embeddings are generated with the same model (e.g., `all-MiniLM-L6-v2`) used by Hermes’s retriever. Always restart services after config changes: `docker-compose restart && systemctl restart hermes-agent`.
Frequently Asked Questions
Can Hermes work without internet access?
Yes—once the model and tools are local, Hermes runs completely offline. No external API calls are needed, making it ideal for air-gapped or secure environments.
Does Hermes support voice or multi-modal input?
Not natively—Hermes is text-only. You’d need to add a frontend (e.g., Whisper for ASR) or integrate with a GUI app that transcribes speech to text before sending to Hermes.
How much RAM does Hermes typically use?
With a 7B model quantized to Q4_K_M, expect ~4GB RAM at runtime. Full-precision models may use 10GB+; 16GB RAM is recommended for multitasking or RAG.
Can I run Hermes on a Raspberry Pi?
Not practically—most Hermes-compatible models exceed the Pi’s 4GB RAM and lack GPU acceleration. Even quantized 7B models run too slowly (minutes per token) for usability.
Is Hermes safe for sensitive data?
Self-hosted Hermes keeps data local, but safety depends on your tools. Never give it access to passwords or confidential files unless you’ve hardened your tool permissions and encrypted local storage.
How do I update Hermes or its tools?
Run `git pull` in the repo, then restart the service. Update tools by editing their Python files and reloading the agent (no restart needed if tools are imported dynamically, but restart ensures clean state).