Skip to main content

langstage-hermes — closed-loop reflection & skill creation on LangGraph + deepagents

langstage-hermes

PyPI Python License

A faithful reproduction of Nous Research's Hermes Agent on top of LangGraph + deepagents + langstage-core.

Status: live on PyPI (renamed from deepagent-hermes — the old name now just installs this one, and the deepagent-hermes command still works). Spec at SPEC.md. Release notes in CHANGELOG.md. The runtime is verified end-to-end against a real Anthropic model — both the memory loop and the skill-creation loop close autonomously; see examples/dogfood.py and examples/dogfood_procedural.py for the traces.

What it is

A deepagents-built agent with a closed reflection→skill-creation loop:

  • After ~10 tool-using iterations, a review subagent runs in the background, writes/patches a SKILL.md capturing the pattern it just exercised, and ships it to a skill library.
  • Next session, the agent reads the library at startup, sees the new skill's description in its system prompt, and can skill_view(name) to load the full body on demand (progressive disclosure per the agentskills.io spec).
  • A weekly curator consolidates skills into umbrellas and archives stale ones.
  • A frozen-snapshot memory (MEMORY.md + USER.md) preserves prefix-cache hits for the entire session.
  • FTS5 session search indexes every past conversation in a local SQLite DB.
  • Bundled MarkdownProvider that keyword-searches <HERMES_HOME>/memories/notes/*.md — drop hand-authored long-form context there and the agent surfaces relevant sections on demand. Zero external dependencies.

Designed to be loaded into the LangStage host family without UI changes — set LANGSTAGE_AGENT_SPEC=langstage_hermes.agent:graph in any of them.

Every stage for your LangGraph agent

langstage-hermes is the reference agent of the LangStage family: write your agent once — any LangGraph CompiledGraph — and run it on every stage with the same spec string (module:attr or path/to/file.py:attr), the same langstage.toml config file, and the same LANGSTAGE_* environment variables.

Stage Package Try it
Web app langstage langstage run --agent langstage_hermes.agent:graph
JupyterLab langstage-jupyter pip install langstage-jupyter, then the chat sidebar in jupyter lab
Terminal langstage-cli langstage-cli -a langstage_hermes.agent:graph
VS Code langstage-vscode chat participant + stdio sidecar
Reference agent langstage-hermes you are here
Shared core langstage-core typed events + config resolver behind every stage

Serve over AG-UI

This surface's agent — any LangGraph CompiledGraph — can also be served over the AG-UI protocol as a standalone HTTP endpoint. Install the extra and point the bundled console script at your agent spec:

pip install "langstage-core[agui]"
langstage-agui --agent langstage_hermes.agent:graph

📖 Full documentation: https://dkedar7.github.io/langstage-docs/

Installation

pip install langstage-hermes

Or with uv (recommended):

uv venv .venv
. .venv/Scripts/activate      # Windows
. .venv/bin/activate          # macOS / Linux
uv pip install langstage-hermes

Optional extras

pip install "langstage-hermes[openai]"     # OpenAI / OpenRouter / any OpenAI-wire provider
pip install "langstage-hermes[daytona]"    # Daytona sandbox terminal backend
pip install "langstage-hermes[modal]"      # Modal sandbox terminal backend
pip install "langstage-hermes[ssh]"        # paramiko-backed SSH terminal backend
pip install "langstage-hermes[dev]"        # tests + lint (contributors only)

Picking a model

By default the agent uses anthropic:claude-sonnet-4-6 and needs ANTHROPIC_API_KEY set. Swap the model via --model on the CLI or model.default in langstage-hermes.toml — any init_chat_model string works.

OpenAI / OpenRouter

pip install "langstage-hermes[openai]"
export OPENAI_API_KEY=sk-…                   # or: OPENROUTER_API_KEY=sk-or-v1-…
export OPENAI_BASE_URL=https://openrouter.ai/api/v1   # only for OpenRouter
langstage-hermes chat --model openai:openai/gpt-4o-mini

For OpenRouter specifically you usually also want:

export LANGSTAGE_HERMES_MODEL_DEFAULT="openai:openai/gpt-4o-mini"
export LANGSTAGE_HERMES_MODEL_AUX="openai:openai/gpt-4o-mini"

so the reflection subagent uses the same cheap model.

Verify your setup

langstage-hermes verify

does one live round-trip against the configured model and confirms the prompts, bundled skills, and FTS5 store all wire up correctly. Run this first on any fresh install — if it passes, chat will work.

Quick start

# show resolved config + sources
langstage-hermes --show-config

# interactive chat
langstage-hermes chat

# chat against a different agent (same spec format as every LangStage
# stage; overrides LANGSTAGE_AGENT_SPEC)
langstage-hermes chat -a my_agent.py:graph

# from inside chat:
#   /skills            list available skills
#   /model anthropic:claude-haiku-4-5-20251001    switch models
#   /memory            dump current memory snapshot
#   /compress          force context compression
#   /quit

Load into an existing host

Any LangStage host can run this agent:

# langstage-cli
LANGSTAGE_AGENT_SPEC="langstage_hermes.agent:graph" langstage-cli

# langstage-jupyter — set the same in langstage.toml under [agent]
printf '[agent]\nspec = "langstage_hermes.agent:graph"\n' >> langstage.toml
langstage-jupyter

Configuration

langstage-hermes.toml (project) or $HERMES_HOME/config.toml (global — default ~/.langstage-hermes/config.toml, and it moves with a custom HERMES_HOME). Layered resolution: defaults < TOML < LANGSTAGE_HERMES_* env < CLI overrides. See SPEC §2 for every field; langstage-hermes --show-config prints the resolved value + source of each.

Architecture

See SPEC.md for the full 21-section requirements doc. Top-level layout:

  • src/langstage_hermes/agent.py — the compiled graph (entry point for hosts)
  • src/langstage_hermes/config.pyHermesConfig(HostConfig) resolver
  • src/langstage_hermes/state.pyHermesState (extends AgentState)
  • src/langstage_hermes/reflection.py — closed-loop middleware + review subagent
  • src/langstage_hermes/skills/ — SkillLibrary, loader, tools
  • src/langstage_hermes/memory/ — frozen-snapshot memory + provider ABC
  • src/langstage_hermes/store/sqlite_fts.pyBaseStore with FTS5
  • src/langstage_hermes/search/session_search.pysession_search tool
  • src/langstage_hermes/compression.pyHermesCompressionMiddleware
  • src/langstage_hermes/caching.pyAnthropicCachingS3Middleware
  • src/langstage_hermes/budget.pyIterationBudgetMiddleware
  • src/langstage_hermes/tools/ — registry + 33 toolsets + 6 terminal envs
  • src/langstage_hermes/cron/ — daemon + cronjob tool
  • src/langstage_hermes/plugins/ — discovery + lifecycle hooks
  • src/langstage_hermes/cli.pylangstage-hermes entry point
  • prompts/ — verbatim/paraphrased system-prompt building blocks

Status by subsystem

Subsystem Status
Config + state + agent factory ✅ working
Reflection loop (10-iter / 10-turn triggers, subagent review) ✅ working — verified live
Skill library + agentskills.io validator ✅ working
Skill loader (system-prompt injection + progressive disclosure) ✅ working
skill_view / skill_manage / skills_list tools ✅ working
Frozen-snapshot memory (MEMORY.md / USER.md) ✅ working — verified live (702 bytes written autonomously)
SQLite FTS5 store + session_search (3 modes) ✅ working
MarkdownProvider (bundled, opt-in via memory.provider="markdown"; the default is no-op) ✅ keyword search over <HERMES_HOME>/memories/notes/*.md — zero deps
Iteration budget middleware ✅ working
Compression middleware (13-section template) ✅ working
Anthropic system_and_3 caching strategy ✅ working
Tool registry + 33-toolset enum ✅ working
LocalEnvironment terminal backend ✅ working (Git Bash on Windows)
DockerEnvironment ✅ working (gated on docker info reachability)
SshEnvironment ✅ working (paramiko-backed, behind [ssh] extra)
SingularityEnvironment ✅ working (auto-detects singularity / apptainer)
DaytonaEnvironment / ModalEnvironment ✅ lazy SDK with defensive attribute probing (extras-gated)
Cron daemon + cronjob tool ✅ working (deliverers: local, stdout, agentmail)
Plugin loader (4 discovery sources) ✅ working (13 of 17 lifecycle hooks wired)
CLI + v1-essentials slash commands ✅ working
Curator (skill lifecycle) ✅ basic
Bundled skills ✅ 26 from nousresearch/hermes-agent (MIT, attributed)
Self-evolution integration 📄 docs only (separate offline repo)

License

MIT. See LICENSE. This project is a faithful reproduction of the design ideas in Nous Research's Hermes Agent — see NOTICE for attribution.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langstage_hermes-0.4.14.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langstage_hermes-0.4.14-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file langstage_hermes-0.4.14.tar.gz.

File metadata

  • Download URL: langstage_hermes-0.4.14.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for langstage_hermes-0.4.14.tar.gz
Algorithm Hash digest
SHA256 32ab6658063177d09f0c74c4520270c262c69baa6d6392b646cc1c7910f81cc7
MD5 c8b33ebbf02f4c4adfd9e4550d765df1
BLAKE2b-256 d463170fce09496093b16887dfcf51ef8a0ee978c94135db5697c4ae513a5d3a

See more details on using hashes here.

File details

Details for the file langstage_hermes-0.4.14-py3-none-any.whl.

File metadata

  • Download URL: langstage_hermes-0.4.14-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for langstage_hermes-0.4.14-py3-none-any.whl
Algorithm Hash digest
SHA256 08cfaca9aa2d23a0e6a5da96ad8e8b368583326b961c3a2b484537c23dd6f1f5
MD5 2f8bbf771961c0356ab6e88daa9c1567
BLAKE2b-256 3ff395b5e8430f3f1314995374a2cda10ef9e651b6ff5afec7b741fc8ed9e785

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.29

2 files

0.4.28

2 files

0.4.27

2 files

0.4.26

2 files

0.4.25

2 files

0.4.24

2 files

0.4.23

2 files

0.4.22

2 files

0.4.21

2 files

0.4.19

2 files

0.4.18

2 files

0.4.17

2 files

0.4.16

2 files

0.4.15

2 files

This release

0.4.14 This release

2 files

0.4.12

2 files

0.4.11

2 files

0.4.10

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page