hermes - ✅(Solved) Fix feat(gateway): add platform_class config for custom platform adapters [1 pull requests, 1 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#11813Fetched 2026-04-18 05:58:44
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Add platform_class: Optional[str] field to PlatformConfig to enable config-driven custom platform adapter loading without code changes to gateway/run.py.

Root Cause

Add platform_class: Optional[str] field to PlatformConfig to enable config-driven custom platform adapter loading without code changes to gateway/run.py.

Fix Action

Fixed

PR fix notes

PR #11817: feat(gateway): add platform_class config for custom platform adapters

Description (problem / solution / changelog)

Summary

Add platform_class: Optional[str] field to PlatformConfig to enable config-driven custom platform adapter loading without modifying gateway/run.py.

What changed

  • gateway/config.py:

    • Add platform_class: Optional[str] = None field to PlatformConfig
    • Include in to_dict() and from_dict()
  • gateway/run.py:

    • Check platform_class before factory branches
    • Use importlib.import_module() for dynamic class loading
    • Graceful error handling with logging

How to test

# In config.yaml
platforms:
  my_custom_platform:
    platform_class: "my_package.adapters.MyAdapter"
    token: "your-token"

Or via environment:

export MY_CUSTOM_PLATFORM_PLATFORM_CLASS="my_package.adapters.MyAdapter"

Platforms tested

  • macOS (Darwin 25.3.0)

Related

  • Near-term solution for #3823 (platform registry with self-registering adapters)
  • Enables third-party platform adapters without forking

Closes #11813

Changed files

  • gateway/config.py (modified, +9/-1)
  • gateway/run.py (modified, +14/-2)
  • hermes_cli/plugins.py (modified, +29/-12)
  • run_agent.py (modified, +48/-2)
  • tools/approval.py (modified, +6/-1)
  • tools/terminal_tool.py (modified, +17/-0)

Code Example

platforms:
  my_custom_platform:
    platform_class: "my_package.adapters.MyAdapter"
    token: "..."
RAW_BUFFERClick to expand / collapse

Summary

Add platform_class: Optional[str] field to PlatformConfig to enable config-driven custom platform adapter loading without code changes to gateway/run.py.

Motivation

Currently, adding a custom platform adapter requires:

  1. Modifying gateway/run.py to add a factory branch in _create_adapter()
  2. Repeating this for each deployment/environment

This change allows users to specify a custom adapter class via config:

platforms:
  my_custom_platform:
    platform_class: "my_package.adapters.MyAdapter"
    token: "..."

Changes

  • gateway/config.py: Add platform_class: Optional[str] = None to PlatformConfig
  • gateway/run.py: Check platform_class before factory branches, use importlib.import_module() to load

Related

  • Near-term solution for #3823 (platform registry with self-registering adapters)
  • Enables third-party platform adapters without forking the repo

extent analysis

TL;DR

To enable config-driven custom platform adapter loading, add a platform_class field to PlatformConfig and modify gateway/run.py to load the adapter class dynamically.

Guidance

  • Add platform_class: Optional[str] to PlatformConfig in gateway/config.py to store the custom adapter class name.
  • Modify gateway/run.py to check the platform_class field before the factory branches and use importlib.import_module() to load the custom adapter class.
  • Update the configuration to include the platform_class field, e.g., platforms: my_custom_platform: platform_class: "my_package.adapters.MyAdapter".
  • Verify that the custom adapter is loaded correctly by checking the adapter instance created in gateway/run.py.

Example

# gateway/run.py
import importlib

# ...

if platform_config.platform_class:
    adapter_module = importlib.import_module(platform_config.platform_class)
    adapter_class = getattr(adapter_module, platform_config.platform_class.split('.')[-1])
    adapter = adapter_class()
else:
    # existing factory branches
    pass

Notes

This solution assumes that the custom adapter class is importable and has the same interface as the existing adapters.

Recommendation

Apply the workaround by adding the platform_class field to PlatformConfig and modifying gateway/run.py to load the custom adapter class dynamically, as this allows for more flexibility and easier maintenance of custom platform adapters.

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

hermes - ✅(Solved) Fix feat(gateway): add platform_class config for custom platform adapters [1 pull requests, 1 participants]