How to Connect Hermes Agent to Agentmemory: The Ultimate Setup Guide
Artificial Intelligence agents are only as good as their memory. Without a structured way to store, recall, and analyze past interactions, AI agents quickly lose context, making them less effective over time.
If you are running Hermes Agent and want to supercharge its capabilities with a persistent, searchable memory database and a beautiful visual dashboard, integrating it with Agentmemory is the way to go.
In this comprehensive guide, we will walk you through how to connect Hermes Agent to Agentmemory, migrate your historical session data, configure auto-start on Windows, and troubleshoot common connection issues.
Why Connect Hermes Agent to Agentmemory?
By default, Hermes Agent stores session logs and state information locally. While this works, it lacks advanced search, long-term semantic retrieval, and visual monitoring. Integrating Hermes Agent with Agentmemory gives you:
- Centralized Memory Management: A unified database that stores observations, facts, and session histories.
- Semantic Search & Retrieval: Retrieve relevant historical facts using vector embeddings (or BM25 search as a fallback) to feed context back to your agent.
- A Visual Dashboard: A web-based user interface (usually hosted at
http://localhost:3114) where you can inspect sessions, read observations, and view stored facts. - Advanced Memory Consolidation: Automatic background summarization and fact extraction so your agent doesn't get bogged down by raw chat transcripts.
Prerequisites
Before starting the setup, ensure you have the following installed on your system:
- Node.js (v18 or higher recommended)
- Hermes Agent installed and configured
- An active internet connection and API keys for your LLM/Embedding provider (e.g., Anthropic, OpenAI, Gemini, Voyage, or Cohere)
Step-by-Step Guide: Connecting Hermes Agent to Agentmemory
Step 1: Install and Initialize Agentmemory
To install Agentmemory globally on your system, open your terminal (PowerShell or Command Prompt on Windows) and run:
npm install -g @rohitg00/agentmemory
Once installed, check the status of your configuration by running the built-in diagnostic tool:
agentmemory doctor
This command checks if the server is reachable, verifies your config files, and tests your LLM and Embedding provider configurations.
Step 2: Configure Environment Variables
Agentmemory relies on API keys to perform embedding generation and memory summarization/compression. These settings are stored in your profile directory:
- Windows:
C:\Users\<Your-Username>\.agentmemory\.env - macOS/Linux:
~/.agentmemory/.env
Open the .env file and configure your API keys. Here is a standard configuration example:
# LLM Provider for summarization (Anthropic, Gemini, OpenRouter, etc.)
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Embedding Provider (OpenAI, Voyage, Cohere, Ollama, etc.)
OPENAI_API_KEY=your_openai_api_key_here
VOYAGE_API_KEY=your_voyage_api_key_here
# Optional: Auto-compression settings
AGENTMEMORY_AUTO_COMPRESS=true
[!NOTE]
If you don't supply an embedding provider key, Agentmemory will automatically fall back to BM25-only (keyword search) mode. While this works offline, vector embeddings provide much better semantic memory recall.
Step 3: Run the Agentmemory Daemon
To start the memory server, launch the daemon in verbose mode to monitor connections:
agentmemory --verbose
This starts two local services:
1. REST API Backend: Runs on port 3113 (e.g., http://localhost:3113).
2. Dashboard UI: Runs on port 3114 (e.g., http://localhost:3114/#dashboard).
Verify the connection by opening http://localhost:3114/#dashboard in your browser.
Step 4: Configure Hermes Agent to Use Agentmemory
To make Hermes Agent talk to the newly launched memory daemon, edit the configuration of your Hermes workspace.
In your Hermes agent configurations (usually found in iii-config.yaml or .env depending on your setup), configure the memory endpoint:
memory:
provider: agentmemory
endpoint: "http://localhost:3113"
Once configured, restart your Hermes Agent. New conversations and tasks will now automatically stream observations straight to the Agentmemory server.
How to Migrate Old Hermes Agent Sessions to Agentmemory
If you have been using Hermes Agent for a while, you probably have a lot of historical sessions and markdown facts (MEMORY.md and USER.md) that you don't want to lose. You can migrate them directly to Agentmemory.
The Problem: API Rate Limits During Import
If you attempt to import hundreds of past sessions and thousands of chat observations, Agentmemory's auto-compression feature will immediately try to summarize every single import using your LLM provider. This will quickly trigger API rate limits (such as the 100 requests/day limit on custom proxy APIs) and cost a significant amount of tokens.
The Solution: Offline Import Migration
To migrate safely without hitting rate limits:
- Disable Auto-Compression Temporarily:
Open~/.agentmemory/.envand change:env AGENTMEMORY_AUTO_COMPRESS=false - Restart the Agentmemory Daemon:
Restart the daemon to apply the configuration. - Run a Migration Script:
Write a script to read your old SQLitestate.dbor text files and post them tohttp://localhost:3113/agentmemory/observe. By disabling auto-compression, Agentmemory stores the observations instantly without making external LLM calls. - Re-enable Auto-Compression:
Once the migration is complete, changeAGENTMEMORY_AUTO_COMPRESSback totrueand restart the daemon so new sessions get summarized normally.
Automating Startup on Windows
To ensure Hermes Agent and Agentmemory are always ready when you boot your PC, you can create a simple startup script.
On Windows, place a shortcut or script in your Startup folder:
C:\Users\<Your-Username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
The Correct Startup Sequence
AI agent services rely on one another. Always ensure they boot in this exact sequence: 1. Hermes Gateway (Handles protocol communications) 2. Router / Proxy (e.g., 9router for routing requests) 3. Agentmemory Daemon (Persistent database server)
You can write a VBScript (Teknoding_AutoStart.vbs) to run these in the background without pop-up console windows:
Set WshShell = CreateObject("WScript.Shell")
' 1. Start Hermes Gateway
WshShell.Run "cmd /c hermes-gateway", 0, False
WScript.Sleep 2000
' 2. Start 9router
WshShell.Run "cmd /c 9router", 0, False
WScript.Sleep 2000
' 3. Start Agentmemory Daemon
WshShell.Run "cmd /c agentmemory --verbose", 0, False
Troubleshooting Common Issues
1. Dashboard (http://localhost:3114) Shows "0 Sessions" or Cannot Connect
- Cause: The backend server on port
3113is not running, or there is a port conflict. - Fix: Open your terminal and run
netstat -ano | findstr 3113to check if another process is blocking the port. Restart the server withagentmemory --verboseand look for startup errors.
2. "LLM Provider" or "Embedding Provider" Failed in agentmemory doctor
- Cause: Your API keys are either missing, expired, or incorrectly formatted in
~/.agentmemory/.env. - Fix: Double-check your API key names. Ensure there are no spaces or quotes around the keys. If you do not want to use paid embeddings, verify that Agentmemory is falling back to BM25 mode.
3. High Latency During Agent Conversations
- Cause: Agentmemory is attempting to generate embeddings and run summarizations synchronously on every turn.
- Fix: Ensure
AGENTMEMORY_AUTO_COMPRESSis configured properly, or switch to a faster embedding provider (like Voyage AI or local Ollama embeddings).
Frequently Asked Questions (FAQ)
What is the difference between port 3113 and port 3114?
Port 3113 is the REST API backend endpoint where Hermes Agent sends observations and queries memory. Port 3114 hosts the web-based visual dashboard where users can view sessions, timelines, and extracted facts.
Can I run Agentmemory completely offline?
Yes. If you do not provide an OpenAI, Voyage, or Cohere API key, Agentmemory runs in BM25 mode, which relies on local keyword searching instead of cloud-based vector embeddings. Note that some advanced consolidation features require an LLM.
Does Agentmemory support multiple agents at the same time?
Yes. Agentmemory organizes interactions into distinct sessions and workspace namespaces, allowing you to connect multiple Hermes agents or other custom agent frameworks to the same backend.
How do I manually back up my database?
All memory states, sessions, and facts are stored in a local SQLite file under ~/.agentmemory/data/state_store.db. You can copy this file to back up your entire agent memory history.
Post a Comment for "How to Connect Hermes Agent to Agentmemory: The Ultimate Setup Guide"