Skip to content

Commit b8f86ef

Browse files
mr-leeUnshure
andcommitted
Update src/strands/experimental/agent_config.py
Co-authored-by: Nick Clegg <[email protected]>
1 parent 7df2938 commit b8f86ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/strands/experimental/agent_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def __init__(self, config_source: str | dict[str, any], tool_box: ToolBox | None
8585
# Validate all tool names exist in the ToolBox
8686
available_tools = self._toolbox.list_tool_names()
8787

88-
if any(tool_name not in available_tools for tool_name in config_tools) and self._raise_exception_on_missing_tool:
89-
missing_tool = next(tool_name for tool_name in config_tools if tool_name not in available_tools)
90-
raise ValueError(f"Tool '{missing_tool}' not found in ToolBox. Available tools: {available_tools}")
88+
missing_tools = set(config_tools).difference(set(available_tools))
89+
if missing_tools and self._raise_exception_on_missing_tool:
90+
raise ValueError(f"Tool(s) '{missing_tools}' not found in ToolBox. Available tools: {available_tools}")
9191

9292
# Store selected tools from the ToolBox (only ones that exist)
9393
all_tools = self._toolbox.list_tools()

0 commit comments

Comments
 (0)