Hermes Agent
The Self-Improving AI Agent

Built by Nous Research, Hermes is the only agent with a built-in learning loop — it creates skills from experience, improves them during use, and builds a deepening model of who you are across sessions.

58,308 stars 🍴 7,721 forks 🐍 Python 📄 MIT license 🤖 200+ LLM models
View on GitHub Read Docs

How It Works

Hermes is structured in five layers: input platforms feed into a gateway process, which dispatches to the AIAgent core. The core manages context, memory, and skills before calling any LLM, and routes tool calls to the execution layer.

Input Platforms
CLI TUI Telegram Discord Slack WhatsApp Signal Email
message routing
Gateway Layer — gateway/
gateway process voice memo transcription cross-platform continuity
dispatch to agent
Agent Core — agent/
AIAgent orchestrator context_engine.py memory_manager.py skill_utils.py smart_model_routing.py prompt_caching.py trajectory.py
LLM call with cached prompt
LLM Provider Layer
Nous Portal OpenRouter (200+ models) OpenAI Anthropic Kimi / Moonshot MiniMax Custom endpoint
tool calls & results
Tool Execution Layer
Terminal (6 backends) Web Search File I/O Subagents Cron Scheduler MCP Servers APIs

What Makes Hermes Unique

Six capabilities that set Hermes apart from other AI agents.

🔄

Closed Learning Loop

Auto-creates skills after complex tasks. Skills self-improve during use. FTS5 session search with LLM summarization for cross-session recall. Periodic memory nudges keep knowledge fresh.

Skills System

Procedural memory as executable scripts. Compatible with the agentskills.io open standard. Browse with /skills. Scripts call tools via RPC — collapsing pipelines into single turns.

🧠

Persistent Memory

Stores facts in MEMORY.md across sessions. Builds a USER.md profile over time. Integrates with Honcho for dialectic user modeling. Searches past conversations by meaning.

📡

Multi-Platform Gateway

Single gateway process serves Telegram, Discord, Slack, WhatsApp, Signal, and Email simultaneously. Voice memo transcription included. Conversations continue seamlessly across platforms.

Scheduled Automations

Built-in cron scheduler. Write tasks in natural language — daily reports, nightly backups, weekly audits. Delivers results to any connected platform. Runs fully unattended.

🖥️

Runs Anywhere

Six terminal backends: local, Docker, SSH, Daytona, Singularity, and Modal. Daytona and Modal offer serverless persistence — the agent hibernates and wakes on demand. Works on a $5 VPS or GPU cluster.

Deep Dive: Key Modules

Explore the internals of each major component.

AIAgent Orchestrator

The main orchestrator lives in run_agent.py (~3,600 lines). Its helper modules are extracted into agent/. Each conversation turn runs this loop:

1
Receive Message Input arrives from CLI TUI, gateway platform, or scheduler trigger.
2
Build Context context_engine.py assembles conversation history, memory snippets, and context files. Compresses if near token limit.
3
Apply Prompt Caching prompt_caching.py marks cache breakpoints to reduce LLM costs on repeated system prompt prefixes.
4
Route to LLM smart_model_routing.py picks the right provider/model. anthropic_adapter.py normalises API differences.
5
Parse & Execute Tools Tool calls in the LLM response are dispatched: terminal commands, web search, file I/O, subagent spawning, RPC scripts.
6
Record Trajectory trajectory.py logs the full interaction for RL training data and session search.
7
Memory & Skill Nudge After complex tasks, the agent is nudged to persist new knowledge and optionally auto-create a reusable skill.

Context Engine — agent/context_engine.py

Manages the finite LLM context window so conversations can span arbitrarily long sessions.

  • Tracks token usage in real time using model_metadata.py model specs
  • Compresses old message pairs when approaching the context limit — preserving coherence
  • Uses context_compressor.py for LLM-assisted summarisation of older turns
  • Maintains context_references.py so external files are referenced, not inlined, saving tokens
  • Supports /compress and /usage commands for manual control
  • Integrates subdirectory_hints.py to inject project structure without burning context

Memory System — agent/memory_manager.py

Persistent memory that grows with usage, stored as plain text files the agent can read and write.

  • MEMORY.md — curated facts, decisions, and preferences the agent has learned
  • USER.md — a profile of the user's skills, goals, communication style, built up over sessions
  • memory_provider.py injects relevant snippets into every context build
  • Periodic nudges prompt the agent to add or update entries after conversations
  • FTS5 full-text search over all past sessions with LLM summarisation for recall queries
  • Honcho integration via agent/ adapters for dialectic user modeling
  • Insights command (insights.py) generates weekly usage and task summaries

Skills System — agent/skill_utils.py

Skills are procedural memories — executable scripts the agent creates, stores, and improves over time.

  • After completing a complex multi-step task, the agent can serialise the solution as a reusable skill
  • Skills live in ~/.hermes/skills/ as structured markdown/script files
  • During use, the agent can rewrite a skill to fix bugs or add edge case handling
  • Compatible with the agentskills.io open standard — importable across agents
  • Python scripts can call tools via RPC (copilot_acp_client.py) — collapsing pipelines
  • Browse installed skills with /skills; invoke with /skill-name
  • Skill commands managed in skill_commands.py

Messaging Gateway — gateway/

A single long-running process that bridges all messaging platforms to the AIAgent core.

  • Supported platforms: Telegram, Discord, Slack, WhatsApp, Signal, Email, Home Assistant
  • Start with hermes gateway start; configure with hermes gateway setup
  • Voice memos are transcribed automatically before dispatch to the agent
  • Conversation history is preserved across all platforms (cross-platform continuity)
  • DM pairing for security: only paired users can interact with the agent
  • Cron scheduler delivers scheduled task results to any connected platform
  • The gateway can run on a $5 VPS while the terminal backend runs on a GPU cluster

Research Features — environments/

Hermes includes infrastructure for AI research and training data generation.

  • Trajectory recording — every interaction is logged as a structured trajectory for RL training
  • Atropos RL environments — benchmark environments for evaluating and training tool-calling models
  • Batch generation — run the agent in batch mode to generate training data at scale
  • Trajectory compression — compress trajectories to train next-generation models more efficiently
  • Terminal test environments in environments/ simulate real-world task conditions
  • Nix packaging (flake.nix) for reproducible research environments
  • GitHub CI/CD workflows for automated trajectory validation

Ask About Hermes Agent

Ask any question about the hermes-agent codebase, architecture, or how to use it. Powered by AI.

Install & Run

One command installs everything on Linux, macOS, WSL2, and Android (Termux).

$ curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
  1. 1Run the installer command above
  2. 2Reload your shell: source ~/.bashrc
  3. 3Run hermes setup to choose a model and configure platforms
  4. 4Start chatting: hermes
  5. 5For messaging: hermes gateway setuphermes gateway start
Full Quickstart → GitHub Repo Discord Community