dspy-hermes-runtime-auth
Skill1 starsChanged 6 months agoMITView on GitHub
Reuse Hermes Agent's active runtime provider and credentials inside DSPy programs, including Predict, ChainOfThought, and RLM, without duplicating API keys. Designed to be provider-aware and shareable across Hermes installations.
- Reads credentials
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agy-cliSkill
- ambitious-problem-solvingSkill
- dspy-rlm-hermes-runtime-authSkill
- hermes-deep-researchSkill
- high-efficiency-learning-designSkill
- local-web-extractSkill
- socratic-argument-tutorSkill
- taskerSkill
- teachSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use this skill when both are true:
- Distinctive: line 23
Prefer a simpler path when:
- Very specific: line 32
use the resulting LM in ordinary DSPy modules or dspy.RLM(..., sub_lm=lm)
- Distinctive: line 55
Do not run billable benchmark/eval loops without the user's approval.
- Very specific: line 56
Do not print tokens, .env, or auth-store contents.
- Very specific: line 63
Use the helper template in templates/hermes_dspy_runtime.py.
- Distinctive: line 149
use RLM for short/simple prompts where standard DSPy or ordinary retrieval is already enough
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DSPy + Hermes Runtime Auth
When to use
Use this skill when both are true:
- you want a DSPy program to reuse the same provider/base URL/API credential Hermes is already using
- you want that wiring to survive provider/model changes without rewriting the DSPy code path
Good fits:
dspy.Predict,ChainOfThought, or other DSPy modules that should follow Hermes runtime selectiondspy.RLMor other long-context workflows where the LM should inherit Hermes auth/config- notebooks, scripts, and repo code you want to share with other Hermes users who may run different providers
- cases where you may switch between
openrouter,anthropic,openai-codex, or a custom endpoint and still want one loader function
Prefer a simpler path when:
- you are writing a one-off script for a single fixed provider and do not care about Hermes runtime portability
- the code is intentionally tied to a vendor SDK rather than DSPy's abstraction layer
What this skill does
It provides a portable factory pattern:
- resolve Hermes runtime credentials with
hermes_cli.runtime_provider.resolve_runtime_provider() - map that runtime into a DSPy-compatible LM
- use the resulting LM in ordinary DSPy modules or
dspy.RLM(..., sub_lm=lm)
The design goal is portability across:
- provider
- model
- base URL
- auth mode
Verified shape
Verified locally as a small working example against one Hermes installation:
- DSPy
3.1.3 dspy.RLMavailabledenoinstalled- helper works for ordinary
dspy.Predict(...)and a tinydspy.RLM(...)run - the live verification environment happened to resolve to
openai-codex, which is why the template includes a narrow Codex compatibility branch
Interpret this as:
- generic design across Hermes providers via
resolve_runtime_provider() - concrete runtime verification on one live install
Important limits
- Do not run billable benchmark/eval loops without the user's approval.
- Do not print tokens,
.env, or auth-store contents. dspy.RLMneeds Deno/Pyodide available on the machine.- Some providers may need provider-specific adaptation even when runtime auth resolution succeeds.
- Today, the explicitly verified special-case branch is the Codex/Responses path; other providers follow the standard DSPy/OpenAI-compatible route.
Recommended path
Use the helper template in templates/hermes_dspy_runtime.py.
Steps
1. Resolve Hermes runtime
from hermes_cli.runtime_provider import resolve_runtime_provider
runtime = resolve_runtime_provider()This returns the active runtime choice Hermes would use, including:
providerapi_modebase_urlapi_keysource
2. Build a DSPy LM from that runtime
Routing defaults:
chat_completions→dspy.LM(..., model_type="chat")with OpenAI-compatible routinganthropic_messages→dspy.LM(..., model_type="chat")withanthropic/...model namingcodex_responses→ customBaseLMwrapper backed by Hermes's Codex auxiliary shim, because that endpoint needed special handling in live testing
This means the helper is generic by default and only becomes provider-specific where the runtime contract forced it.
3. Override provider or model when needed
# Use the currently active Hermes runtime
lm = load_hermes_dspy_lm()
# Force a different Hermes provider while still using Hermes auth/config
lm = load_hermes_dspy_lm(requested_provider="anthropic")
# Keep the provider but override the model
lm = load_hermes_dspy_lm(model="claude-sonnet-4-5-20250929")
# Override both
lm = load_hermes_dspy_lm(
requested_provider="openrouter",
model="google/gemini-3-flash-preview",
)4. Configure DSPy
import dspy
lm = load_hermes_dspy_lm()
dspy.configure(lm=lm)5. Use with RLM
import dspy
lm = load_hermes_dspy_lm()
dspy.configure(lm=lm)
rlm = dspy.RLM(
"context, query -> answer",
sub_lm=lm,
max_iterations=20,
)
result = rlm(
context=long_text,
query="Answer the question using programmatic exploration."
)
print(result.answer)Files
templates/hermes_dspy_runtime.py— provider-aware DSPy loaderreferences/provider-compatibility.md— what is generic vs what is provider-specific today
Anti-patterns
Do not:
- hardcode
OPENAI_API_KEYwhen Hermes is actually using another provider - assume a fixed provider/model combination instead of reading Hermes runtime state
- dump resolved runtime secrets to stdout/logs
- use RLM for short/simple prompts where standard DSPy or ordinary retrieval is already enough
- bypass
resolve_runtime_provider()unless you intentionally want a different provider than Hermes
Output expectation
This skill is for runtime wiring. Use it when the bottleneck is: “make DSPy follow Hermes runtime auth and provider routing cleanly, even as the runtime changes.”
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

