⑦ OpenClaw & Hermes

Course path (9 chapters)
  1. LLM
  2. RAG
  3. Agent Core
  4. Retrieval Engineering
  5. LangChain & LangGraph
  6. MCP & A2A
  7. OpenClaw & Hermes
  8. Multi-agent & KG
  9. Multimodal
Chapter 7

OpenClaw & Hermes

Self-hosted personal agent — open alternative to Claude Desktop stack

Prev: MCP & A2A. Next: Multi-agent & KG.

Context

Closed stack vs open stack

LayerClosed (Anthropic)Open (self-host)
ModelClaude APIHermes via Ollama/vLLM
RuntimeClaude Desktop / API appOpenClaw agent OS
ToolsMCP serversSkills + MCP compatible
SkillsClaude SkillsClawHub marketplace
ChannelsWeb, APITelegram, Discord, CLI, Web
Hermes

Hermes (Nous Hermes) — the model

Open-weight models fine-tuned for function calling and agentic chat. Solves: base Llama/Mistral often emit invalid tool JSON.

Model lineup (check Nous Research for latest)

ModelBaseUse
Hermes 3Llama 3.1General agent + tools
Hermes 2Mistral / YiLighter self-host

Run locally

# Ollama
ollama pull hermes3
ollama run hermes3

# OpenAI-compatible endpoint for OpenClaw / LangChain
# OPENAI_BASE_URL=http://localhost:11434/v1
# OPENAI_API_KEY=ollama

from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
r = client.chat.completions.create(
    model="hermes3",
    messages=[{"role":"user","content":"What's 2+2?"}],
    tools=[{"type":"function","function":{"name":"calc","parameters":{"type":"object","properties":{"x":{"type":"number"}}}}}],
)
print(r.choices[0].message)

Hermes vs base model (what to demo in class)

Same 5 tool-calling prompts on Llama-3.1-base vs Hermes-3 — count valid JSON tool_calls. Hermes should win on schema adherence.

OpenClaw

OpenClaw — the agent operating system

Always-on assistant runtime. Not a library you import — a daemon that connects channels to model + skills.

Core components

PartFunction
GatewayReceives messages from Telegram/Discord/etc.
HeartbeatScheduled wake (cron-like): daily briefings, reminders
Agent loopHermes (or other model) plans → tools → reply
Skill loaderInstalls ClawHub packages (prompt + tools + config)
MemorySession + optional vector memory

Typical config flow

  1. Install OpenClaw (follow project docs for your OS).
  2. Set model endpoint to Ollama Hermes or cloud fallback.
  3. openclaw skills install <skill-name> from ClawHub.
  4. Connect Telegram bot token in config.
  5. Send message — gateway → agent loop → skill tools → reply on Telegram.

Example config (illustrative YAML)

# ~/.openclaw/config.yaml — field names vary by version; check docs
model:
  provider: openai_compatible
  base_url: http://127.0.0.1:11434/v1
  api_key: ollama
  name: hermes3

channels:
  telegram:
    enabled: true
    bot_token: "${TELEGRAM_BOT_TOKEN}"

skills:
  - name: calendar-assistant
    source: clawhub
  - name: web-search
    source: clawhub

heartbeat:
  - cron: "0 8 * * *"
    prompt: "Summarize today's calendar and unread priority emails"

Install sequence (class demo)

# Terminal 1 — model
ollama pull hermes3
ollama serve

# Terminal 2 — OpenClaw (example; use official install command)
# curl -fsSL https://openclaw.ai/install.sh | bash
openclaw init
openclaw skills search calendar
openclaw skills install calendar-assistant
openclaw channel add telegram
openclaw start
Skills

What is a Skill?

A Skill is a packaged capability — not just a prompt, not just a tool.

# Conceptual skill package structure
my-skill/
  skill.yaml          # name, description, triggers
  system_prompt.md    # behavior instructions
  tools/              # optional scripts the agent can run
    fetch_calendar.py
  config.schema.json  # user-configurable options

Same idea as Claude Skills: user installs "Calendar Assistant" — agent knows when and how to use it.

ClawHub

Community skill marketplace for OpenClaw. Browse, install, publish — like npm for agent behaviors.

Together

How Hermes + OpenClaw work together

  1. User messages on Telegram: "Summarize my calendar and email the team"
  2. OpenClaw gateway receives message
  3. Hermes model decides: need calendar skill + email skill
  4. Skills execute tools (calendar API, SMTP or API)
  5. Hermes composes summary reply → sent to Telegram
  6. Heartbeat can trigger same flow at 8am daily without user prompt

OpenClaw vs LangGraph (your product decision)

LangGraphOpenClaw
Build forSaaS product backendPersonal / team assistant
Customize viaPython graph codeSkills + YAML config
ChannelsYou implement APIBuilt-in messengers
ModelAny via LangChainOptimized for local Hermes
Lab

Lab: OpenClaw + Hermes

  1. Install Ollama + pull Hermes model.
  2. Test 5 tool-calling prompts in Python (OpenAI-compatible API).
  3. Install OpenClaw; point to local Hermes endpoint.
  4. Install one ClawHub skill; trigger via CLI or messenger.
  5. Compare: same task on base Llama vs Hermes — tool JSON validity rate.