mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: execute_code and delegate_task now respect disabled toolsets
When a user disables the web toolset via 'hermes tools', the execute_code schema description still hardcoded web_search/web_extract as available, causing the model to keep trying to use them. Similarly, delegate_task always defaulted to ['terminal', 'file', 'web'] for subagents regardless of the parent's config. Changes: - execute_code schema is now built dynamically via build_execute_code_schema() based on which sandbox tools are actually enabled - model_tools.py rebuilds the execute_code schema at definition time using the intersection of sandbox-allowed and session-enabled tools - delegate_task now inherits the parent agent's enabled_toolsets instead of hardcoding DEFAULT_TOOLSETS when no explicit toolsets are specified - delegate_task description updated to say 'inherits your enabled toolsets' Reported by kotyKD on Discord.
This commit is contained in:
parent
94053d75a6
commit
f75b1d21b4
3 changed files with 94 additions and 34 deletions
|
|
@ -225,6 +225,18 @@ def get_tool_definitions(
|
|||
# Ask the registry for schemas (only returns tools whose check_fn passes)
|
||||
filtered_tools = registry.get_definitions(tools_to_include, quiet=quiet_mode)
|
||||
|
||||
# Rebuild execute_code schema to only list sandbox tools that are actually
|
||||
# enabled. Without this, the model sees "web_search is available in
|
||||
# execute_code" even when the user disabled the web toolset (#560-discord).
|
||||
if "execute_code" in tools_to_include:
|
||||
from tools.code_execution_tool import SANDBOX_ALLOWED_TOOLS, build_execute_code_schema
|
||||
sandbox_enabled = SANDBOX_ALLOWED_TOOLS & tools_to_include
|
||||
dynamic_schema = build_execute_code_schema(sandbox_enabled)
|
||||
for i, td in enumerate(filtered_tools):
|
||||
if td.get("function", {}).get("name") == "execute_code":
|
||||
filtered_tools[i] = {"type": "function", "function": dynamic_schema}
|
||||
break
|
||||
|
||||
if not quiet_mode:
|
||||
if filtered_tools:
|
||||
tool_names = [t["function"]["name"] for t in filtered_tools]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue