hermes - 💡(How to fix) Fix ModuleNotFoundError: agent.smart_model_routing missing from latest release [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#14060Fetched 2026-04-23 07:47:04
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×2closed ×1

Error Message

ModuleNotFoundError: No module named 'agent.smart_model_routing'

Code Example

ModuleNotFoundError: No module named 'agent.smart_model_routing'

---

File "/opt/hermes/gateway/run.py", line 954, in _resolve_turn_agent_config
    from agent.smart_model_routing import resolve_turn_route
ModuleNotFoundError: No module named 'agent.smart_model_routing'

---

def _resolve_turn_agent_config(self, user_message: str, model: str, runtime_kwargs: dict) -> dict:
    from agent.smart_model_routing import resolve_turn_route  # <-- This module doesn't exist
    from hermes_cli.models import resolve_fast_mode_overrides
    
    primary = {
        "model": model,
        ...
    }
    route = resolve_turn_route(user_message, getattr(self, "_smart_model_routing", {}), primary)
RAW_BUFFERClick to expand / collapse

Bug Description

When running Hermes Agent selfhost container (nousresearch/hermes-agent:latest), users receive the following error when sending messages:

ModuleNotFoundError: No module named 'agent.smart_model_routing'

Full Traceback

File "/opt/hermes/gateway/run.py", line 954, in _resolve_turn_agent_config
    from agent.smart_model_routing import resolve_turn_route
ModuleNotFoundError: No module named 'agent.smart_model_routing'

Evidence

  1. Official repo does not contain the file: https://github.com/NousResearch/hermes-agent/blob/main/agent/smart_model_routing.py returns 404

  2. Docker image missing the module: Running ls /opt/hermes/agent/ in the container shows 41 Python files, but smart_model_routing.py is NOT among them

  3. Hard dependency without fallback: The import in gateway/run.py line 954 is a direct import without try-except wrapper, causing immediate crash

Code Reference

From /opt/hermes/gateway/run.py:

def _resolve_turn_agent_config(self, user_message: str, model: str, runtime_kwargs: dict) -> dict:
    from agent.smart_model_routing import resolve_turn_route  # <-- This module doesn't exist
    from hermes_cli.models import resolve_fast_mode_overrides
    
    primary = {
        "model": model,
        ...
    }
    route = resolve_turn_route(user_message, getattr(self, "_smart_model_routing", {}), primary)

Impact

  • Severity: Critical - blocks all message processing
  • Trigger: Any user message sent through gateway (Feishu, Discord, etc.)
  • Affected users: All selfhost users using latest image pulled in the last 24 hours

Environment

  • Image: nousresearch/hermes-agent:latest (sha: bca0dbade0cb, built ~3 hours ago)
  • Platform: Docker on Synology NAS
  • Gateway: Feishu channel

Suggested Fix

Either:

  1. Add the missing agent/smart_model_routing.py module to the repository and rebuild the image
  2. Or wrap the import in a try-except block with a fallback behavior when the module is unavailable

Related Code

The _load_smart_model_routing() method at line 1334 loads config from config.yaml, suggesting this feature was intended but the implementation file was never committed.


This appears to be a release packaging issue where a new feature was partially integrated but the core module was left out of the final image. Would appreciate a quick fix as this blocks all selfhost deployments.

extent analysis

TL;DR

The most likely fix is to add a try-except block around the import of agent.smart_model_routing to handle the ModuleNotFoundError and provide a fallback behavior.

Guidance

  • Verify the absence of agent/smart_model_routing.py in the Docker image by running ls /opt/hermes/agent/ in the container.
  • Check the official repository for any signs of the missing module, such as a deleted or renamed file.
  • Consider adding a try-except block around the import in gateway/run.py to catch the ModuleNotFoundError and provide a fallback behavior, such as logging an error or using a default routing configuration.
  • If the module is intended to be part of the feature, investigate why it was not included in the repository and rebuild the image with the missing module.

Example

try:
    from agent.smart_model_routing import resolve_turn_route
except ModuleNotFoundError:
    # Fallback behavior, e.g., log an error or use a default routing configuration
    print("Error: agent.smart_model_routing module not found. Using default routing configuration.")
    def resolve_turn_route(user_message, smart_model_routing, primary):
        # Default routing configuration
        return primary

Notes

The provided code snippet assumes that the resolve_turn_route function is not critical to the functionality of the application and can be replaced with a default behavior. If this is not the case, a more comprehensive solution will be required.

Recommendation

Apply a workaround by adding a try-except block around the import of agent.smart_model_routing to handle the ModuleNotFoundError and provide a fallback behavior, as this will allow the application to continue functioning while a more permanent solution is developed.

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