惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
罗磊的独立博客
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
A
About on SuperTechFans
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
IT之家
IT之家
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
月光博客
月光博客
T
Tailwind CSS Blog
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How to Build a Persistent AI Agent with Hermes in 15 Minutes
pulkitgovran · 2026-05-24 · via DEV Community
Cover image for How to Build a Persistent AI Agent with Hermes in 15 Minutes

pulkitgovrani

Hermes Agent Challenge Submission: Write About Hermes Agent

This is a submission for the Hermes Agent Challenge: Write About Hermes Agent

Most AI integrations are stateless. Every request starts cold.
Hermes Agent is different — it remembers.

This guide walks you through spinning up Hermes locally and building a minimal agent that accumulates memory across sessions. No vector database. No RAG pipeline. Just a session ID.


Prerequisites

  • Docker or Python 3.11+
  • Basic familiarity with REST APIs
  • 15 minutes

Step 1: Run Hermes Locally

# via Docker
docker pull nousresearch/hermes-agent
docker run -p 11434:11434 nousresearch/hermes-agent

Enter fullscreen mode Exit fullscreen mode

Verify it's alive:

curl http://localhost:11434/health
# {"status":"ok"}

Enter fullscreen mode Exit fullscreen mode


Step 2: Your First Stateful Chat

Hermes exposes an OpenAI-compatible /v1/chat/completions endpoint. The magic is one header: X-Hermes-Session-Id.

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:11434/v1",
    api_key="hermes",
)

SESSION_ID = "my-first-agent"

def chat(message: str) -> str:
    response = client.chat.completions.create(
        model="hermes",
        messages=[{"role": "user", "content": message}],
        extra_headers={"X-Hermes-Session-Id": SESSION_ID},
    )
    return response.choices[0].message.content

Enter fullscreen mode Exit fullscreen mode

Now send two messages in separate calls — no shared history in the request body:

print(chat("My name is Alex and I'm building a todo app in Go."))
# "Nice to meet you, Alex! ..."

print(chat("What language am I using?"))
# "You're using Go, as you mentioned earlier."

Enter fullscreen mode Exit fullscreen mode

The second call has no conversation history in the request body. Hermes remembered anyway — because the session ID matched.


Step 3: Feed Events Over Time

Hermes memory compounds. The more you feed it, the richer its understanding becomes. Feed events as structured facts:

events = [
    "Decision: Switched auth from JWT to session cookies. Reason: race condition in token refresh under concurrent requests caused 2% of users to be logged out.",
    "Decision: Removed Redis cache layer. Reason: cache invalidation bugs caused stale data in production. Replaced with direct DB reads.",
    "Decision: Added rate limiting to /api/search. Reason: one customer was generating 40% of total API load.",
]

for event in events:
    chat(event)

# Now ask about the accumulated history
print(chat("What are the biggest reliability concerns in this codebase?"))
# Hermes synthesizes across all three events

Enter fullscreen mode Exit fullscreen mode


Step 4: Register a Cron Job

Hermes has a built-in scheduler. Register a recurring autonomous task:

import httpx

httpx.post(
    "http://localhost:11434/api/jobs",
    headers={"Authorization": "Bearer hermes"},
    json={
        "name": "daily-standup",
        "schedule": "0 9 * * 1-5",
        "prompt": (
            "You are the project memory agent. Using what you remember "
            "from recent activity, generate a concise standup summary: "
            "what changed, why, and what to watch."
        ),
    },
)

Enter fullscreen mode Exit fullscreen mode

That's it. Hermes now runs this prompt every weekday at 9am, drawing from whatever it has accumulated in memory — no external database, no retrieval pipeline.


What Just Happened

Concept How Hermes Handles It
Memory Persistent per session ID — no client-side history needed
Scheduling Native /api/jobs endpoint with cron syntax
API surface OpenAI-compatible — drop-in for existing code
Cost Memory stays bounded — not a growing transcript

Session ID Design Patterns

Session IDs are namespaces. Make them intentional:

# Per-user memory
session_id = f"user:{user_id}"

# Per-repository institutional memory
session_id = f"repo:{owner}/{repo_name}"

# Per-customer support history
session_id = f"support:{customer_id}"

Enter fullscreen mode Exit fullscreen mode

Sessions never bleed into each other. repo:facebook/react and repo:your-team/backend are completely isolated brains.


What to Build Next

  • Give each user their own session ID → per-user personalization without a user profile database
  • Feed GitHub commits into a session over time → a codebase that explains its own history
  • Schedule daily analysis jobs → autonomous agents that surface insights without being asked

The pattern scales to anything that benefits from an AI that remembers what it's seen before — which turns out to be almost everything worth building.