mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-29 01:31:41 +00:00
fix: honor agent.disabled_toolsets in gateway sessions
Previously, agent.disabled_toolsets in config.yaml only worked for CLI mode (run_agent.py --disabled_toolsets). The gateway always passed enabled_toolsets to AIAgent, and get_tool_definitions() ignored disabled_toolsets when enabled_toolsets was set. Fix: _get_platform_tools() now reads agent.disabled_toolsets from config and excludes those toolsets from the returned set. This runs last so it overrides everything above. Added 3 tests covering cross-platform suppression, explicit platform config override, and empty/missing config no-op behavior.
This commit is contained in:
parent
d63abbc329
commit
40bd6d4709
2 changed files with 54 additions and 0 deletions
|
|
@ -17,6 +17,50 @@ from hermes_cli.tools_config import (
|
|||
)
|
||||
|
||||
|
||||
def test_agent_disabled_toolsets_suppresses_across_platforms():
|
||||
"""agent.disabled_toolsets in config.yaml should remove those toolsets
|
||||
from the enabled set, regardless of platform defaults or explicit config.
|
||||
"""
|
||||
config = {
|
||||
"agent": {"disabled_toolsets": ["memory"]},
|
||||
}
|
||||
|
||||
cli_enabled = _get_platform_tools(config, "cli")
|
||||
discord_enabled = _get_platform_tools(config, "discord")
|
||||
|
||||
assert "memory" not in cli_enabled
|
||||
assert "memory" not in discord_enabled
|
||||
|
||||
|
||||
def test_agent_disabled_toolsets_with_explicit_platform_config():
|
||||
"""agent.disabled_toolsets should still suppress even when the platform
|
||||
has an explicit toolset list that includes the disabled toolset.
|
||||
"""
|
||||
config = {
|
||||
"agent": {"disabled_toolsets": ["memory"]},
|
||||
"platform_toolsets": {"cli": ["web", "terminal", "memory"]},
|
||||
}
|
||||
|
||||
enabled = _get_platform_tools(config, "cli")
|
||||
|
||||
assert "memory" not in enabled
|
||||
assert "web" in enabled
|
||||
assert "terminal" in enabled
|
||||
|
||||
|
||||
def test_agent_disabled_toolsets_empty_list_is_noop():
|
||||
"""Empty or missing disabled_toolsets should not change behavior."""
|
||||
config_empty = {"agent": {"disabled_toolsets": []}}
|
||||
config_none = {"agent": {}}
|
||||
config_missing = {}
|
||||
|
||||
default = _get_platform_tools({}, "cli")
|
||||
|
||||
assert _get_platform_tools(config_empty, "cli") == default
|
||||
assert _get_platform_tools(config_none, "cli") == default
|
||||
assert _get_platform_tools(config_missing, "cli") == default
|
||||
|
||||
|
||||
def test_get_platform_tools_uses_default_when_platform_not_configured():
|
||||
config = {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue