mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(delegate): make MCP toolset inheritance configurable
This commit is contained in:
parent
98e1396b15
commit
3e96c87f37
4 changed files with 100 additions and 6 deletions
|
|
@ -1058,6 +1058,59 @@ class TestChildCredentialPoolResolution(unittest.TestCase):
|
|||
|
||||
self.assertEqual(mock_child._credential_pool, mock_pool)
|
||||
|
||||
@patch("tools.delegate_tool._load_config", return_value={})
|
||||
def test_build_child_agent_does_not_preserve_mcp_toolsets_by_default(self, mock_cfg):
|
||||
parent = _make_mock_parent()
|
||||
parent.enabled_toolsets = ["web", "browser", "mcp-MiniMax"]
|
||||
|
||||
with patch("run_agent.AIAgent") as MockAgent:
|
||||
mock_child = MagicMock()
|
||||
MockAgent.return_value = mock_child
|
||||
|
||||
_build_child_agent(
|
||||
task_index=0,
|
||||
goal="Test narrowed toolsets",
|
||||
context=None,
|
||||
toolsets=["web", "browser"],
|
||||
model=None,
|
||||
max_iterations=10,
|
||||
parent_agent=parent,
|
||||
task_count=1,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
MockAgent.call_args[1]["enabled_toolsets"],
|
||||
["web", "browser"],
|
||||
)
|
||||
|
||||
@patch(
|
||||
"tools.delegate_tool._load_config",
|
||||
return_value={"inherit_mcp_toolsets": True},
|
||||
)
|
||||
def test_build_child_agent_can_preserve_parent_mcp_toolsets(self, mock_cfg):
|
||||
parent = _make_mock_parent()
|
||||
parent.enabled_toolsets = ["web", "browser", "mcp-MiniMax"]
|
||||
|
||||
with patch("run_agent.AIAgent") as MockAgent:
|
||||
mock_child = MagicMock()
|
||||
MockAgent.return_value = mock_child
|
||||
|
||||
_build_child_agent(
|
||||
task_index=0,
|
||||
goal="Test narrowed toolsets",
|
||||
context=None,
|
||||
toolsets=["web", "browser"],
|
||||
model=None,
|
||||
max_iterations=10,
|
||||
parent_agent=parent,
|
||||
task_count=1,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
MockAgent.call_args[1]["enabled_toolsets"],
|
||||
["web", "browser", "mcp-MiniMax"],
|
||||
)
|
||||
|
||||
|
||||
class TestChildCredentialLeasing(unittest.TestCase):
|
||||
def test_run_single_child_acquires_and_releases_lease(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue