Skip to content

Build a Self-Improving AI Agent with Hermes Agent on a $5 VPS

Deploy a self-improving AI agent from Nous Research on a $5 VPS. Build persistent memory, skills, and Telegram integration using this step-by-step tutorial.

Daniel Evershaw(ML Engineer & Technical Writer)May 29, 20265 min read0 views

Last updated: May 29, 2026

Build a Self-Improving AI Agent with Hermes Agent on a $5 VPS
Quick Answer

Deploy Hermes Agent by Nous Research on a $5 VPS. Configure Telegram messaging, enable autonomous skill creation, and set up persistent memory for a self-improving AI agent that runs unattended.

This tutorial walks you through deploying Hermes Agent, the self-improving AI agent from Nous Research, on a $5 VPS. You will build an agent that creates skills from experience, remembers past conversations, and communicates via Telegram. By the end, you will have a persistent, learning agent that runs unattended and costs nearly nothing when idle.

Prerequisites

  • A Linux VPS (e.g., DigitalOcean, Linode) with at least 1GB RAM and 10GB storage
  • Basic familiarity with the Linux command line
  • A Telegram account and bot token (from BotFather)
  • An API key from an LLM provider (e.g., OpenRouter, OpenAI, or Nous Portal)
  • curl and bash installed on your VPS

Architecture Overview

Hermes Agent uses a modular architecture where a central gateway routes messages to and from multiple platforms. The agent loop processes each message through a stack: tool execution, skill creation, memory updates, and response generation. Skills are stored locally and self-improve after use. Memory uses FTS5 for fast search and LLM summarization for cross-session recall.

The diagram shows how messages from different platforms enter the gateway and flow through the agent loop. The agent can spawn subagents for parallel work, schedule cron jobs, and persist its state across sessions.

Step-by-Step Deployment

Step 1: Provision Your VPS and Install Dependencies

SSH into your VPS and update the system. Then run the Hermes install script. This script handles uv, Python 3.11, Node.js, ripgrep, and ffmpeg.

ssh user@your-vps-ip
sudo apt update && sudo apt upgrade -y
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

After the script completes, reload your shell and verify the installation.

source ~/.bashrc
hermes doctor

Observe that hermes doctor runs a diagnostic and reports any missing dependencies. If everything is green, proceed.

Step 2: Configure the LLM Provider and Model

Hermes works with any provider. For this tutorial, configure OpenRouter to access 200+ models. Run the setup wizard or set the provider manually.

hermes config set provider openrouter
hermes config set openrouter_api_key "your-openrouter-api-key"
hermes model openrouter:mistralai/mixtral-8x7b-instruct

This sets OpenRouter as the provider and selects a capable model. You can switch models anytime with /model in a conversation.

Step 3: Set Up the Telegram Gateway

Create a Telegram bot via BotFather and get your bot token. Then configure the gateway.

hermes config set telegram_bot_token "your-bot-token"
hermes gateway start

The gateway starts a background process that listens for Telegram messages. Test it by sending /start to your bot. The agent should respond.

Step 4: Enable Skills and Memory

Hermes creates skills autonomously after complex tasks. Enable skill creation and memory persistence with these settings.

hermes config set skill_autocreation true
hermes config set memory_persistence true
hermes config set memory_nudge_interval 3600

The memory_nudge_interval sets how often (in seconds) the agent nudges itself to persist important information. Skills are stored in ~/.hermes/skills/ and improve with use.

Step 5: Schedule a Cron Job

Set up a daily report using the built-in cron scheduler. The agent will generate a summary and send it to your Telegram.

hermes config set cron_jobs '[{"schedule": "0 8 * * *", "task": "Summarize yesterday\'s conversations and highlight key insights", "platform": "telegram"}]'

This runs the task every day at 8 AM. The agent uses its LLM to generate the summary and delivers it via Telegram.

Custom Skill Creation Example

Skills are procedural memory. You can write your own skills in YAML and place them in ~/.hermes/skills/. Here is a skill that fetches weather data.

# ~/.hermes/skills/weather-skill.yaml
name: get_weather
description: Fetches current weather for a given city.
steps:
  - tool: web_search
    query: "weather in {{city}} today"
  - tool: extract_content
    url: "{{result.url}}"
  - tool: summarize
    input: "{{extracted_text}}"
output: "{{summary}}"

After saving this file, restart the gateway. The agent can now use /get_weather London to fetch and summarize weather data. Skills auto-improve after each use based on the outcome.

Memory and User Modeling

Hermes builds a model of you over time using Honcho dialectic user modeling. Each conversation updates the user profile. The agent searches past conversations with FTS5 and LLM summarization. This enables cross-session recall without explicit context injection.

# Example: Querying memory programmatically (if you extend the agent)
from hermes.memory import MemoryStore
 
store = MemoryStore()
results = store.search("user's preferred programming language")
for r in results:
    print(f"Session: {r.session_id}, Summary: {r.summary}")

This code snippet shows how you could access the memory store in a custom script. The search returns relevant sessions and their summaries.

Common Pitfalls

  • API Key Errors: Double-check that your OpenRouter or other provider key is set correctly. Use hermes config get openrouter_api_key to verify.
  • Telegram Bot Not Responding: Ensure the gateway is running (hermes gateway status). Check that the bot token is correct and that you sent a message to the bot first.
  • Skill Not Being Used: Skills must be enabled. Set skill_autocreation to true and ensure the skill file is in the correct directory with proper YAML syntax.
  • Memory Not Persisting: Verify that memory_persistence is true. Check disk space and permissions on ~/.hermes/.
  • Cron Jobs Not Firing: Confirm the cron schedule syntax. Use hermes config get cron_jobs to see the current jobs.

Next Steps

Now that you have a self-improving agent running on a $5 VPS, explore the full documentation at hermes-agent.nousresearch.com. Learn to connect Discord and Slack, write advanced skills using the agentskills.io open standard, or deploy on serverless infrastructure with Modal or Daytona for near-zero idle costs. For production use, consider adding MCP servers to extend the agent’s capabilities with custom tools.

Frequently Asked Questions

How do I switch models after deployment?

Use the /model command in any conversation, for example /model openrouter:gpt-4. Or set it permanently with hermes config set model 'openrouter:gpt-4'. No code changes are needed.

Can I run Hermes on a GPU cluster?

Yes. Hermes supports multiple terminal backends including Docker, SSH, Singularity, Modal, and Daytona. For GPU-intensive tasks, use the Modal or Daytona backend which provides on-demand GPU resources.

How does the agent remember past conversations?

Hermes uses FTS5 full-text search combined with LLM summarization for cross-session recall. It also builds a user model using Honcho dialectic modeling. Memory is stored in ~/.hermes/memory/ and is searchable.

What happens if my VPS restarts?

The agent's state is stored on disk in ~/.hermes/. After a restart, run hermes gateway start again. For automatic restart, set up a systemd service or use a process manager like supervisor.

Comments

Leave a comment. Your email won't be published.

Supports basic formatting: **bold**, *italic*, `code`, [links](url)

Related Articles