hermes - 💡(How to fix) Fix feat(config): introduce reusable model definitions to eliminate repetition across delegation/model/auxiliary [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15593Fetched 2026-04-26 05:26:23
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×2closed ×1

Error Message

Current (verbose and error-prone)

Code Example

# Current (verbose and error-prone)
model:
  provider: openrouter
  model: anthropic/claude-sonnet-4
  api_key_env: OPENROUTER_API_KEY
  base_url: https://openrouter.ai/api/v1
  temperature: 0.5
  max_tokens: 8192

delegation:
  provider: openrouter        # repeated
  model: anthropic/claude-sonnet-4  # repeated
  api_key_env: OPENROUTER_API_KEY   # repeated
  base_url: https://openrouter.ai/api/v1  # repeated
  temperature: 0.5            # repeated
  max_tokens: 8192            # repeated

auxiliary:
  compression:
    provider: openrouter      # repeated
    model: anthropic/claude-sonnet-4  # repeated
    # ... same fields again
  vision:
    provider: openrouter      # repeated
    model: anthropic/claude-sonnet-4  # repeated
    # ... same fields again

---

# Proposed
models:
  claude-sonnet:
    provider: openrouter
    model_id: anthropic/claude-sonnet-4
    api_key_env: OPENROUTER_API_KEY
    base_url: https://openrouter.ai/api/v1
    temperature: 0.5
    max_tokens: 8192
  gpt-4o-mini:
    provider: openai
    model_id: gpt-4o-mini
    api_key_env: OPENAI_API_KEY

model: claude-sonnet          # scalar reference

delegation:
  model: gpt-4o-mini          # reference
  max_depth: 2
  max_spawn: 3

auxiliary:
  compression: claude-sonnet  # reference
  vision: claude-sonnet       # reference

fallback_model: gpt-4o-mini   # reference
RAW_BUFFERClick to expand / collapse

Problem

Currently, model configuration in config.yaml is scattered and repetitive. Every location that needs a model must repeat the full set of provider fields (provider, model, api_key_env, base_url, temperature, etc.) rather than referencing a single definition.

For example, a user who wants to use the same model for chat, delegation, compression, and vision must repeat the configuration four times:

# Current (verbose and error-prone)
model:
  provider: openrouter
  model: anthropic/claude-sonnet-4
  api_key_env: OPENROUTER_API_KEY
  base_url: https://openrouter.ai/api/v1
  temperature: 0.5
  max_tokens: 8192

delegation:
  provider: openrouter        # repeated
  model: anthropic/claude-sonnet-4  # repeated
  api_key_env: OPENROUTER_API_KEY   # repeated
  base_url: https://openrouter.ai/api/v1  # repeated
  temperature: 0.5            # repeated
  max_tokens: 8192            # repeated

auxiliary:
  compression:
    provider: openrouter      # repeated
    model: anthropic/claude-sonnet-4  # repeated
    # ... same fields again
  vision:
    provider: openrouter      # repeated
    model: anthropic/claude-sonnet-4  # repeated
    # ... same fields again

This violates DRY and makes rotation/updating painful. If the base_url or api_key_env changes, the user must edit N locations.

Proposed Solution

Introduce a top-level models (or model_profiles) section where users define model objects once, and then reference them by name everywhere else:

# Proposed
models:
  claude-sonnet:
    provider: openrouter
    model_id: anthropic/claude-sonnet-4
    api_key_env: OPENROUTER_API_KEY
    base_url: https://openrouter.ai/api/v1
    temperature: 0.5
    max_tokens: 8192
  gpt-4o-mini:
    provider: openai
    model_id: gpt-4o-mini
    api_key_env: OPENAI_API_KEY

model: claude-sonnet          # scalar reference

delegation:
  model: gpt-4o-mini          # reference
  max_depth: 2
  max_spawn: 3

auxiliary:
  compression: claude-sonnet  # reference
  vision: claude-sonnet       # reference

fallback_model: gpt-4o-mini   # reference

Reference resolution rules:

  1. If the value is a string, look it up in models by name.
  2. If the value is a dict, treat it as an inline definition (backward-compatible).
  3. models entries themselves are not active until referenced.

Scope / Affected Config Paths

Config pathCurrentWith proposal
modelinline dictstring ref or inline dict
delegation.modelinline dictstring ref or inline dict
auxiliary.compressioninline dictstring ref or inline dict
auxiliary.visioninline dictstring ref or inline dict
auxiliary.session_searchinline dictstring ref or inline dict
fallback_modelinline dictstring ref or inline dict
cronjob[*].modelinline dictstring ref or inline dict

Backward Compatibility

  • Fully backward-compatible: existing inline dicts continue to work.
  • Opt-in: only users who define models: and use string references benefit.
  • Migration path: a future CLI command could inline existing configs into models and replace usages with references.

Relation to Existing Issues/PRs

  • #9459 (agent_profiles) \u2014 focuses on agent personas (toolsets, prompts), not model deduplication. Complementary.
  • #11657 (JSON config system) \u2014 introduces a new config format, but still repeats provider/model blocks per feature. This proposal could be applied to either YAML or JSON.
  • #5012 / #7586 (per-call provider/model override) \u2014 runtime flexibility; this proposal is static config DRY.

Non-Goals

  • This is not about runtime model switching (use /model or delegate_task overrides for that).
  • This is not about adding new providers or changing the inference layer.
  • This is not about replacing the existing custom_providers section (which defines provider endpoints, not model configurations).

extent analysis

TL;DR

Introduce a models section in the config.yaml file to define model objects once and reference them by name elsewhere to reduce repetition and improve maintainability.

Guidance

  • Define a models section at the top level of the config.yaml file to store model configurations.
  • Create model objects within the models section with unique names, such as claude-sonnet or gpt-4o-mini.
  • Reference these model objects by name in other parts of the configuration file, such as model, delegation, auxiliary, and fallback_model.
  • Ensure that the reference resolution rules are followed, where a string value is looked up in the models section and a dictionary value is treated as an inline definition.

Example

models:
  claude-sonnet:
    provider: openrouter
    model_id: anthropic/claude-sonnet-4
    api_key_env: OPENROUTER_API_KEY
    base_url: https://openrouter.ai/api/v1
    temperature: 0.5
    max_tokens: 8192

model: claude-sonnet
delegation:
  model: gpt-4o-mini

Notes

This proposal is fully backward-compatible, allowing existing inline dictionaries to continue working. Users can opt-in to use the new models section and reference model objects by name. A future CLI command could be implemented to migrate existing configurations to use the new format.

Recommendation

Apply the proposed solution by introducing a models section in the config.yaml file and referencing model objects by name elsewhere, as it improves maintainability and reduces repetition without breaking backward compatibility.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING