feat: Profile-based channel routing for single-gateway multi-agent - #20018
Closed
Burgunthy wants to merge 1 commit into
Closed
feat: Profile-based channel routing for single-gateway multi-agent#20018Burgunthy wants to merge 1 commit into
Burgunthy wants to merge 1 commit into
Conversation
Implements profile routing (issue #18423) — allows a single gateway instance to route specific Discord channels/threads to different Hermes profiles, each with their own model, provider, and persona. Changes: - gateway/profile_routing.py (NEW): ProfileRoute dataclass, route parsing, and priority-based matching (thread > chat > platform) - gateway/config.py: GatewayConfig.profile_routes field + YAML parsing - gateway/session.py: build_session_key() accepts optional profile_name, scoping session keys to agent:{profile}: instead of hardcoded main - gateway/run.py: _handle_message() matches routes before session creation; _handle_message_with_agent() loads profile config.yaml overrides (model, provider, etc.) and merges them into agent runtime resolution - tests/gateway/test_profile_routing.py (NEW): 16 tests covering parsing, specificity sorting, and matching edge cases Backward-compatible: no routes configured = identical behavior. Session keys with profile_name=None default to agent:main: as before. Config example: profile_routes: - name: trader platform: discord chat_id: "123" profile: trader enabled: true
Contributor
Author
|
Closed by author — submitted to wrong repo. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements profile routing (closes #18423) — allows a single gateway instance to route specific channels/threads to different Hermes profiles, each with their own model, provider, and persona.
Use case: Run one Discord bot that behaves as a trader in
#stock, a wiki curator in#knowledge, and the default assistant everywhere else — without multiple bot tokens or gateway processes.How it works
When a message arrives, the gateway matches its source against configured routes (priority: thread > chat > platform). A matched route:
agent:{profile}:(isolated frommain)~/.hermes/profiles/{name}/config.yamloverrides (model, provider, etc.)No routes configured = identical behavior. Fully backward-compatible.
Changes
gateway/profile_routing.pyProfileRoutedataclass, route parsing, priority-based matchinggateway/config.pyGatewayConfig.profile_routesfield + YAML parsinggateway/session.pybuild_session_key()accepts optionalprofile_name(defaults to"main")gateway/run.py_handle_message()+ profile config loading in_handle_message_with_agent()tests/gateway/test_profile_routing.pyTest results
Related issues
Design notes
agent:main:discord:...vsagent:trader:discord:...model,provider,api_key,base_url,api_mode) merge with session-level/modeloverridesSOUL.mdand profile-specific memories are loaded via existing profile infrastructure