diff --git a/tools/delegate_tool.py b/tools/delegate_tool.py index f00701cd94a..73ba81272fc 100644 --- a/tools/delegate_tool.py +++ b/tools/delegate_tool.py @@ -25,6 +25,8 @@ import time from concurrent.futures import ThreadPoolExecutor, as_completed from typing import Any, Dict, List, Optional +from toolsets import TOOLSETS + # Tools that children must never have access to DELEGATE_BLOCKED_TOOLS = frozenset([ @@ -35,6 +37,18 @@ DELEGATE_BLOCKED_TOOLS = frozenset([ "execute_code", # children should reason step-by-step, not write scripts ]) +# Build a description fragment listing toolsets available for subagents. +# Excludes toolsets where ALL tools are blocked, composite/platform toolsets +# (hermes-* prefixed), and scenario toolsets. +_EXCLUDED_TOOLSET_NAMES = frozenset({"debugging", "safe", "delegation", "moa", "rl"}) +_SUBAGENT_TOOLSETS = sorted( + name for name, defn in TOOLSETS.items() + if name not in _EXCLUDED_TOOLSET_NAMES + and not name.startswith("hermes-") + and not all(t in DELEGATE_BLOCKED_TOOLS for t in defn.get("tools", [])) +) +_TOOLSET_LIST_STR = ", ".join(f"'{n}'" for n in _SUBAGENT_TOOLSETS) + _DEFAULT_MAX_CONCURRENT_CHILDREN = 3 MAX_DEPTH = 2 # parent (0) -> child (1) -> grandchild rejected (2) @@ -999,9 +1013,10 @@ DELEGATE_TASK_SCHEMA = { "description": ( "Toolsets to enable for this subagent. " "Default: inherits your enabled toolsets. " + f"Available toolsets: {_TOOLSET_LIST_STR}. " "Common patterns: ['terminal', 'file'] for code work, " - "['web'] for research, ['terminal', 'file', 'web'] for " - "full-stack tasks." + "['web'] for research, ['browser'] for web interaction, " + "['terminal', 'file', 'web'] for full-stack tasks." ), }, "tasks": { @@ -1014,7 +1029,7 @@ DELEGATE_TASK_SCHEMA = { "toolsets": { "type": "array", "items": {"type": "string"}, - "description": "Toolsets for this specific task. Use 'web' for network access, 'terminal' for shell.", + "description": f"Toolsets for this specific task. Available: {_TOOLSET_LIST_STR}. Use 'web' for network access, 'terminal' for shell, 'browser' for web interaction.", }, "acp_command": { "type": "string",